Skip to content

Commit

Permalink
Merge pull request #166 from tchapgouv/111-remove-public-private-switch
Browse files Browse the repository at this point in the history
111 -  remove public/private rooms switch
  • Loading branch information
odelcroi authored Sep 14, 2022
2 parents aeca139 + 6a23458 commit 51a5ba9
Show file tree
Hide file tree
Showing 8 changed files with 558 additions and 2 deletions.
3 changes: 2 additions & 1 deletion customisations.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"src/components/views/messages/OriginalImageBody.tsx": "node_modules/matrix-react-sdk/src/components/views/messages/MImageBody.tsx",
"src/components/views/messages/OriginalStickerBody.tsx": "node_modules/matrix-react-sdk/src/components/views/messages/MStickerBody.tsx",
"src/components/views/messages/OriginalVideoBody.tsx": "node_modules/matrix-react-sdk/src/components/views/messages/MVideoBody.tsx",
"src/components/views/messages/OriginalVoiceMessageBody.tsx": "node_modules/matrix-react-sdk/src/components/views/messages/MVoiceMessageBody.tsx"
"src/components/views/messages/OriginalVoiceMessageBody.tsx": "node_modules/matrix-react-sdk/src/components/views/messages/MVoiceMessageBody.tsx",
"src/components/views/settings/JoinRuleSettings.tsx": "src/components/views/settings/TchapJoinRuleSettings.tsx"
}
1 change: 1 addition & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ getVar('E2E_TEST_USER_HOMESERVER_URL');
getVar('E2E_TEST_USER_HOMESERVER_SHORT');

export default defineConfig({
watchForFileChanges : false,
videoUploadOnPasses: false,
projectId: 'ppvnzg',
experimentalInteractiveRunEvents: true,
Expand Down
68 changes: 68 additions & 0 deletions cypress/e2e/room-access-settings/room-access-settings.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/// <reference types="cypress" />

import RoomUtils from "../utils/room-utils";
import Chainable = Cypress.Chainable;



describe("Check room access settings", () => {
const homeserverUrl = Cypress.env('E2E_TEST_USER_HOMESERVER_URL');
const email = Cypress.env('E2E_TEST_USER_EMAIL');
const password = Cypress.env('E2E_TEST_USER_PASSWORD');
const homeserverShortname = Cypress.env('E2E_TEST_USER_HOMESERVER_SHORT');
const today = new Date().toISOString().slice(0, 10).replace(/-/g, '');

beforeEach(() => {
cy.loginUser(homeserverUrl, email, password);
});

afterEach(() => {
// todo delete room, otherwise the test user will end up with a million identical rooms after a while.
});

it("creates a public room and check access settings", () => {
const roomName = "test/"+today+"/public_room_check_access_settings";

RoomUtils.createPublicRoom(roomName);

openRoomAccessSettings();

//assert
cy.get('#joinRule-invite-description').should('not.exist');
cy.get('#joinRule-restricted-description').should('not.exist');
cy.get('#joinRule-public-description').should('exist');
});

it("creates a private room and check access settings", () => {
const roomName = "test/"+today+"/private_room_check_access_settings";

RoomUtils.createPrivateRoom(roomName);

openRoomAccessSettings();

//assert
cy.get('#joinRule-invite-description').should('exist');
cy.get('#joinRule-restricted-description').should('not.exist');
cy.get('#joinRule-public-description').should('not.exist');
});

it("creates a private room with external and check access settings", () => {
const roomName = "test/"+today+"/private_room_check_access_settings";

RoomUtils.createPrivateRoomWithExternal(roomName);

openRoomAccessSettings();

//assert
cy.get('#joinRule-invite-description').should('exist');
cy.get('#joinRule-restricted-description').should('not.exist');
cy.get('#joinRule-public-description').should('not.exist');
});
});


function openRoomAccessSettings(){
cy.get('.mx_RoomHeader_chevron').click();
cy.get('[aria-label="Paramètres"] > .mx_IconizedContextMenu_label').click();
cy.get('[data-testid="settings-tab-ROOM_SECURITY_TAB"] > .mx_TabbedView_tabLabel_text').click();
}
51 changes: 51 additions & 0 deletions cypress/e2e/utils/room-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import Chainable = Cypress.Chainable;

export default class RoomUtils {

static openCreateRoomDialog(): Chainable<JQuery<HTMLElement>> {
const addRoomLabel = "Ajouter un salon";
const newRoomLabel = "Nouveau salon";
cy.get(`[aria-label="${addRoomLabel}"]`).click();
cy.get(`.mx_ContextualMenu [aria-label="${newRoomLabel}"]`).click();
return cy.get(".mx_Dialog");
}


static createPrivateRoom(roomName: string) {
RoomUtils.openCreateRoomDialog().within(() => {
// Fill name
const nameLabel = "Nom";
cy.get(`[label="${nameLabel}"]`).type(roomName);
// Submit
cy.startMeasuring("from-submit-to-room");
cy.get(".mx_Dialog_primary").click();
});
}

static createPublicRoom(roomName: string) {
RoomUtils.openCreateRoomDialog().within(() => {
// Fill name
const nameLabel = "Nom";
cy.get(`[label="${nameLabel}"]`).type(roomName);
// Change room to public
cy.get(".tc_TchapRoomTypeSelector_forum").click();
// Submit
cy.startMeasuring("from-submit-to-room");
cy.get(".mx_Dialog_primary").click();
});
}

static createPrivateRoomWithExternal(roomName: string) {
RoomUtils.openCreateRoomDialog().within(() => {
// Fill name
const nameLabel = "Nom";
cy.get(`[label="${nameLabel}"]`).type(roomName);
// Change room to public
cy.get(".tc_TchapRoomTypeSelector_external").click();
// Submit
cy.startMeasuring("from-submit-to-room");
cy.get(".mx_Dialog_primary").click();
});
}
}

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@
"FontManager.ts": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/FontManager.js",
"workers/(.+)\\.worker\\.ts": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/workerMock.js",
"^!!raw-loader!.*": "jest-raw-loader",
"RecorderWorklet": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/empty.js"
"RecorderWorklet": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/empty.js",
"MImageBody": "<rootDir>/src/customisations/components/views/messages/ContentScanningImageBody.tsx",
"../../../../../../src/components/views/messages/OriginalFileBody": "<rootDir>/node_modules/matrix-react-sdk/src/components/views/messages/MImageBody.tsx",
"MAudioBody": "<rootDir>/src/customisations/components/views/messages/ContentScanningAudioBody.tsx",
"../../../../../../src/components/views/messages/OriginalAudioBody": "<rootDir>/node_modules/matrix-react-sdk/src/components/views/messages/MAudioBody.tsx",
"MStickerBody": "<rootDir>/src/customisations/components/views/messages/ContentScanningStickerBody.tsx"
},
"transformIgnorePatterns": [
"\/node_modules\/(?!matrix-js-sdk|matrix-react-sdk).+$"
Expand Down
Loading

0 comments on commit 51a5ba9

Please sign in to comment.