1
1
/// <reference types="cypress" />
2
2
3
3
import RoomUtils from "../utils/room-utils" ;
4
- import Chainable = Cypress . Chainable ;
5
-
6
-
7
4
8
5
describe ( "Check room access settings" , ( ) => {
9
6
const homeserverUrl = Cypress . env ( 'E2E_TEST_USER_HOMESERVER_URL' ) ;
10
7
const email = Cypress . env ( 'E2E_TEST_USER_EMAIL' ) ;
11
8
const password = Cypress . env ( 'E2E_TEST_USER_PASSWORD' ) ;
12
- const homeserverShortname = Cypress . env ( 'E2E_TEST_USER_HOMESERVER_SHORT' ) ;
13
9
const today = new Date ( ) . toISOString ( ) . slice ( 0 , 10 ) . replace ( / - / g, '' ) ;
14
10
15
11
beforeEach ( ( ) => {
@@ -21,48 +17,73 @@ describe("Check room access settings", () => {
21
17
} ) ;
22
18
23
19
it ( "creates a public room and check access settings" , ( ) => {
24
- const roomName = "test/" + today + "/public_room_check_access_settings" ;
20
+ const roomName = "test/" + today + "/public_room_check_access_settings" ;
21
+
22
+ RoomUtils . createPublicRoom ( roomName )
23
+ . then ( ( roomId ) => {
24
+ RoomUtils . openRoomAccessSettings ( roomName ) ;
25
+
26
+ //assert
27
+ cy . get ( '#joinRule-invite-description' ) . should ( 'not.exist' ) ;
28
+ cy . get ( '#joinRule-restricted-description' ) . should ( 'not.exist' ) ;
29
+ cy . get ( '#joinRule-public-description' ) . should ( 'exist' ) ;
25
30
26
- RoomUtils . createPublicRoom ( roomName ) ;
31
+ //encryption switch should be off and disabled
32
+ cy . contains ( ".mx_SettingsFlag" , / ^ C h i f f r é $ / ) . within ( ( ) => {
33
+ cy . get ( '.mx_AccessibleButton' ) . should ( 'have.attr' , 'aria-checked' , 'false' ) ;
34
+ cy . get ( '.mx_AccessibleButton' ) . should ( 'have.attr' , 'aria-disabled' , 'true' ) ;
35
+ } ) ;
27
36
28
- openRoomAccessSettings ( ) ;
37
+ //should not show more settings, nor invite guests
38
+ cy . contains ( '.mx_SettingsTab_section' , / ^ A f f i c h e r l e s p a r a m è t r e s a v a n c é s $ / ) . should ( 'not.exist' ) ;
39
+ cy . contains ( '.mx_SettingsFlag' , / ^ A c t i v e r l ’ a c c è s v i s i t e u r $ / ) . should ( 'not.exist' ) ;
29
40
30
- //assert
31
- cy . get ( '#joinRule-invite-description' ) . should ( 'not.exist' ) ;
32
- cy . get ( '#joinRule-restricted-description' ) . should ( 'not.exist' ) ;
33
- cy . get ( '#joinRule-public-description' ) . should ( 'exist' ) ;
41
+ cy . leaveRoom ( roomId ) ;
42
+ } ) ;
34
43
} ) ;
35
44
36
45
it ( "creates a private room and check access settings" , ( ) => {
37
- const roomName = "test/" + today + "/private_room_check_access_settings" ;
46
+ const roomName = "test/" + today + "/private_room_check_access_settings" ;
38
47
39
- RoomUtils . createPrivateRoom ( roomName ) ;
48
+ RoomUtils . createPrivateRoom ( roomName )
49
+ . then ( ( roomId ) => {
50
+ RoomUtils . openRoomAccessSettings ( roomName ) ;
40
51
41
- openRoomAccessSettings ( ) ;
52
+ //assert
53
+ cy . get ( '#joinRule-invite-description' ) . should ( 'exist' ) ;
54
+ cy . get ( '#joinRule-restricted-description' ) . should ( 'not.exist' ) ;
55
+ cy . get ( '#joinRule-public-description' ) . should ( 'not.exist' ) ;
42
56
43
- //assert
44
- cy . get ( '#joinRule-invite-description' ) . should ( 'exist' ) ;
45
- cy . get ( '#joinRule-restricted-description' ) . should ( 'not.exist' ) ;
46
- cy . get ( '#joinRule-public-description' ) . should ( 'not.exist' ) ;
57
+ //encryption switch should be on
58
+ cy . contains ( ".mx_SettingsFlag" , / ^ C h i f f r é $ / ) . within ( ( ) => {
59
+ cy . get ( '.mx_AccessibleButton' ) . should ( 'have.attr' , 'aria-checked' , 'true' ) ;
60
+ cy . get ( '.mx_AccessibleButton' ) . should ( 'have.attr' , 'aria-disabled' , 'true' ) ;
61
+ } ) ;
62
+
63
+ cy . leaveRoom ( roomId ) ;
64
+ } ) ;
47
65
} ) ;
48
66
49
67
it ( "creates a private room with external and check access settings" , ( ) => {
50
- const roomName = "test/" + today + "/private_room_check_access_settings" ;
68
+ const roomName = "test/" + today + "/external_room_check_access_settings" ;
69
+
70
+ RoomUtils . createPrivateWithExternalRoom ( roomName )
71
+ . then ( ( roomId ) => {
72
+ RoomUtils . openRoomAccessSettings ( roomName ) ;
51
73
52
- RoomUtils . createPrivateRoomWithExternal ( roomName ) ;
74
+ //assert
75
+ cy . get ( '#joinRule-invite-description' ) . should ( 'exist' ) ;
76
+ cy . get ( '#joinRule-restricted-description' ) . should ( 'not.exist' ) ;
77
+ cy . get ( '#joinRule-public-description' ) . should ( 'not.exist' ) ;
53
78
54
- openRoomAccessSettings ( ) ;
79
+ //encryption switch should be on
80
+ cy . contains ( ".mx_SettingsFlag" , / ^ C h i f f r é $ / ) . within ( ( ) => {
81
+ cy . get ( '.mx_AccessibleButton' ) . should ( 'have.attr' , 'aria-checked' , 'true' ) ;
82
+ cy . get ( '.mx_AccessibleButton' ) . should ( 'have.attr' , 'aria-disabled' , 'true' ) ;
83
+ } ) ;
55
84
56
- //assert
57
- cy . get ( '#joinRule-invite-description' ) . should ( 'exist' ) ;
58
- cy . get ( '#joinRule-restricted-description' ) . should ( 'not.exist' ) ;
59
- cy . get ( '#joinRule-public-description' ) . should ( 'not.exist' ) ;
85
+ cy . leaveRoom ( roomId ) ;
86
+ } ) ;
60
87
} ) ;
61
88
} ) ;
62
89
63
-
64
- function openRoomAccessSettings ( ) {
65
- cy . get ( '.mx_RoomHeader_chevron' ) . click ( ) ;
66
- cy . get ( '[aria-label="Paramètres"] > .mx_IconizedContextMenu_label' ) . click ( ) ;
67
- cy . get ( '[data-testid="settings-tab-ROOM_SECURITY_TAB"] > .mx_TabbedView_tabLabel_text' ) . click ( ) ;
68
- }
0 commit comments