@mattermost/playwright-lib 10.6.1 → 10.7.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser_context.js +14 -21
- package/dist/constant.js +3 -6
- package/dist/file.js +20 -20
- package/dist/flag.d.ts +2 -0
- package/dist/flag.js +49 -38
- package/dist/flag.js.map +1 -1
- package/dist/global_setup.d.ts +0 -2
- package/dist/global_setup.js +14 -71
- package/dist/global_setup.js.map +1 -1
- package/dist/index.js +9 -42
- package/dist/mock_browser_api.js +2 -8
- package/dist/server/channel.js +3 -9
- package/dist/server/client.js +10 -16
- package/dist/server/default_config.js +18 -17
- package/dist/server/default_config.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +10 -0
- package/dist/server/init.js +29 -36
- package/dist/server/plugins.d.ts +2 -0
- package/dist/server/plugins.js +30 -0
- package/dist/server/plugins.js.map +1 -0
- package/dist/server/post.js +3 -9
- package/dist/server/team.js +3 -9
- package/dist/server/user.js +8 -15
- package/dist/test_action.js +3 -14
- package/dist/test_config.js +4 -30
- package/dist/test_fixture.d.ts +4 -2
- package/dist/test_fixture.js +51 -66
- package/dist/test_fixture.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.js +3 -0
- package/dist/ui/components/channels/app_bar.js +3 -9
- package/dist/ui/components/channels/center_view.js +22 -28
- package/dist/ui/components/channels/delete_post_confirmation_dialog.js +8 -14
- package/dist/ui/components/channels/delete_post_modal.js +4 -10
- package/dist/ui/components/channels/emoji_gif_picker.js +9 -15
- package/dist/ui/components/channels/find_channels_modal.js +3 -9
- package/dist/ui/components/channels/generic_confirm_modal.js +5 -11
- package/dist/ui/components/channels/header.js +3 -9
- package/dist/ui/components/channels/message_priority.js +14 -20
- package/dist/ui/components/channels/post.js +10 -16
- package/dist/ui/components/channels/post_create.js +23 -29
- package/dist/ui/components/channels/post_dot_menu.js +3 -9
- package/dist/ui/components/channels/post_edit.js +16 -22
- package/dist/ui/components/channels/post_menu.js +3 -9
- package/dist/ui/components/channels/post_reminder_menu.js +3 -9
- package/dist/ui/components/channels/restore_post_confirmation_dialog.js +6 -12
- package/dist/ui/components/channels/scheduled_draft_menu.js +3 -9
- package/dist/ui/components/channels/scheduled_draft_modal.js +4 -10
- package/dist/ui/components/channels/search_popover.js +3 -9
- package/dist/ui/components/channels/settings/notification_settings.js +8 -14
- package/dist/ui/components/channels/settings/settings_modal.js +7 -13
- package/dist/ui/components/channels/sidebar_left.js +8 -14
- package/dist/ui/components/channels/sidebar_right.js +20 -26
- package/dist/ui/components/channels/thread_footer.js +3 -9
- package/dist/ui/components/channels/user_profile_popover.js +3 -9
- package/dist/ui/components/footer.js +3 -9
- package/dist/ui/components/global_header.d.ts +1 -0
- package/dist/ui/components/global_header.js +9 -13
- package/dist/ui/components/global_header.js.map +1 -1
- package/dist/ui/components/index.js +72 -74
- package/dist/ui/components/main_header.js +3 -9
- package/dist/ui/components/system_console/navbar.js +3 -9
- package/dist/ui/components/system_console/sections/system_users/column_toggle_menu.js +4 -10
- package/dist/ui/components/system_console/sections/system_users/feature_discovery.js +4 -10
- package/dist/ui/components/system_console/sections/system_users/filter_menu.js +3 -9
- package/dist/ui/components/system_console/sections/system_users/filter_popover.js +8 -14
- package/dist/ui/components/system_console/sections/system_users/mobile_security.js +3 -9
- package/dist/ui/components/system_console/sections/system_users/system_users.js +10 -16
- package/dist/ui/components/system_console/sidebar.js +4 -10
- package/dist/ui/pages/channels.js +18 -24
- package/dist/ui/pages/drafts.js +17 -23
- package/dist/ui/pages/index.js +17 -30
- package/dist/ui/pages/landing_login.js +5 -11
- package/dist/ui/pages/login.js +8 -14
- package/dist/ui/pages/reset_password.js +9 -15
- package/dist/ui/pages/scheduled_draft.js +19 -25
- package/dist/ui/pages/signup.js +11 -17
- package/dist/ui/pages/system_console.js +16 -22
- package/dist/util.js +8 -19
- package/dist/visual/index.js +14 -20
- package/dist/visual/percy.js +4 -10
- package/package.json +1 -1
package/dist/ui/pages/signup.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('@playwright/test');
|
|
4
|
-
var util = require('../../util.js');
|
|
5
|
-
var index = require('../components/index.js');
|
|
6
|
-
|
|
7
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
8
2
|
// See LICENSE.txt for license information.
|
|
9
|
-
|
|
3
|
+
import { expect } from '@playwright/test';
|
|
4
|
+
import { duration, wait } from '@/util';
|
|
5
|
+
import { components } from '@/ui/components';
|
|
6
|
+
export default class SignupPage {
|
|
10
7
|
page;
|
|
11
8
|
title;
|
|
12
9
|
subtitle;
|
|
@@ -48,17 +45,17 @@ class SignupPage {
|
|
|
48
45
|
const agreementBlock = page.locator('.signup-body-card-agreement');
|
|
49
46
|
this.agreementTermsOfUseLink = agreementBlock.locator('text=Terms of Use');
|
|
50
47
|
this.agreementPrivacyPolicyLink = agreementBlock.locator('text=Privacy Policy');
|
|
51
|
-
this.header = new
|
|
52
|
-
this.footer = new
|
|
48
|
+
this.header = new components.MainHeader(page.locator('.hfroute-header'));
|
|
49
|
+
this.footer = new components.Footer(page.locator('.hfroute-footer'));
|
|
53
50
|
}
|
|
54
51
|
async toBeVisible() {
|
|
55
52
|
await this.page.waitForLoadState('networkidle');
|
|
56
53
|
await this.page.waitForLoadState('domcontentloaded');
|
|
57
|
-
await
|
|
58
|
-
await
|
|
59
|
-
await
|
|
60
|
-
await
|
|
61
|
-
await
|
|
54
|
+
await wait(duration.half_sec);
|
|
55
|
+
await expect(this.title).toBeVisible();
|
|
56
|
+
await expect(this.emailInput).toBeVisible();
|
|
57
|
+
await expect(this.usernameInput).toBeVisible();
|
|
58
|
+
await expect(this.passwordInput).toBeVisible();
|
|
62
59
|
}
|
|
63
60
|
async goto() {
|
|
64
61
|
await this.page.goto('/signup_user_complete');
|
|
@@ -73,6 +70,3 @@ class SignupPage {
|
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
|
-
|
|
77
|
-
module.exports = SignupPage;
|
|
78
|
-
//# sourceMappingURL=signup.js.map
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('../components/index.js');
|
|
4
|
-
|
|
5
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
6
2
|
// See LICENSE.txt for license information.
|
|
7
|
-
|
|
3
|
+
import { components } from '@/ui/components';
|
|
4
|
+
export default class SystemConsolePage {
|
|
8
5
|
page;
|
|
9
6
|
sidebar;
|
|
10
7
|
navbar;
|
|
@@ -27,22 +24,22 @@ class SystemConsolePage {
|
|
|
27
24
|
constructor(page) {
|
|
28
25
|
this.page = page;
|
|
29
26
|
// Areas of the page
|
|
30
|
-
this.navbar = new
|
|
31
|
-
this.sidebar = new
|
|
27
|
+
this.navbar = new components.SystemConsoleNavbar(page.locator('.backstage-navbar'));
|
|
28
|
+
this.sidebar = new components.SystemConsoleSidebar(page.locator('.admin-sidebar'));
|
|
32
29
|
// Sections and sub-sections
|
|
33
|
-
this.systemUsers = new
|
|
34
|
-
this.mobileSecurity = new
|
|
35
|
-
this.featureDiscovery = new
|
|
30
|
+
this.systemUsers = new components.SystemUsers(page.getByTestId('systemUsersSection'));
|
|
31
|
+
this.mobileSecurity = new components.SystemConsoleMobileSecurity(page.getByTestId('sysconsole_section_MobileSecuritySettings'));
|
|
32
|
+
this.featureDiscovery = new components.SystemConsoleFeatureDiscovery(page.getByTestId('featureDiscovery'));
|
|
36
33
|
// Menus & Popovers
|
|
37
|
-
this.systemUsersFilterPopover = new
|
|
38
|
-
this.systemUsersRoleMenu = new
|
|
39
|
-
this.systemUsersStatusMenu = new
|
|
40
|
-
this.systemUsersColumnToggleMenu = new
|
|
41
|
-
this.systemUsersDateRangeMenu = new
|
|
42
|
-
this.systemUsersActionMenus = Array.from(Array(10).keys()).map((index
|
|
43
|
-
this.confirmModal = new
|
|
44
|
-
this.exportModal = new
|
|
45
|
-
this.saveChangesModal = new
|
|
34
|
+
this.systemUsersFilterPopover = new components.SystemUsersFilterPopover(page.locator('#systemUsersFilterPopover'));
|
|
35
|
+
this.systemUsersRoleMenu = new components.SystemUsersFilterMenu(page.locator('#DropdownInput_filterRole'));
|
|
36
|
+
this.systemUsersStatusMenu = new components.SystemUsersFilterMenu(page.locator('#DropdownInput_filterStatus'));
|
|
37
|
+
this.systemUsersColumnToggleMenu = new components.SystemUsersColumnToggleMenu(page.locator('#systemUsersColumnTogglerMenu'));
|
|
38
|
+
this.systemUsersDateRangeMenu = new components.SystemUsersFilterMenu(page.locator('#systemUsersDateRangeSelectorMenu'));
|
|
39
|
+
this.systemUsersActionMenus = Array.from(Array(10).keys()).map((index) => new components.SystemUsersFilterMenu(page.locator(`#actionMenu-systemUsersTable-${index}`)));
|
|
40
|
+
this.confirmModal = new components.GenericConfirmModal(page.locator('#confirmModal'));
|
|
41
|
+
this.exportModal = new components.GenericConfirmModal(page.getByRole('dialog', { name: 'Export user data' }));
|
|
42
|
+
this.saveChangesModal = new components.SystemUsers(page.locator('div.modal-content'));
|
|
46
43
|
}
|
|
47
44
|
async toBeVisible() {
|
|
48
45
|
await this.page.waitForLoadState('networkidle');
|
|
@@ -59,6 +56,3 @@ class SystemConsolePage {
|
|
|
59
56
|
await this.saveChangesModal.container.locator('button.btn-primary:has-text("Reset")').click();
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
|
-
|
|
63
|
-
module.exports = SystemConsolePage;
|
|
64
|
-
//# sourceMappingURL=system_console.js.map
|
package/dist/util.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var uuid = require('uuid');
|
|
4
|
-
|
|
5
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
6
2
|
// See LICENSE.txt for license information.
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
7
4
|
const second = 1000;
|
|
8
5
|
const minute = 60 * 1000;
|
|
9
|
-
const duration = {
|
|
6
|
+
export const duration = {
|
|
10
7
|
half_sec: second / 2,
|
|
11
8
|
one_sec: second,
|
|
12
9
|
two_sec: second * 2,
|
|
@@ -22,30 +19,22 @@ const duration = {
|
|
|
22
19
|
* @param {number} ms - duration in millisecond
|
|
23
20
|
* @return {Promise} promise with timeout
|
|
24
21
|
*/
|
|
25
|
-
const wait = async (ms = 0) => {
|
|
22
|
+
export const wait = async (ms = 0) => {
|
|
26
23
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
27
24
|
};
|
|
28
25
|
/**
|
|
29
26
|
* @param {Number} length - length on random string to return, e.g. 7 (default)
|
|
30
27
|
* @return {String} random string
|
|
31
28
|
*/
|
|
32
|
-
function getRandomId(length = 7) {
|
|
29
|
+
export function getRandomId(length = 7) {
|
|
33
30
|
const MAX_SUBSTRING_INDEX = 27;
|
|
34
|
-
return
|
|
31
|
+
return uuidv4()
|
|
35
32
|
.replace(/-/g, '')
|
|
36
33
|
.substring(MAX_SUBSTRING_INDEX - length, MAX_SUBSTRING_INDEX);
|
|
37
34
|
}
|
|
38
35
|
// Default team is meant for sysadmin's primary team,
|
|
39
36
|
// selected for compatibility with existing local development.
|
|
40
37
|
// It should not be used for testing.
|
|
41
|
-
const defaultTeam = { name: 'ad-1', displayName: 'eligendi'};
|
|
42
|
-
const illegalRe = /[/?<>\\:*|":&();]/g;
|
|
43
|
-
const simpleEmailRe = /\S+@\S+\.\S+/;
|
|
44
|
-
|
|
45
|
-
exports.defaultTeam = defaultTeam;
|
|
46
|
-
exports.duration = duration;
|
|
47
|
-
exports.getRandomId = getRandomId;
|
|
48
|
-
exports.illegalRe = illegalRe;
|
|
49
|
-
exports.simpleEmailRe = simpleEmailRe;
|
|
50
|
-
exports.wait = wait;
|
|
51
|
-
//# sourceMappingURL=util.js.map
|
|
38
|
+
export const defaultTeam = { name: 'ad-1', displayName: 'eligendi', type: 'O' };
|
|
39
|
+
export const illegalRe = /[/?<>\\:*|":&();]/g;
|
|
40
|
+
export const simpleEmailRe = /\S+@\S+\.\S+/;
|
package/dist/visual/index.js
CHANGED
|
@@ -1,37 +1,31 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var os = require('node:os');
|
|
4
|
-
var chalk = require('chalk');
|
|
5
|
-
var test = require('@playwright/test');
|
|
6
|
-
var percy = require('./percy.js');
|
|
7
|
-
var util = require('../util.js');
|
|
8
|
-
var test_config = require('../test_config.js');
|
|
9
|
-
|
|
10
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
11
2
|
// See LICENSE.txt for license information.
|
|
12
|
-
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { expect } from '@playwright/test';
|
|
6
|
+
import snapshotWithPercy from './percy';
|
|
7
|
+
import { duration, illegalRe, wait } from '@/util';
|
|
8
|
+
import { testConfig } from '@/test_config';
|
|
9
|
+
export async function matchSnapshot(testInfo, testArgs, options = {}) {
|
|
13
10
|
if (os.platform() !== 'linux') {
|
|
14
11
|
// eslint-disable-next-line no-console
|
|
15
12
|
console.log(chalk.yellow(`^ Warning: No visual test performed. Run in Linux or Playwright docker image to match snapshot.`));
|
|
16
13
|
return;
|
|
17
14
|
}
|
|
18
|
-
if (
|
|
15
|
+
if (testConfig.snapshotEnabled || testConfig.percyEnabled) {
|
|
19
16
|
await testArgs.page.waitForLoadState('networkidle');
|
|
20
17
|
await testArgs.page.waitForLoadState('domcontentloaded');
|
|
21
|
-
await
|
|
18
|
+
await wait(duration.half_sec);
|
|
22
19
|
}
|
|
23
|
-
if (
|
|
20
|
+
if (testConfig.snapshotEnabled) {
|
|
24
21
|
// Visual test with built-in snapshot
|
|
25
|
-
const filename = testInfo.title.trim().replace(
|
|
26
|
-
await
|
|
22
|
+
const filename = testInfo.title.trim().replace(illegalRe, '').replace(/\s/g, '-').trim().toLowerCase();
|
|
23
|
+
await expect(testArgs.page).toHaveScreenshot(`${filename}.png`, { fullPage: true, ...options });
|
|
27
24
|
}
|
|
28
|
-
if (
|
|
25
|
+
if (testConfig.percyEnabled) {
|
|
29
26
|
// Used to easily identify the screenshot when viewing from third-party service provider.
|
|
30
27
|
const name = `[${testInfo.project.name}, ${testArgs?.viewport?.width}px] > ${testInfo.file} > ${testInfo.title}`;
|
|
31
28
|
// Visual test with Percy
|
|
32
|
-
await
|
|
29
|
+
await snapshotWithPercy(name, testArgs);
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
|
-
|
|
36
|
-
exports.matchSnapshot = matchSnapshot;
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
package/dist/visual/percy.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var percySnapshot = require('@percy/playwright');
|
|
4
|
-
var test_config = require('../test_config.js');
|
|
5
|
-
|
|
6
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
7
2
|
// See LICENSE.txt for license information.
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import percySnapshot from '@percy/playwright';
|
|
4
|
+
import { testConfig } from '@/test_config';
|
|
5
|
+
export default async function snapshotWithPercy(name, testArgs) {
|
|
6
|
+
if (testArgs.browserName === 'chromium' && testConfig.percyEnabled && testArgs.viewport) {
|
|
10
7
|
const { page, viewport } = testArgs;
|
|
11
8
|
try {
|
|
12
9
|
await percySnapshot(page, name, { widths: [viewport.width], minHeight: viewport.height });
|
|
@@ -18,6 +15,3 @@ async function snapshotWithPercy(name, testArgs) {
|
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
module.exports = snapshotWithPercy;
|
|
23
|
-
//# sourceMappingURL=percy.js.map
|
package/package.json
CHANGED