"Fossies" - the Fresh Open Source Software Archive 
Member "Rocket.Chat-4.7.1/apps/meteor/tests/e2e/11-admin.spec.ts" (13 May 2022, 19673 Bytes) of package /linux/www/Rocket.Chat-4.7.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 import { test, expect } from '@playwright/test';
2
3 import LoginPage from './utils/pageobjects/LoginPage';
4 import SideNav from './utils/pageobjects/SideNav';
5 import { adminLogin, ROCKET_CAT } from './utils/mocks/userAndPasswordMock';
6 import Administration from './utils/pageobjects/Administration';
7 import FlexTab from './utils/pageobjects/FlexTab';
8 import { ROCKET_CAT_SELECTOR } from './utils/mocks/waitSelectorsMock';
9 import { Checkbox } from './utils/enums/Checkbox';
10
11 test.describe('[Administration]', () => {
12 let loginPage: LoginPage;
13 let sideNav: SideNav;
14 let admin: Administration;
15 let flexTab: FlexTab;
16 const checkBoxesSelectors = ['Direct', 'Public', 'Private', 'Omnichannel', 'Discussions', 'Teams'];
17 test.beforeAll(async ({ browser, baseURL }) => {
18 const context = await browser.newContext();
19 const page = await context.newPage();
20 loginPage = new LoginPage(page);
21 sideNav = new SideNav(page);
22 flexTab = new FlexTab(page);
23 admin = new Administration(page);
24 await loginPage.goto(baseURL as string);
25 await loginPage.login(adminLogin);
26 });
27 test.describe('[Admin View]', () => {
28 test.beforeAll(async () => {
29 await sideNav.sidebarUserMenu().click();
30 await sideNav.admin().click();
31 });
32
33 test.describe('[Info]', () => {
34 test('expect admin page is showed', async () => {
35 await admin.infoLink().click();
36 await expect(admin.infoDeployment()).toBeVisible();
37 await expect(admin.infoLicense()).toBeVisible();
38 await expect(admin.infoUsage()).toBeVisible();
39 await expect(admin.infoFederation()).toBeVisible();
40 });
41 });
42
43 test.describe('[Rooms]', () => {
44 test.beforeAll(async () => {
45 await admin.roomsLink().click();
46 });
47
48 test.afterAll(async () => {
49 await admin.infoLink().click();
50 });
51
52 test.describe('[Render]', () => {
53 test('expect rom page is rendered is rendered', async () => {
54 await admin.verifyCheckBoxRendered(checkBoxesSelectors);
55 await expect(admin.roomsSearchForm()).toBeVisible();
56 });
57 });
58
59 test.describe('[Filter search input]', () => {
60 test.beforeAll(async () => {
61 await admin.roomsSearchForm().click();
62 });
63
64 test.afterAll(async () => {
65 await admin.roomsSearchForm().click({ clickCount: 3 });
66 await admin.keyboardPress('Backspace');
67 });
68
69 test('expect show the general channel', async () => {
70 await admin.roomsSearchForm().type('general');
71 await expect(admin.roomsGeneralChannel()).toBeVisible();
72 });
73
74 test('expect dont show rooms when room dont exist', async () => {
75 await admin.roomsSearchForm().type('any_room');
76 await expect(admin.notFoundChannelOrUser()).toBeVisible();
77 });
78 });
79 test.describe('[Filter checkbox]', () => {
80 test.beforeAll(async () => {
81 await admin.roomsSearchForm().click({ clickCount: 3 });
82 await admin.keyboardPress('Backspace');
83 });
84
85 test('expect not show the general channel with direct', async () => {
86 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Direct]).click();
87 await admin.roomsGeneralChannel().waitFor({ state: 'detached' });
88 await expect(admin.roomsGeneralChannel()).not.toBeVisible();
89 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Direct]).click();
90 });
91
92 test('expect show the general channel with public ', async () => {
93 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Public]).click();
94 await admin.roomsGeneralChannel().waitFor({ state: 'visible' });
95 await expect(admin.roomsGeneralChannel()).toBeVisible();
96 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Public]).click();
97 });
98
99 test('expect not show the general channel with private ', async () => {
100 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Private]).click();
101 await admin.roomsGeneralChannel().waitFor({ state: 'detached' });
102 await expect(admin.roomsGeneralChannel()).not.toBeVisible();
103 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Private]).click();
104 });
105
106 test('expect not show the general channel with omnichannel', async () => {
107 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Omnichannel]).click();
108 await admin.roomsGeneralChannel().waitFor({ state: 'detached' });
109 await expect(admin.roomsGeneralChannel()).not.toBeVisible();
110 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Omnichannel]).click();
111 });
112 test('expect not show the general channel with discussion', async () => {
113 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Discussions]).click();
114 await admin.roomsGeneralChannel().waitFor({ state: 'detached' });
115 await expect(admin.roomsGeneralChannel()).not.toBeVisible();
116 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Discussions]).click();
117 });
118 test('expect not show the general channel with teams', async () => {
119 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Teams]).click();
120 await admin.roomsGeneralChannel().waitFor({ state: 'detached' });
121 await expect(admin.roomsGeneralChannel()).not.toBeVisible();
122 await admin.adminCheckBox(checkBoxesSelectors[Checkbox.Teams]).click();
123 });
124 });
125 test.describe('[Users]', () => {
126 test.beforeAll(async () => {
127 await admin.usersLink().click();
128 });
129
130 test.afterAll(async () => {
131 await admin.infoLink().click();
132 });
133
134 test.describe('[Filter text]', async () => {
135 test.beforeEach(async () => {
136 await admin.usersFilter().click();
137 });
138
139 test.afterAll(async () => {
140 await admin.usersFilter().click();
141 await admin.usersFilter().type('');
142 });
143
144 test('expect should show rocket.cat', async () => {
145 await admin.usersFilter().type(ROCKET_CAT);
146 await admin.waitForSelector(ROCKET_CAT_SELECTOR);
147 });
148 test('expect dont user when write wrong name', async () => {
149 await admin.usersFilter().type('any_user_wrong');
150 await expect(admin.notFoundChannelOrUser()).toBeVisible();
151 });
152 });
153
154 test.describe('[Create user]', () => {
155 test.beforeAll(async () => {
156 await flexTab.usersAddUserTab().click();
157 });
158
159 test('expect tab user add is rendering', async () => {
160 await expect(flexTab.usersAddUserName()).toBeVisible();
161 await expect(flexTab.usersAddUserUsername()).toBeVisible();
162 await expect(flexTab.usersAddUserEmail()).toBeVisible();
163 await expect(flexTab.usersAddUserVerifiedCheckbox()).toBeVisible();
164 await expect(flexTab.usersAddUserPassword()).toBeVisible();
165 await expect(flexTab.usersAddUserRandomPassword()).toBeVisible();
166 await expect(flexTab.usersAddUserChangePasswordCheckbox()).toBeVisible();
167 await expect(flexTab.usersAddUserRoleList()).toBeVisible();
168 await expect(flexTab.usersAddUserDefaultChannelCheckbox()).toBeVisible();
169 await expect(flexTab.usersAddUserWelcomeEmailCheckbox()).toBeVisible();
170 await expect(flexTab.usersButtonSave()).toBeVisible();
171 await expect(flexTab.usersButtonCancel()).toBeVisible();
172
173 await flexTab.usersAddUserTabClose().waitFor();
174 await flexTab.usersAddUserTabClose().click();
175
176 await expect(flexTab.addUserTable()).not.toBeVisible();
177 });
178 });
179 });
180 });
181
182 // TODO verify how is make o invite
183 // describe('[Flex Tab] ', () => {
184 // describe('send invitation:', () => {
185 // before(() => {
186 // flexTab.usersSendInvitationTab.waitForVisible(5000);
187 // flexTab.usersSendInvitationTab.click();
188 // flexTab.usersSendInvitationTextArea.waitForVisible(5000);
189 // });
190
191 // after(() => {
192 // flexTab.usersSendInvitationTab.waitForVisible(5000);
193 // flexTab.usersSendInvitationTab.click();
194 // flexTab.usersSendInvitationTextArea.waitForVisible(5000, true);
195 // });
196
197 // test('it should show the send invitation text area', () => {
198 // flexTab.usersSendInvitationTextArea.should('be.visible');
199 // });
200
201 // it('it should show the cancel button', () => {
202 // flexTab.usersButtonCancel.should('be.visible');
203 // });
204
205 // it('it should show the send button', () => {
206 // flexTab.usersSendInvitationSend.should('be.visible');
207 // });
208 // });
209
210 test.describe('[General Settings]', () => {
211 test.beforeAll(async () => {
212 await admin.settingsSearch().type('general');
213 await admin.generalLink().click();
214 await admin.settingsSearch().click({ clickCount: 3 });
215 await admin.keyboardPress('Backspace');
216 });
217
218 test.describe('[General]', () => {
219 test('expect change site url reset button is showed', async () => {
220 await admin.generalSiteUrl().type('something');
221 await expect(admin.generalSiteUrlReset()).toBeVisible();
222 });
223
224 test('expect change site name reset button is showed', async () => {
225 await admin.generalSiteName().type('something');
226 await expect(admin.generalSiteNameReset()).toBeVisible();
227 });
228
229 test('expect show language field', async () => {
230 await expect(admin.generalLanguage()).toBeVisible();
231 });
232
233 test('expect aloow invalid self-signed certs reset button is showed', async () => {
234 await admin.generalSelfSignedCerts().click();
235 await expect(admin.generalSelfSignedCertsReset()).toBeVisible();
236 await admin.generalSelfSignedCerts().click();
237 await expect(admin.generalSelfSignedCertsReset()).not.toBeVisible();
238 });
239
240 test('expect reset enable favorite room is showed', async () => {
241 await admin.generalFavoriteRoom().click();
242 await expect(admin.generalFavoriteRoomReset()).toBeVisible();
243 await admin.generalFavoriteRoomReset().click();
244 await expect(admin.generalFavoriteRoomReset()).not.toBeVisible();
245 });
246
247 test('expect CDN prefix reset not show after reset', async () => {
248 await admin.generalCdnPrefix().type('something');
249 await expect(admin.generalCdnPrefixReset()).toBeVisible();
250 await admin.generalCdnPrefixReset().click();
251 await expect(admin.generalCdnPrefixReset()).not.toBeVisible();
252 });
253
254 test('expect SSL reset not showing after reset', async () => {
255 await admin.generalForceSSL().click();
256 await expect(admin.generalForceSSLReset()).toBeVisible();
257 await admin.generalForceSSLReset().click();
258 await expect(admin.generalForceSSLReset()).not.toBeVisible();
259 });
260
261 test('expect google tag reset is not visible after reset', async () => {
262 await admin.generalGoogleTagId().type('something');
263 await expect(admin.generalGoogleTagIdReset()).toBeVisible();
264 await admin.generalGoogleTagIdReset().click();
265 await expect(admin.generalGoogleTagIdReset()).not.toBeVisible();
266 });
267
268 test('expect when change bugsnag API Key dont show reset button after reset', async () => {
269 await admin.generalBugsnagKey().type('something');
270 await expect(admin.generalBugsnagKeyReset()).toBeVisible();
271 await admin.generalBugsnagKeyReset().click();
272 await expect(admin.generalBugsnagKeyReset()).not.toBeVisible();
273 });
274 test('expect when change Robots dont show reset button after reset', async () => {
275 await admin.robotsFileContents().type('aa');
276 await expect(admin.robotsFileContentsReset()).toBeVisible();
277 await admin.robotsFileContentsReset().click();
278 await expect(admin.robotsFileContentsReset()).not.toBeVisible();
279 });
280 test('expect when change Default Referrer Policy dont show reset button after reset', async () => {
281 await admin.defaultReferrerPolicy().click();
282 await admin.defaultReferrerPolicyOptions().click();
283 await expect(admin.defaultReferrerPolicyReset()).toBeVisible();
284 await admin.defaultReferrerPolicyReset().click();
285 await expect(admin.defaultReferrerPolicyReset()).not.toBeVisible();
286 });
287 });
288
289 test.describe('[Iframe]', () => {
290 test.beforeAll(async () => {
291 await admin.generalSectionIframeIntegration().click();
292 });
293
294 test('expect iframe integration is rendering', async () => {
295 await expect(admin.generalIframeSend()).toBeVisible();
296 await expect(admin.generalIframeSendTargetOrigin()).toBeVisible();
297 await expect(admin.generalIframeReceive()).toBeVisible();
298 await expect(admin.generalIframeReceiveOrigin()).toBeVisible();
299 });
300 });
301
302 test.describe('[Notifications]', () => {
303 test.beforeAll(async () => {
304 await admin.generalSectionNotifications().click();
305 });
306
307 test('expect the max room members field', async () => {
308 await expect(admin.generalNotificationsMaxRoomMembers()).toBeVisible();
309 });
310 });
311
312 test.describe('[Rest api]', async () => {
313 test.beforeAll(async () => {
314 await admin.generalSectionRestApi().click();
315 });
316
317 test('expect show the API user add limit field', async () => {
318 await expect(admin.generalRestApiUserLimit()).toBeVisible();
319 });
320 });
321
322 test.describe('[Reporting]', async () => {
323 test.beforeAll(async () => {
324 await admin.generalSectionReporting().click();
325 });
326
327 test('expect show the report to rocket.chat toggle', async () => {
328 await expect(admin.generalReporting()).toBeVisible();
329 });
330 });
331
332 test.describe('[Stream cast]', async () => {
333 test.beforeAll(async () => {
334 await admin.generalSectionStreamCast().click();
335 });
336
337 test('expect show the stream cast address field', async () => {
338 await expect(admin.generalStreamCastAddress()).toBeVisible();
339 });
340 });
341
342 test.describe('UTF-8', () => {
343 test.beforeAll(async () => {
344 await admin.generalSectionUTF8().click();
345 });
346
347 test('expect show the usernames utf8 regex field', async () => {
348 await expect(admin.generalUTF8UsernamesRegex()).toBeVisible();
349 });
350
351 test('expect show the channels utf8 regex field', async () => {
352 await expect(admin.generalUTF8ChannelsRegex()).toBeVisible();
353 });
354
355 test('expect show the utf8 names slug checkboxes', async () => {
356 await expect(admin.generalUTF8NamesSlug()).toBeVisible();
357 });
358 });
359 });
360
361 test.describe('[Accounts]', () => {
362 test.beforeAll(async () => {
363 await admin.settingsSearch().type('accounts');
364 await admin.accountsLink().click();
365 await admin.settingsSearch().click({ clickCount: 3 });
366 await admin.keyboardPress('Backspace');
367 });
368
369 test.describe('[Default user preferences]', () => {
370 test.beforeAll(async () => {
371 await admin.accountsSectionDefaultUserPreferences().click();
372 });
373
374 test('expect show the enable auto away field', async () => {
375 await expect(admin.accountsEnableAutoAway()).toBeVisible();
376 });
377
378 test('the enable auto away field value should be true', async () => {
379 await admin.accountsEnableAutoAway().check();
380 });
381
382 test('expect show the idle timeout limit field', async () => {
383 await expect(admin.accountsIdleTimeLimit()).toBeVisible();
384 const inputValue = await admin.accountsIdleTimeLimit().inputValue();
385 expect(inputValue).toEqual('300');
386 });
387
388 test('expect show desktop audio notifications to be visible', async () => {
389 await expect(admin.accountsDesktopNotifications()).toBeVisible();
390 await expect(admin.accountsDesktopNotifications().locator('.rcx-select__item')).toHaveText('All messages');
391 });
392
393 test('expect show mobile notifications to be visible and option have value', async () => {
394 await expect(admin.accountsMobileNotifications()).toBeVisible();
395 await expect(admin.accountsMobileNotifications().locator('.rcx-select__item')).toHaveText('All messages');
396 });
397
398 test('expect show the unread tray icon and icon alert field is true', async () => {
399 await expect(admin.accountsUnreadAlert()).toBeVisible();
400 await expect(admin.accountsUnreadAlert().locator('input')).toBeChecked();
401 });
402
403 test('expect show the convert ascii and check is true', async () => {
404 await expect(admin.accountsConvertAsciiEmoji().locator('input')).toBeVisible();
405 await expect(admin.accountsConvertAsciiEmoji().locator('input')).toBeChecked();
406 });
407
408 test('expect show message is visible and check is true', async () => {
409 await expect(admin.accountsAutoImageLoad()).toBeVisible();
410 await expect(admin.accountsAutoImageLoad().locator('input')).toBeChecked();
411 });
412
413 test('expect show image is visible and check is true', async () => {
414 await expect(admin.accountsAutoImageLoad()).toBeVisible();
415 await expect(admin.accountsAutoImageLoad().locator('input')).toBeChecked();
416 });
417
418 test('expect account mobile bandwidth is showed ans check is true', async () => {
419 await expect(admin.accountsSaveMobileBandwidth()).toBeVisible();
420 await expect(admin.accountsSaveMobileBandwidth().locator('input')).toBeVisible();
421 });
422
423 test('expect show the collapse embedded media by default field and not be checked', async () => {
424 await expect(admin.accountsCollapseMediaByDefault()).toBeVisible();
425 await expect(admin.accountsCollapseMediaByDefault()).not.toBeChecked();
426 });
427
428 test('expect show the hide usernames field', async () => {
429 await expect(admin.accountsHideUsernames()).toBeVisible();
430 await expect(admin.accountsHideUsernames()).not.toBeChecked();
431 });
432
433 test('expect show admin hide roles and verify if checked', async () => {
434 await expect(admin.accountsHideRoles()).toBeVisible();
435 await expect(admin.accountsHideRoles()).not.toBeChecked();
436 });
437
438 test('expect show the hide right sidebar with click field and not checked', async () => {
439 await expect(admin.accountsHideFlexTab()).toBeVisible();
440 await expect(admin.accountsHideFlexTab().locator('input')).not.toBeChecked();
441 });
442
443 test('expect show display avatars and is checked', async () => {
444 await expect(admin.accountsDisplayAvatars().locator('input')).toBeVisible();
445 await expect(admin.accountsDisplayAvatars().locator('input')).toBeChecked();
446 });
447
448 test('expect show the enter key behavior field', async () => {
449 await expect(admin.accountsSendOnEnter()).toBeVisible();
450
451 await expect(admin.accountsSendOnEnter().locator('.rcx-select__item')).toHaveText('Normal mode (send with Enter)');
452 });
453
454 test('the view mode field value should be ""', async () => {
455 await expect(admin.accountsMessageViewMode()).toHaveText('');
456 });
457
458 test('expect show the offline email notification field and field value to be all', async () => {
459 await expect(admin.accountsEmailNotificationMode()).toBeVisible();
460 });
461
462 test('expect the offline email notification field value should be all', async () => {
463 await expect(admin.accountsEmailNotificationMode().locator('.rcx-select__item')).toHaveText('Every Mention/DM');
464 });
465
466 test('expect show the new room notification field', async () => {
467 await expect(admin.accountsNewRoomNotification()).toBeVisible();
468 });
469
470 test('expect the new room notification field value should be door', async () => {
471 await expect(admin.accountsNewRoomNotification().locator('.rcx-select__item')).toHaveText('Default');
472 });
473
474 test('expect show the new message notification field', async () => {
475 await expect(admin.accountsNewMessageNotification()).toBeVisible();
476 });
477
478 test('expect the new message notification field value should be chime', async () => {
479 await expect(admin.accountsNewMessageNotification().locator('.rcx-select__item')).toHaveText('Default');
480 });
481
482 test('expect show the notification sound volume field', async () => {
483 await expect(admin.accountsNotificationsSoundVolume()).toBeVisible();
484 });
485
486 test('the notification sound volume field value should be 100', async () => {
487 await expect(admin.accountsNotificationsSoundVolume()).toHaveValue('100');
488 });
489 });
490 });
491 });
492 });