Add dendrite support to cypress tests (#9884)
* Minimum hacks required to run cypress tests with dendrite * Remove wget hack since dendrite containers now have curl * Add basic dendritedocker plugin & hack into login spec for testing * Add generic HomeserverInstance interface * Add env var to configure which homeserver to use * Remove synapse specific homeserver support api * Update the rest of the tests to use HomeserverInstance * Update cypress docs to reference new homeserver abstraction * Fix formatting issues * Change dendrite to use main branch container
This commit is contained in:
parent
b642df98e9
commit
79033eb034
50 changed files with 947 additions and 362 deletions
|
@ -20,43 +20,45 @@ import _ from "lodash";
|
|||
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
import { Interception } from "cypress/types/net-stubbing";
|
||||
|
||||
import { SynapseInstance } from "../../plugins/synapsedocker";
|
||||
import { HomeserverInstance } from "../../plugins/utils/homeserver";
|
||||
import { SettingLevel } from "../../../src/settings/SettingLevel";
|
||||
import { Layout } from "../../../src/settings/enums/Layout";
|
||||
import { ProxyInstance } from "../../plugins/sliding-sync";
|
||||
|
||||
describe("Sliding Sync", () => {
|
||||
beforeEach(() => {
|
||||
cy.startSynapse("default")
|
||||
.as("synapse")
|
||||
.then((synapse) => {
|
||||
cy.startProxy(synapse).as("proxy");
|
||||
cy.startHomeserver("default")
|
||||
.as("homeserver")
|
||||
.then((homeserver) => {
|
||||
cy.startProxy(homeserver).as("proxy");
|
||||
});
|
||||
|
||||
cy.all([cy.get<SynapseInstance>("@synapse"), cy.get<ProxyInstance>("@proxy")]).then(([synapse, proxy]) => {
|
||||
cy.enableLabsFeature("feature_sliding_sync");
|
||||
cy.all([cy.get<HomeserverInstance>("@homeserver"), cy.get<ProxyInstance>("@proxy")]).then(
|
||||
([homeserver, proxy]) => {
|
||||
cy.enableLabsFeature("feature_sliding_sync");
|
||||
|
||||
cy.intercept("/config.json?cachebuster=*", (req) => {
|
||||
return req.continue((res) => {
|
||||
res.send(200, {
|
||||
...res.body,
|
||||
setting_defaults: {
|
||||
feature_sliding_sync_proxy_url: `http://localhost:${proxy.port}`,
|
||||
},
|
||||
cy.intercept("/config.json?cachebuster=*", (req) => {
|
||||
return req.continue((res) => {
|
||||
res.send(200, {
|
||||
...res.body,
|
||||
setting_defaults: {
|
||||
feature_sliding_sync_proxy_url: `http://localhost:${proxy.port}`,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
cy.initTestUser(synapse, "Sloth").then(() => {
|
||||
return cy.window({ log: false }).then(() => {
|
||||
cy.createRoom({ name: "Test Room" }).as("roomId");
|
||||
cy.initTestUser(homeserver, "Sloth").then(() => {
|
||||
return cy.window({ log: false }).then(() => {
|
||||
cy.createRoom({ name: "Test Room" }).as("roomId");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.get<SynapseInstance>("@synapse").then(cy.stopSynapse);
|
||||
cy.get<HomeserverInstance>("@homeserver").then(cy.stopHomeserver);
|
||||
cy.get<ProxyInstance>("@proxy").then(cy.stopProxy);
|
||||
});
|
||||
|
||||
|
@ -84,9 +86,9 @@ describe("Sliding Sync", () => {
|
|||
};
|
||||
const createAndJoinBob = () => {
|
||||
// create a Bob user
|
||||
cy.get<SynapseInstance>("@synapse").then((synapse) => {
|
||||
cy.get<HomeserverInstance>("@homeserver").then((homeserver) => {
|
||||
return cy
|
||||
.getBot(synapse, {
|
||||
.getBot(homeserver, {
|
||||
displayName: "Bob",
|
||||
})
|
||||
.as("bob");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue