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:
devonh 2023-01-10 23:29:56 +00:00 committed by GitHub
parent b642df98e9
commit 79033eb034
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 947 additions and 362 deletions

View file

@ -18,7 +18,7 @@ limitations under the License.
import type { MatrixClient } from "matrix-js-sdk/src/client";
import type { ICreateRoomOpts } from "matrix-js-sdk/src/@types/requests";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import Chainable = Cypress.Chainable;
import { UserCredentials } from "../../support/login";
@ -59,14 +59,14 @@ function spaceChildInitialState(roomId: string): ICreateRoomOpts["initial_state"
}
describe("Spaces", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
let user: UserCredentials;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Sue").then((_user) => {
cy.initTestUser(homeserver, "Sue").then((_user) => {
user = _user;
cy.mockClipboard();
});
@ -74,7 +74,7 @@ describe("Spaces", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it.only("should allow user to create public space", () => {
@ -173,7 +173,7 @@ describe("Spaces", () => {
it("should allow user to invite another to a space", () => {
let bot: MatrixClient;
cy.getBot(synapse, { displayName: "BotBob" }).then((_bot) => {
cy.getBot(homeserver, { displayName: "BotBob" }).then((_bot) => {
bot = _bot;
});
@ -208,7 +208,7 @@ describe("Spaces", () => {
});
cy.getSpacePanelButton("My Space").should("exist");
cy.getBot(synapse, { displayName: "BotBob" }).then({ timeout: 10000 }, async (bot) => {
cy.getBot(homeserver, { displayName: "BotBob" }).then({ timeout: 10000 }, async (bot) => {
const { room_id: roomId } = await bot.createRoom(spaceCreateOptions("Space Space"));
await bot.invite(roomId, user.userId);
});