Merge branch 'develop' into widget_state_no_update_invitation_room

This commit is contained in:
Mikhail Aheichyk 2023-01-12 10:06:51 +03:00
commit 73a8c5bcc4
157 changed files with 4983 additions and 2207 deletions

View file

@ -16,25 +16,25 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { SettingLevel } from "../../../src/settings/SettingLevel";
describe("Composer", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
describe("CIDER", () => {
beforeEach(() => {
cy.initTestUser(synapse, "Janet").then(() => {
cy.initTestUser(homeserver, "Janet").then(() => {
cy.createRoom({ name: "Composing Room" });
});
cy.viewRoomByName("Composing Room");
@ -101,7 +101,7 @@ describe("Composer", () => {
describe("WYSIWYG", () => {
beforeEach(() => {
cy.enableLabsFeature("feature_wysiwyg_composer");
cy.initTestUser(synapse, "Janet").then(() => {
cy.initTestUser(homeserver, "Janet").then(() => {
cy.createRoom({ name: "Composing Room" });
});
cy.viewRoomByName("Composing Room");

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import Chainable = Cypress.Chainable;
function openCreateRoomDialog(): Chainable<JQuery<HTMLElement>> {
@ -26,18 +26,18 @@ function openCreateRoomDialog(): Chainable<JQuery<HTMLElement>> {
}
describe("Create Room", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Jim");
cy.initTestUser(homeserver, "Jim");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should allow us to create a public room with name, topic & address set", () => {

View file

@ -18,12 +18,12 @@ import type { ISendEventResponse, MatrixClient, Room } from "matrix-js-sdk/src/m
import type { VerificationRequest } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
import type { ISasEvent } from "matrix-js-sdk/src/crypto/verification/SAS";
import type { CypressBot } from "../../support/bot";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import Chainable = Cypress.Chainable;
type EmojiMapping = [emoji: string, name: string];
interface CryptoTestContext extends Mocha.Context {
synapse: SynapseInstance;
homeserver: HomeserverInstance;
bob: CypressBot;
}
@ -155,16 +155,16 @@ const verify = function (this: CryptoTestContext) {
describe("Cryptography", function () {
beforeEach(function () {
cy.startSynapse("default")
.as("synapse")
.then((synapse: SynapseInstance) => {
cy.initTestUser(synapse, "Alice", undefined, "alice_");
cy.getBot(synapse, { displayName: "Bob", autoAcceptInvites: false, userIdPrefix: "bob_" }).as("bob");
cy.startHomeserver("default")
.as("homeserver")
.then((homeserver: HomeserverInstance) => {
cy.initTestUser(homeserver, "Alice", undefined, "alice_");
cy.getBot(homeserver, { displayName: "Bob", autoAcceptInvites: false, userIdPrefix: "bob_" }).as("bob");
});
});
afterEach(function (this: CryptoTestContext) {
cy.stopSynapse(this.synapse);
cy.stopHomeserver(this.homeserver);
});
it("setting up secure key backup should work", () => {
@ -215,7 +215,7 @@ describe("Cryptography", function () {
cy.bootstrapCrossSigning();
// bob has a second, not cross-signed, device
cy.loginBot(this.synapse, this.bob.getUserId(), this.bob.__cypress_password, {}).as("bobSecondDevice");
cy.loginBot(this.homeserver, this.bob.getUserId(), this.bob.__cypress_password, {}).as("bobSecondDevice");
autoJoin(this.bob);

View file

@ -17,7 +17,7 @@ limitations under the License.
import type { VerificationRequest } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
import type { ISasEvent } from "matrix-js-sdk/src/crypto/verification/SAS";
import type { MatrixClient } from "matrix-js-sdk/src/matrix";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { UserCredentials } from "../../support/login";
import Chainable = Cypress.Chainable;
@ -56,20 +56,20 @@ const handleVerificationRequest = (request: VerificationRequest): Chainable<Emoj
};
describe("Decryption Failure Bar", () => {
let synapse: SynapseInstance | undefined;
let homeserver: HomeserverInstance | undefined;
let testUser: UserCredentials | undefined;
let bot: MatrixClient | undefined;
let roomId: string;
beforeEach(function () {
cy.startSynapse("default").then((syn: SynapseInstance) => {
synapse = syn;
cy.initTestUser(synapse, TEST_USER)
cy.startHomeserver("default").then((hs: HomeserverInstance) => {
homeserver = hs;
cy.initTestUser(homeserver, TEST_USER)
.then((creds: UserCredentials) => {
testUser = creds;
})
.then(() => {
cy.getBot(synapse, { displayName: BOT_USER }).then((cli) => {
cy.getBot(homeserver, { displayName: BOT_USER }).then((cli) => {
bot = cli;
});
})
@ -97,7 +97,7 @@ describe("Decryption Failure Bar", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it(
@ -105,7 +105,7 @@ describe("Decryption Failure Bar", () => {
"and there are other verified devices or backups",
() => {
let otherDevice: MatrixClient | undefined;
cy.loginBot(synapse, testUser.username, testUser.password, {})
cy.loginBot(homeserver, testUser.username, testUser.password, {})
.then(async (cli) => {
otherDevice = cli;
await otherDevice.bootstrapCrossSigning({
@ -169,7 +169,7 @@ describe("Decryption Failure Bar", () => {
"should prompt the user to reset keys, if this device isn't verified " +
"and there are no other verified devices or backups",
() => {
cy.loginBot(synapse, testUser.username, testUser.password, {}).then(async (cli) => {
cy.loginBot(homeserver, testUser.username, testUser.password, {}).then(async (cli) => {
await cli.bootstrapCrossSigning({
authUploadDeviceSigningKeys: async (makeRequest) => {
await makeRequest({});

View file

@ -16,24 +16,26 @@ limitations under the License.
/// <reference types="cypress" />
import { MessageEvent } from "matrix-events-sdk";
import type { MsgType } from "matrix-js-sdk/src/@types/event";
import type { ISendEventResponse } from "matrix-js-sdk/src/@types/requests";
import type { EventType } from "matrix-js-sdk/src/@types/event";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import Chainable = Cypress.Chainable;
const sendEvent = (roomId: string): Chainable<ISendEventResponse> => {
return cy.sendEvent(roomId, null, "m.room.message" as EventType, MessageEvent.from("Message").serialize().content);
return cy.sendEvent(roomId, null, "m.room.message" as EventType, {
msgtype: "m.text" as MsgType,
body: "Message",
});
};
describe("Editing", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.initTestUser(synapse, "Edith").then(() => {
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, "Edith").then(() => {
cy.injectAxe();
return cy.createRoom({ name: "Test room" }).as("roomId");
});
@ -41,7 +43,7 @@ describe("Editing", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should close the composer when clicking save after making a change and undoing it", () => {

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { UserCredentials } from "../../support/login";
const ROOM_NAME = "Integration Manager Test";
@ -73,17 +73,17 @@ function sendActionFromIntegrationManager(integrationManagerUrl: string) {
describe("Integration Manager: Get OpenID Token", () => {
let testUser: UserCredentials;
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
let integrationManagerUrl: string;
beforeEach(() => {
cy.serveHtmlFile(INTEGRATION_MANAGER_HTML).then((url) => {
integrationManagerUrl = url;
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, USER_DISPLAY_NAME, () => {
cy.initTestUser(homeserver, USER_DISPLAY_NAME, () => {
cy.window().then((win) => {
win.localStorage.setItem("mx_scalar_token", INTEGRATION_MANAGER_TOKEN);
win.localStorage.setItem(`mx_scalar_token_at_${integrationManagerUrl}`, INTEGRATION_MANAGER_TOKEN);
@ -122,7 +122,7 @@ describe("Integration Manager: Get OpenID Token", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
cy.stopWebServers();
});

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { MatrixClient } from "../../global";
import { UserCredentials } from "../../support/login";
@ -94,17 +94,17 @@ function expectKickedMessage(shouldExist: boolean) {
describe("Integration Manager: Kick", () => {
let testUser: UserCredentials;
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
let integrationManagerUrl: string;
beforeEach(() => {
cy.serveHtmlFile(INTEGRATION_MANAGER_HTML).then((url) => {
integrationManagerUrl = url;
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, USER_DISPLAY_NAME, () => {
cy.initTestUser(homeserver, USER_DISPLAY_NAME, () => {
cy.window().then((win) => {
win.localStorage.setItem("mx_scalar_token", INTEGRATION_MANAGER_TOKEN);
win.localStorage.setItem(`mx_scalar_token_at_${integrationManagerUrl}`, INTEGRATION_MANAGER_TOKEN);
@ -140,12 +140,12 @@ describe("Integration Manager: Kick", () => {
name: ROOM_NAME,
}).as("roomId");
cy.getBot(synapse, { displayName: BOT_DISPLAY_NAME, autoAcceptInvites: true }).as("bob");
cy.getBot(homeserver, { displayName: BOT_DISPLAY_NAME, autoAcceptInvites: true }).as("bob");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
cy.stopWebServers();
});

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { UserCredentials } from "../../support/login";
const ROOM_NAME = "Integration Manager Test";
@ -87,17 +87,17 @@ function sendActionFromIntegrationManager(
describe("Integration Manager: Read Events", () => {
let testUser: UserCredentials;
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
let integrationManagerUrl: string;
beforeEach(() => {
cy.serveHtmlFile(INTEGRATION_MANAGER_HTML).then((url) => {
integrationManagerUrl = url;
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, USER_DISPLAY_NAME, () => {
cy.initTestUser(homeserver, USER_DISPLAY_NAME, () => {
cy.window().then((win) => {
win.localStorage.setItem("mx_scalar_token", INTEGRATION_MANAGER_TOKEN);
win.localStorage.setItem(`mx_scalar_token_at_${integrationManagerUrl}`, INTEGRATION_MANAGER_TOKEN);
@ -136,7 +136,7 @@ describe("Integration Manager: Read Events", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
cy.stopWebServers();
});

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { UserCredentials } from "../../support/login";
const ROOM_NAME = "Integration Manager Test";
@ -93,17 +93,17 @@ function sendActionFromIntegrationManager(
describe("Integration Manager: Send Event", () => {
let testUser: UserCredentials;
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
let integrationManagerUrl: string;
beforeEach(() => {
cy.serveHtmlFile(INTEGRATION_MANAGER_HTML).then((url) => {
integrationManagerUrl = url;
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, USER_DISPLAY_NAME, () => {
cy.initTestUser(homeserver, USER_DISPLAY_NAME, () => {
cy.window().then((win) => {
win.localStorage.setItem("mx_scalar_token", INTEGRATION_MANAGER_TOKEN);
win.localStorage.setItem(`mx_scalar_token_at_${integrationManagerUrl}`, INTEGRATION_MANAGER_TOKEN);
@ -142,7 +142,7 @@ describe("Integration Manager: Send Event", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
cy.stopWebServers();
});

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { MatrixClient } from "../../global";
import Chainable = Cypress.Chainable;
@ -26,7 +26,7 @@ interface Charly {
}
describe("Lazy Loading", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
let bob: MatrixClient;
const charlies: Charly[] = [];
@ -35,12 +35,12 @@ describe("Lazy Loading", () => {
win.localStorage.setItem("mx_lhs_size", "0"); // Collapse left panel for these tests
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Alice");
cy.initTestUser(homeserver, "Alice");
cy.getBot(synapse, {
cy.getBot(homeserver, {
displayName: "Bob",
startClient: false,
autoAcceptInvites: false,
@ -50,7 +50,7 @@ describe("Lazy Loading", () => {
for (let i = 1; i <= 10; i++) {
const displayName = `Charly #${i}`;
cy.getBot(synapse, {
cy.getBot(homeserver, {
displayName,
startClient: false,
autoAcceptInvites: false,
@ -62,7 +62,7 @@ describe("Lazy Loading", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
const name = "Lazy Loading Test";

View file

@ -16,11 +16,11 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import Chainable = Cypress.Chainable;
describe("Location sharing", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
const selectLocationShareTypeOption = (shareType: string): Chainable<JQuery> => {
return cy.get(`[data-test-id="share-location-option-${shareType}"]`);
@ -34,15 +34,15 @@ describe("Location sharing", () => {
cy.window().then((win) => {
win.localStorage.setItem("mx_lhs_size", "0"); // Collapse left panel for these tests
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Tom");
cy.initTestUser(homeserver, "Tom");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("sends and displays pin drop location message successfully", () => {

View file

@ -18,21 +18,21 @@ limitations under the License.
import { SinonStub } from "cypress/types/sinon";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
describe("Consent", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("consent").then((data) => {
synapse = data;
cy.startHomeserver("consent").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Bob");
cy.initTestUser(homeserver, "Bob");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should prompt the user to consent to terms when server deems it necessary", () => {
@ -53,8 +53,8 @@ describe("Consent", () => {
cy.get<SinonStub>("@windowOpen").then((stub) => {
const url = stub.getCall(0).args[0];
// Go to Synapse's consent page and accept it
cy.origin(synapse.baseUrl, { args: { url } }, ({ url }) => {
// Go to Homeserver's consent page and accept it
cy.origin(homeserver.baseUrl, { args: { url } }, ({ url }) => {
cy.visit(url);
cy.get('[type="submit"]').click();

View file

@ -16,17 +16,17 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
describe("Login", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.stubDefaultServer();
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
describe("m.login.password", () => {
@ -34,9 +34,9 @@ describe("Login", () => {
const password = "p4s5W0rD";
beforeEach(() => {
cy.startSynapse("consent").then((data) => {
synapse = data;
cy.registerUser(synapse, username, password);
cy.startHomeserver("consent").then((data) => {
homeserver = data;
cy.registerUser(homeserver, username, password);
cy.visit("/#/login");
});
});
@ -49,7 +49,7 @@ describe("Login", () => {
cy.checkA11y();
cy.get(".mx_ServerPicker_change").click();
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(synapse.baseUrl);
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(homeserver.baseUrl);
cy.get(".mx_ServerPickerDialog_continue").click();
// wait for the dialog to go away
cy.get(".mx_ServerPickerDialog").should("not.exist");
@ -64,9 +64,9 @@ describe("Login", () => {
describe("logout", () => {
beforeEach(() => {
cy.startSynapse("consent").then((data) => {
synapse = data;
cy.initTestUser(synapse, "Erin");
cy.startHomeserver("consent").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, "Erin");
});
});

View file

@ -18,14 +18,14 @@ limitations under the License.
import { PollResponseEvent } from "matrix-events-sdk";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { MatrixClient } from "../../global";
import Chainable = Cypress.Chainable;
const hideTimestampCSS = ".mx_MessageTimestamp { visibility: hidden !important; }";
describe("Polls", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
type CreatePollOptions = {
title: string;
@ -77,24 +77,24 @@ describe("Polls", () => {
};
beforeEach(() => {
cy.enableLabsFeature("feature_threadstable");
cy.enableLabsFeature("feature_threadenabled");
cy.window().then((win) => {
win.localStorage.setItem("mx_lhs_size", "0"); // Collapse left panel for these tests
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Tom");
cy.initTestUser(homeserver, "Tom");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should be creatable and votable", () => {
let bot: MatrixClient;
cy.getBot(synapse, { displayName: "BotBob" }).then((_bot) => {
cy.getBot(homeserver, { displayName: "BotBob" }).then((_bot) => {
bot = _bot;
});
@ -163,7 +163,7 @@ describe("Polls", () => {
it("should be editable from context menu if no votes have been cast", () => {
let bot: MatrixClient;
cy.getBot(synapse, { displayName: "BotBob" }).then((_bot) => {
cy.getBot(homeserver, { displayName: "BotBob" }).then((_bot) => {
bot = _bot;
});
@ -206,7 +206,7 @@ describe("Polls", () => {
it("should not be editable from context menu if votes have been cast", () => {
let bot: MatrixClient;
cy.getBot(synapse, { displayName: "BotBob" }).then((_bot) => {
cy.getBot(homeserver, { displayName: "BotBob" }).then((_bot) => {
bot = _bot;
});
@ -256,10 +256,10 @@ describe("Polls", () => {
it("should be displayed correctly in thread panel", () => {
let botBob: MatrixClient;
let botCharlie: MatrixClient;
cy.getBot(synapse, { displayName: "BotBob" }).then((_bot) => {
cy.getBot(homeserver, { displayName: "BotBob" }).then((_bot) => {
botBob = _bot;
});
cy.getBot(synapse, { displayName: "BotCharlie" }).then((_bot) => {
cy.getBot(homeserver, { displayName: "BotCharlie" }).then((_bot) => {
botCharlie = _bot;
});

View file

@ -16,21 +16,21 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
describe("Registration", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.stubDefaultServer();
cy.visit("/#/register");
cy.startSynapse("consent").then((data) => {
synapse = data;
cy.startHomeserver("consent").then((data) => {
homeserver = data;
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("registers an account and lands on the home screen", () => {
@ -42,13 +42,13 @@ describe("Registration", () => {
cy.get(".mx_Dialog").percySnapshotElement("Server Picker", { widths: [516] });
cy.checkA11y();
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(synapse.baseUrl);
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(homeserver.baseUrl);
cy.get(".mx_ServerPickerDialog_continue").click();
// wait for the dialog to go away
cy.get(".mx_ServerPickerDialog").should("not.exist");
cy.get("#mx_RegistrationForm_username").should("be.visible");
// Hide the server text as it contains the randomly allocated Synapse port
// Hide the server text as it contains the randomly allocated Homeserver port
const percyCSS = ".mx_ServerPicker_server { visibility: hidden !important; }";
cy.percySnapshot("Registration", { percyCSS });
cy.checkA11y();
@ -88,7 +88,7 @@ describe("Registration", () => {
it("should require username to fulfil requirements and be available", () => {
cy.get(".mx_ServerPicker_change", { timeout: 15000 }).click();
cy.get(".mx_ServerPickerDialog_continue").should("be.visible");
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(synapse.baseUrl);
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(homeserver.baseUrl);
cy.get(".mx_ServerPickerDialog_continue").click();
// wait for the dialog to go away
cy.get(".mx_ServerPickerDialog").should("not.exist");

View file

@ -16,21 +16,21 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
describe("Pills", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Sally");
cy.initTestUser(homeserver, "Sally");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should navigate clicks internally to the app", () => {

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import Chainable = Cypress.Chainable;
const ROOM_NAME = "Test room";
@ -43,12 +43,12 @@ const checkRoomSummaryCard = (name: string): Chainable<JQuery<HTMLElement>> => {
};
describe("RightPanel", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.initTestUser(synapse, NAME).then(() =>
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, NAME).then(() =>
cy.window({ log: false }).then(() => {
cy.createRoom({ name: ROOM_NAME });
cy.createSpace({ name: SPACE_NAME });
@ -58,7 +58,7 @@ describe("RightPanel", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
describe("in rooms", () => {

View file

@ -16,23 +16,23 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { MatrixClient } from "../../global";
describe("Room Directory", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Ray");
cy.getBot(synapse, { displayName: "Paul" }).as("bot");
cy.initTestUser(homeserver, "Ray");
cy.getBot(homeserver, { displayName: "Paul" }).as("bot");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should allow admin to add alias & publish room to directory", () => {

View file

@ -18,34 +18,34 @@ limitations under the License.
import { EventType } from "matrix-js-sdk/src/@types/event";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { MatrixClient } from "../../global";
describe("Room Directory", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Alice");
cy.initTestUser(homeserver, "Alice");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should switch between existing dm rooms without a loader", () => {
let bobClient: MatrixClient;
let charlieClient: MatrixClient;
cy.getBot(synapse, {
cy.getBot(homeserver, {
displayName: "Bob",
}).then((bob) => {
bobClient = bob;
});
cy.getBot(synapse, {
cy.getBot(homeserver, {
displayName: "Charlie",
}).then((charlie) => {
charlieClient = charlie;

View file

@ -16,34 +16,34 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import type { UserCredentials } from "../../support/login";
describe("Device manager", () => {
let synapse: SynapseInstance | undefined;
let homeserver: HomeserverInstance | undefined;
let user: UserCredentials | undefined;
beforeEach(() => {
cy.enableLabsFeature("feature_new_device_manager");
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Alice")
cy.initTestUser(homeserver, "Alice")
.then((credentials) => {
user = credentials;
})
.then(() => {
// create some extra sessions to manage
return cy.loginUser(synapse, user.username, user.password);
return cy.loginUser(homeserver, user.username, user.password);
})
.then(() => {
return cy.loginUser(synapse, user.username, user.password);
return cy.loginUser(homeserver, user.username, user.password);
});
});
});
afterEach(() => {
cy.stopSynapse(synapse!);
cy.stopHomeserver(homeserver!);
});
it("should display sessions", () => {

View file

@ -16,10 +16,10 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
function seedLabs(synapse: SynapseInstance, labsVal: boolean | null): void {
cy.initTestUser(synapse, "Sally", () => {
function seedLabs(homeserver: HomeserverInstance, labsVal: boolean | null): void {
cy.initTestUser(homeserver, "Sally", () => {
// seed labs flag
cy.window({ log: false }).then((win) => {
if (typeof labsVal === "boolean") {
@ -61,30 +61,30 @@ describe("Hidden Read Receipts Setting Migration", () => {
// For a security-sensitive feature like hidden read receipts, it's absolutely vital
// that we migrate the setting appropriately.
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should not migrate the lack of a labs flag", () => {
seedLabs(synapse, null);
seedLabs(homeserver, null);
testForVal(null);
});
it("should migrate labsHiddenRR=false as sendRR=true", () => {
seedLabs(synapse, false);
seedLabs(homeserver, false);
testForVal(true);
});
it("should migrate labsHiddenRR=true as sendRR=false", () => {
seedLabs(synapse, true);
seedLabs(homeserver, true);
testForVal(false);
});
});

View file

@ -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");

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);
});

View file

@ -17,7 +17,7 @@ limitations under the License.
/// <reference types="cypress" />
import { MatrixClient } from "../../global";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import Chainable = Cypress.Chainable;
import Loggable = Cypress.Loggable;
import Timeoutable = Cypress.Timeoutable;
@ -136,7 +136,7 @@ Cypress.Commands.add("startDM", (name: string) => {
});
describe("Spotlight", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
const bot1Name = "BotBob";
let bot1: MatrixClient;
@ -154,16 +154,16 @@ describe("Spotlight", () => {
let room3Id: string;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.initTestUser(synapse, "Jim")
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, "Jim")
.then(() =>
cy.getBot(synapse, { displayName: bot1Name }).then((_bot1) => {
cy.getBot(homeserver, { displayName: bot1Name }).then((_bot1) => {
bot1 = _bot1;
}),
)
.then(() =>
cy.getBot(synapse, { displayName: bot2Name }).then((_bot2) => {
cy.getBot(homeserver, { displayName: bot2Name }).then((_bot2) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
bot2 = _bot2;
}),
@ -205,7 +205,7 @@ describe("Spotlight", () => {
afterEach(() => {
cy.visit("/#/home");
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should be able to add and remove filters via keyboard", () => {

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { MatrixClient } from "../../global";
function markWindowBeforeReload(): void {
@ -25,23 +25,23 @@ function markWindowBeforeReload(): void {
}
describe("Threads", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
// Default threads to ON for this spec
cy.enableLabsFeature("feature_threadstable");
cy.enableLabsFeature("feature_threadenabled");
cy.window().then((win) => {
win.localStorage.setItem("mx_lhs_size", "0"); // Collapse left panel for these tests
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Tom");
cy.initTestUser(homeserver, "Tom");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should reload when enabling threads beta", () => {
@ -75,7 +75,7 @@ describe("Threads", () => {
it("should be usable for a conversation", () => {
let bot: MatrixClient;
cy.getBot(synapse, {
cy.getBot(homeserver, {
displayName: "BotBob",
autoAcceptInvites: false,
}).then((_bot) => {

View file

@ -16,11 +16,9 @@ limitations under the License.
/// <reference types="cypress" />
import { MessageEvent } from "matrix-events-sdk";
import type { ISendEventResponse } from "matrix-js-sdk/src/@types/requests";
import type { EventType } from "matrix-js-sdk/src/@types/event";
import { SynapseInstance } from "../../plugins/synapsedocker";
import type { EventType, MsgType } from "matrix-js-sdk/src/@types/event";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { SettingLevel } from "../../../src/settings/SettingLevel";
import { Layout } from "../../../src/settings/enums/Layout";
import Chainable = Cypress.Chainable;
@ -55,16 +53,21 @@ const expectAvatar = (e: JQuery<HTMLElement>, avatarUrl: string): void => {
};
const sendEvent = (roomId: string, html = false): Chainable<ISendEventResponse> => {
return cy.sendEvent(
roomId,
null,
"m.room.message" as EventType,
MessageEvent.from("Message", html ? "<b>Message</b>" : undefined).serialize().content,
);
const content = {
msgtype: "m.text" as MsgType,
body: "Message",
format: undefined,
formatted_body: undefined,
};
if (html) {
content.format = "org.matrix.custom.html";
content.formatted_body = "<b>Message</b>";
}
return cy.sendEvent(roomId, null, "m.room.message" as EventType, content);
};
describe("Timeline", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
let roomId: string;
@ -72,9 +75,9 @@ describe("Timeline", () => {
let newAvatarUrl: string;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.initTestUser(synapse, OLD_NAME).then(() =>
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, OLD_NAME).then(() =>
cy.createRoom({ name: ROOM_NAME }).then((_room1Id) => {
roomId = _room1Id;
}),
@ -83,7 +86,7 @@ describe("Timeline", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
describe("useOnlyCurrentProfiles", () => {
@ -314,12 +317,10 @@ describe("Timeline", () => {
},
}).as("preview_url");
cy.sendEvent(
roomId,
null,
"m.room.message" as EventType,
MessageEvent.from("https://call.element.io/").serialize().content,
);
cy.sendEvent(roomId, null, "m.room.message" as EventType, {
msgtype: "m.text" as MsgType,
body: "https://call.element.io/",
});
cy.visit("/#/room/" + roomId);
cy.get(".mx_LinkPreviewWidget").should("exist").should("contain.text", "Element Call");

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import Chainable = Cypress.Chainable;
function assertNoToasts(): void {
@ -40,10 +40,10 @@ function rejectToast(expectedTitle: string): void {
}
describe("Analytics Toast", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should not show an analytics toast if config has nothing about posthog", () => {
@ -55,9 +55,9 @@ describe("Analytics Toast", () => {
});
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.initTestUser(synapse, "Tod");
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, "Tod");
});
rejectToast("Notifications");
@ -78,9 +78,9 @@ describe("Analytics Toast", () => {
});
});
cy.startSynapse("default").then((data) => {
synapse = data;
cy.initTestUser(synapse, "Tod");
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, "Tod");
rejectToast("Notifications");
});
});

View file

@ -16,19 +16,19 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
describe("Update", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should navigate to ?updated=$VERSION if realises it is immediately out of date on load", () => {
@ -42,7 +42,7 @@ describe("Update", () => {
},
}).as("version");
cy.initTestUser(synapse, "Ursa");
cy.initTestUser(homeserver, "Ursa");
cy.wait("@version");
cy.url()

View file

@ -16,25 +16,25 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import type { UserCredentials } from "../../support/login";
describe("User Menu", () => {
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, "Jeff").then((credentials) => {
cy.initTestUser(homeserver, "Jeff").then((credentials) => {
user = credentials;
});
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should contain our name & userId", () => {

View file

@ -17,18 +17,18 @@ limitations under the License.
/// <reference types="cypress" />
import { MatrixClient } from "../../global";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
describe("User Onboarding (new user)", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
const bot1Name = "BotBob";
let bot1: MatrixClient;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.initTestUser(synapse, "Jane Doe");
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, "Jane Doe");
cy.window({ log: false }).then((win) => {
win.localStorage.setItem("mx_registration_time", "1656633601");
});
@ -36,7 +36,7 @@ describe("User Onboarding (new user)", () => {
// wait for the app to load
return cy.get(".mx_MatrixChat", { timeout: 15000 });
});
cy.getBot(synapse, { displayName: bot1Name }).then((_bot1) => {
cy.getBot(homeserver, { displayName: bot1Name }).then((_bot1) => {
bot1 = _bot1;
});
cy.get(".mx_UserOnboardingPage").should("exist");
@ -51,7 +51,7 @@ describe("User Onboarding (new user)", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("page is shown and preference exists", () => {

View file

@ -16,15 +16,15 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
describe("User Onboarding (old user)", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.initTestUser(synapse, "Jane Doe");
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, "Jane Doe");
cy.window({ log: false }).then((win) => {
win.localStorage.setItem("mx_registration_time", "2");
});
@ -37,7 +37,7 @@ describe("User Onboarding (old user)", () => {
afterEach(() => {
cy.visit("/#/home");
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("page and preference are hidden", () => {

View file

@ -16,23 +16,23 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { MatrixClient } from "../../global";
describe("UserView", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Violet");
cy.getBot(synapse, { displayName: "Usman" }).as("bot");
cy.initTestUser(homeserver, "Violet");
cy.getBot(homeserver, { displayName: "Usman" }).as("bot");
});
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
});
it("should render the user view as expected", () => {

View file

@ -17,7 +17,7 @@ limitations under the License.
import { IWidget } from "matrix-widget-api";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
const ROOM_NAME = "Test Room";
const WIDGET_ID = "fake-widget";
@ -34,14 +34,14 @@ const WIDGET_HTML = `
describe("Widget Layout", () => {
let widgetUrl: string;
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
let roomId: string;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Sally");
cy.initTestUser(homeserver, "Sally");
});
cy.serveHtmlFile(WIDGET_HTML).then((url) => {
widgetUrl = url;
@ -91,7 +91,7 @@ describe("Widget Layout", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
cy.stopWebServers();
});

View file

@ -16,7 +16,7 @@ limitations under the License.
/// <reference types="cypress" />
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
const STICKER_PICKER_WIDGET_ID = "fake-sticker-picker";
const STICKER_PICKER_WIDGET_NAME = "Fake Stickers";
@ -102,13 +102,13 @@ describe("Stickers", () => {
// See sendStickerFromPicker() for more detail on iframe comms.
let stickerPickerUrl: string;
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Sally");
cy.initTestUser(homeserver, "Sally");
});
cy.serveHtmlFile(WIDGET_HTML).then((url) => {
stickerPickerUrl = url;
@ -116,7 +116,7 @@ describe("Stickers", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
cy.stopWebServers();
});

View file

@ -20,7 +20,7 @@ limitations under the License.
import { IWidget } from "matrix-widget-api/src/interfaces/IWidget";
import type { MatrixClient, MatrixEvent } from "matrix-js-sdk/src/matrix";
import { SynapseInstance } from "../../plugins/synapsedocker";
import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { UserCredentials } from "../../support/login";
const DEMO_WIDGET_ID = "demo-widget-id";
@ -90,7 +90,7 @@ function waitForRoomWidget(win: Cypress.AUTWindow, widgetId: string, roomId: str
}
describe("Widget PIP", () => {
let synapse: SynapseInstance;
let homeserver: HomeserverInstance;
let user: UserCredentials;
let bot: MatrixClient;
let demoWidgetUrl: string;
@ -173,13 +173,13 @@ describe("Widget PIP", () => {
}
beforeEach(() => {
cy.startSynapse("default").then((data) => {
synapse = data;
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(synapse, "Mike").then((_user) => {
cy.initTestUser(homeserver, "Mike").then((_user) => {
user = _user;
});
cy.getBot(synapse, { displayName: "Bot", autoAcceptInvites: false }).then((_bot) => {
cy.getBot(homeserver, { displayName: "Bot", autoAcceptInvites: false }).then((_bot) => {
bot = _bot;
});
});
@ -189,7 +189,7 @@ describe("Widget PIP", () => {
});
afterEach(() => {
cy.stopSynapse(synapse);
cy.stopHomeserver(homeserver);
cy.stopWebServers();
});