-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from tchapgouv/111-remove-public-private-switch
111 - remove public/private rooms switch
- Loading branch information
Showing
8 changed files
with
558 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
cypress/e2e/room-access-settings/room-access-settings.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.