@mattermost/playwright-lib 10.6.0-0 → 10.6.0
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/README.md +2 -2
- package/dist/browser_context.js +14 -21
- package/dist/constant.js +3 -6
- package/dist/file.js +20 -20
- package/dist/flag.js +26 -38
- package/dist/global_setup.js +22 -33
- package/dist/index.js +10 -47
- 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 +9 -15
- package/dist/server/index.js +9 -0
- package/dist/server/init.js +29 -36
- 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.js +47 -66
- 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.js +7 -13
- 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/server/init.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('@playwright/test');
|
|
4
|
-
var client = require('./client.js');
|
|
5
|
-
var default_config = require('./default_config.js');
|
|
6
|
-
var team = require('./team.js');
|
|
7
|
-
var user = require('./user.js');
|
|
8
|
-
var file = require('../file.js');
|
|
9
|
-
var test_config = require('../test_config.js');
|
|
10
|
-
|
|
11
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
12
2
|
// See LICENSE.txt for license information.
|
|
13
|
-
|
|
3
|
+
import { expect } from '@playwright/test';
|
|
4
|
+
import { makeClient } from './client';
|
|
5
|
+
import { getOnPremServerConfig } from './default_config';
|
|
6
|
+
import { createRandomTeam } from './team';
|
|
7
|
+
import { createRandomUser } from './user';
|
|
8
|
+
import { getFileFromCommonAsset } from '@/file';
|
|
9
|
+
import { testConfig } from '@/test_config';
|
|
10
|
+
export async function initSetup({ userPrefix = 'user', teamPrefix = { name: 'team', displayName: 'Team' }, withDefaultProfileImage = true, } = {}) {
|
|
14
11
|
try {
|
|
15
12
|
// Login the admin user via API
|
|
16
13
|
const { adminClient, adminUser } = await getAdminClient();
|
|
@@ -21,53 +18,49 @@ async function initSetup({ userPrefix = 'user', teamPrefix = { name: 'team', dis
|
|
|
21
18
|
throw new Error("Failed to setup admin: Check that you're able to access the server using the same admin credential.");
|
|
22
19
|
}
|
|
23
20
|
// Reset server config
|
|
24
|
-
const adminConfig = await adminClient.updateConfig(
|
|
21
|
+
const adminConfig = await adminClient.updateConfig(getOnPremServerConfig());
|
|
25
22
|
// Create new team
|
|
26
|
-
const team
|
|
23
|
+
const team = await adminClient.createTeam(createRandomTeam(teamPrefix.name, teamPrefix.displayName));
|
|
27
24
|
// Create new user and add to newly created team
|
|
28
|
-
const randomUser =
|
|
29
|
-
const user
|
|
30
|
-
user
|
|
31
|
-
await adminClient.addToTeam(team
|
|
25
|
+
const randomUser = createRandomUser(userPrefix);
|
|
26
|
+
const user = await adminClient.createUser(randomUser, '', '');
|
|
27
|
+
user.password = randomUser.password;
|
|
28
|
+
await adminClient.addToTeam(team.id, user.id);
|
|
32
29
|
// Log in new user via API
|
|
33
|
-
const { client: userClient } = await
|
|
30
|
+
const { client: userClient } = await makeClient(user);
|
|
34
31
|
if (withDefaultProfileImage) {
|
|
35
|
-
const file
|
|
36
|
-
await userClient.uploadProfileImage(user
|
|
32
|
+
const file = getFileFromCommonAsset('mattermost-icon_128x128.png');
|
|
33
|
+
await userClient.uploadProfileImage(user.id, file);
|
|
37
34
|
}
|
|
38
35
|
// Update user preference
|
|
39
36
|
const preferences = [
|
|
40
|
-
{ user_id: user
|
|
41
|
-
{ user_id: user
|
|
37
|
+
{ user_id: user.id, category: 'tutorial_step', name: user.id, value: '999' },
|
|
38
|
+
{ user_id: user.id, category: 'crt_thread_pane_step', name: user.id, value: '999' },
|
|
42
39
|
];
|
|
43
|
-
await userClient.savePreferences(user
|
|
40
|
+
await userClient.savePreferences(user.id, preferences);
|
|
44
41
|
return {
|
|
45
42
|
adminClient,
|
|
46
43
|
adminUser,
|
|
47
44
|
adminConfig,
|
|
48
|
-
user
|
|
45
|
+
user,
|
|
49
46
|
userClient,
|
|
50
|
-
team
|
|
51
|
-
offTopicUrl: getUrl(team
|
|
52
|
-
townSquareUrl: getUrl(team
|
|
47
|
+
team,
|
|
48
|
+
offTopicUrl: getUrl(team.name, 'off-topic'),
|
|
49
|
+
townSquareUrl: getUrl(team.name, 'town-square'),
|
|
53
50
|
};
|
|
54
51
|
}
|
|
55
52
|
catch (error) {
|
|
56
|
-
|
|
53
|
+
expect(error, 'Should not throw an error').toBeFalsy();
|
|
57
54
|
throw error;
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
|
-
async function getAdminClient(opts = { skipLog: false }) {
|
|
61
|
-
const { client: adminClient, user: adminUser } = await
|
|
62
|
-
username:
|
|
63
|
-
password:
|
|
57
|
+
export async function getAdminClient(opts = { skipLog: false }) {
|
|
58
|
+
const { client: adminClient, user: adminUser } = await makeClient({
|
|
59
|
+
username: testConfig.adminUsername,
|
|
60
|
+
password: testConfig.adminPassword,
|
|
64
61
|
}, opts);
|
|
65
62
|
return { adminClient, adminUser };
|
|
66
63
|
}
|
|
67
64
|
function getUrl(teamName, channelName) {
|
|
68
65
|
return `/${teamName}/channels/${channelName}`;
|
|
69
66
|
}
|
|
70
|
-
|
|
71
|
-
exports.getAdminClient = getAdminClient;
|
|
72
|
-
exports.initSetup = initSetup;
|
|
73
|
-
//# sourceMappingURL=init.js.map
|
package/dist/server/post.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var util = require('../util.js');
|
|
4
|
-
|
|
5
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
6
2
|
// See LICENSE.txt for license information.
|
|
7
|
-
|
|
3
|
+
import { getRandomId } from '@/util';
|
|
4
|
+
export function createRandomPost(post) {
|
|
8
5
|
if (post && post.channel_id && post.user_id) {
|
|
9
6
|
const time = Date.now();
|
|
10
7
|
const defaultPost = {
|
|
@@ -12,7 +9,7 @@ function createRandomPost(post) {
|
|
|
12
9
|
user_id: post.user_id,
|
|
13
10
|
channel_id: post.channel_id,
|
|
14
11
|
root_id: post.root_id || '',
|
|
15
|
-
message: `${post?.message ?? ''}${
|
|
12
|
+
message: `${post?.message ?? ''}${getRandomId()}`,
|
|
16
13
|
pending_post_id: `${post.user_id}:${time}`,
|
|
17
14
|
props: post?.props || {},
|
|
18
15
|
file_ids: post?.file_ids || [],
|
|
@@ -26,6 +23,3 @@ function createRandomPost(post) {
|
|
|
26
23
|
}
|
|
27
24
|
throw new Error('Post is missing channel_id or user_id or both');
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
exports.createRandomPost = createRandomPost;
|
|
31
|
-
//# sourceMappingURL=post.js.map
|
package/dist/server/team.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var util = require('../util.js');
|
|
4
|
-
|
|
5
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
6
2
|
// See LICENSE.txt for license information.
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { getRandomId } from '@/util';
|
|
4
|
+
export function createRandomTeam(name = 'team', displayName = 'Team', type = 'O', unique = true) {
|
|
5
|
+
const randomSuffix = getRandomId();
|
|
9
6
|
const team = {
|
|
10
7
|
name: unique ? `${name}-${randomSuffix}` : name,
|
|
11
8
|
display_name: unique ? `${displayName} ${randomSuffix}` : displayName,
|
|
@@ -13,6 +10,3 @@ function createRandomTeam(name = 'team', displayName = 'Team', type = 'O', uniqu
|
|
|
13
10
|
};
|
|
14
11
|
return team;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
exports.createRandomTeam = createRandomTeam;
|
|
18
|
-
//# sourceMappingURL=team.js.map
|
package/dist/server/user.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var util = require('../util.js');
|
|
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 { getRandomId } from '@/util';
|
|
4
|
+
import { testConfig } from '@/test_config';
|
|
5
|
+
export function createRandomUser(prefix = 'user') {
|
|
6
|
+
const randomId = getRandomId();
|
|
10
7
|
const user = {
|
|
11
8
|
email: `${prefix}${randomId}@sample.mattermost.com`,
|
|
12
9
|
username: `${prefix}${randomId}`,
|
|
@@ -17,17 +14,13 @@ function createRandomUser(prefix = 'user') {
|
|
|
17
14
|
};
|
|
18
15
|
return user;
|
|
19
16
|
}
|
|
20
|
-
function getDefaultAdminUser() {
|
|
17
|
+
export function getDefaultAdminUser() {
|
|
21
18
|
const admin = {
|
|
22
|
-
username:
|
|
23
|
-
password:
|
|
19
|
+
username: testConfig.adminUsername,
|
|
20
|
+
password: testConfig.adminPassword,
|
|
24
21
|
first_name: 'Kenneth',
|
|
25
22
|
last_name: 'Moreno',
|
|
26
|
-
email:
|
|
23
|
+
email: testConfig.adminEmail,
|
|
27
24
|
};
|
|
28
25
|
return admin;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
exports.createRandomUser = createRandomUser;
|
|
32
|
-
exports.getDefaultAdminUser = getDefaultAdminUser;
|
|
33
|
-
//# sourceMappingURL=user.js.map
|
package/dist/test_action.js
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var asyncWaitUntil = require('async-wait-until');
|
|
4
|
-
|
|
5
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
6
2
|
// See LICENSE.txt for license information.
|
|
3
|
+
export { waitUntil } from 'async-wait-until';
|
|
7
4
|
const visibilityHidden = 'visibility: hidden !important;';
|
|
8
5
|
const hideTeamHeader = `.test-team-header {${visibilityHidden}} `;
|
|
9
6
|
const hidePostHeaderTime = `.post__time {${visibilityHidden}} `;
|
|
10
7
|
const hidePostProfileIcon = `.profile-icon {${visibilityHidden}} `;
|
|
11
|
-
async function hideDynamicChannelsContent(page) {
|
|
8
|
+
export async function hideDynamicChannelsContent(page) {
|
|
12
9
|
await page.addStyleTag({ content: hideTeamHeader + hidePostHeaderTime + hidePostProfileIcon });
|
|
13
10
|
}
|
|
14
|
-
async function waitForAnimationEnd(locator) {
|
|
11
|
+
export async function waitForAnimationEnd(locator) {
|
|
15
12
|
return locator.evaluate((element) => Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished)));
|
|
16
13
|
}
|
|
17
|
-
|
|
18
|
-
Object.defineProperty(exports, "waitUntil", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return asyncWaitUntil.waitUntil; }
|
|
21
|
-
});
|
|
22
|
-
exports.hideDynamicChannelsContent = hideDynamicChannelsContent;
|
|
23
|
-
exports.waitForAnimationEnd = waitForAnimationEnd;
|
|
24
|
-
//# sourceMappingURL=test_action.js.map
|
package/dist/test_config.js
CHANGED
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var dotenv = require('dotenv');
|
|
4
|
-
|
|
5
|
-
function _interopNamespaceDefault(e) {
|
|
6
|
-
var n = Object.create(null);
|
|
7
|
-
if (e) {
|
|
8
|
-
Object.keys(e).forEach(function (k) {
|
|
9
|
-
if (k !== 'default') {
|
|
10
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return e[k]; }
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
n.default = e;
|
|
19
|
-
return Object.freeze(n);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var dotenv__namespace = /*#__PURE__*/_interopNamespaceDefault(dotenv);
|
|
23
|
-
|
|
24
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
25
2
|
// See LICENSE.txt for license information.
|
|
26
|
-
|
|
3
|
+
import * as dotenv from 'dotenv';
|
|
4
|
+
dotenv.config();
|
|
27
5
|
// All process.env should be defined here
|
|
28
|
-
class TestConfig {
|
|
6
|
+
export class TestConfig {
|
|
29
7
|
baseURL;
|
|
30
8
|
adminUsername;
|
|
31
9
|
adminPassword;
|
|
@@ -69,14 +47,10 @@ class TestConfig {
|
|
|
69
47
|
}
|
|
70
48
|
}
|
|
71
49
|
// Create a singleton instance
|
|
72
|
-
const testConfig = new TestConfig();
|
|
50
|
+
export const testConfig = new TestConfig();
|
|
73
51
|
function parseBool(actualValue, defaultValue) {
|
|
74
52
|
return actualValue ? actualValue === 'true' : defaultValue;
|
|
75
53
|
}
|
|
76
54
|
function parseNumber(actualValue, defaultValue) {
|
|
77
55
|
return actualValue ? parseInt(actualValue, 10) : defaultValue;
|
|
78
56
|
}
|
|
79
|
-
|
|
80
|
-
exports.TestConfig = TestConfig;
|
|
81
|
-
exports.testConfig = testConfig;
|
|
82
|
-
//# sourceMappingURL=test_config.js.map
|
package/dist/test_fixture.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test$1 = require('@playwright/test');
|
|
4
|
-
var playwright = require('@axe-core/playwright');
|
|
5
|
-
var browser_context = require('./browser_context.js');
|
|
6
|
-
var flag = require('./flag.js');
|
|
7
|
-
var file = require('./file.js');
|
|
8
|
-
require('@mattermost/client');
|
|
9
|
-
require('./test_config.js');
|
|
10
|
-
var channel = require('./server/channel.js');
|
|
11
|
-
require('./server/default_config.js');
|
|
12
|
-
var init = require('./server/init.js');
|
|
13
|
-
var post = require('./server/post.js');
|
|
14
|
-
var team = require('./server/team.js');
|
|
15
|
-
var user = require('./server/user.js');
|
|
16
|
-
var test_action = require('./test_action.js');
|
|
17
|
-
var index = require('./ui/pages/index.js');
|
|
18
|
-
var index$1 = require('./visual/index.js');
|
|
19
|
-
var mock_browser_api = require('./mock_browser_api.js');
|
|
20
|
-
var util = require('./util.js');
|
|
21
|
-
var asyncWaitUntil = require('async-wait-until');
|
|
22
|
-
|
|
23
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
24
2
|
// See LICENSE.txt for license information.
|
|
25
|
-
|
|
3
|
+
import { test as base } from '@playwright/test';
|
|
4
|
+
import { AxeBuilder } from '@axe-core/playwright';
|
|
5
|
+
import { TestBrowser } from './browser_context';
|
|
6
|
+
import { ensureLicense, shouldHaveCallsEnabled, shouldHaveFeatureFlag, shouldRunInLinux, skipIfFeatureFlagNotSet, skipIfNoLicense, } from './flag';
|
|
7
|
+
import { getBlobFromAsset, getFileFromAsset } from './file';
|
|
8
|
+
import { createRandomChannel, createRandomPost, createRandomTeam, createRandomUser, getAdminClient, initSetup, } from './server';
|
|
9
|
+
import { hideDynamicChannelsContent, waitForAnimationEnd, waitUntil } from './test_action';
|
|
10
|
+
import { pages } from './ui/pages';
|
|
11
|
+
import { matchSnapshot } from './visual';
|
|
12
|
+
import { stubNotification, waitForNotification } from './mock_browser_api';
|
|
13
|
+
import { duration, getRandomId, simpleEmailRe, wait } from './util';
|
|
14
|
+
export { expect } from '@playwright/test';
|
|
15
|
+
export const test = base.extend({
|
|
26
16
|
// eslint-disable-next-line no-empty-pattern
|
|
27
17
|
axe: async ({}, use) => {
|
|
28
18
|
const ab = new AxeBuilderExtended();
|
|
@@ -34,7 +24,7 @@ const test = test$1.test.extend({
|
|
|
34
24
|
await pw.testBrowser.close();
|
|
35
25
|
},
|
|
36
26
|
});
|
|
37
|
-
class PlaywrightExtended {
|
|
27
|
+
export class PlaywrightExtended {
|
|
38
28
|
// ./browser_context
|
|
39
29
|
testBrowser;
|
|
40
30
|
// ./flag
|
|
@@ -73,44 +63,44 @@ class PlaywrightExtended {
|
|
|
73
63
|
hasSeenLandingPage;
|
|
74
64
|
constructor(browser, page, isMobile) {
|
|
75
65
|
// ./browser_context
|
|
76
|
-
this.testBrowser = new
|
|
66
|
+
this.testBrowser = new TestBrowser(browser);
|
|
77
67
|
// ./flag
|
|
78
|
-
this.shouldHaveCallsEnabled =
|
|
79
|
-
this.shouldHaveFeatureFlag =
|
|
80
|
-
this.shouldRunInLinux =
|
|
81
|
-
this.ensureLicense =
|
|
82
|
-
this.skipIfNoLicense =
|
|
83
|
-
this.skipIfFeatureFlagNotSet =
|
|
68
|
+
this.shouldHaveCallsEnabled = shouldHaveCallsEnabled;
|
|
69
|
+
this.shouldHaveFeatureFlag = shouldHaveFeatureFlag;
|
|
70
|
+
this.shouldRunInLinux = shouldRunInLinux;
|
|
71
|
+
this.ensureLicense = ensureLicense;
|
|
72
|
+
this.skipIfNoLicense = skipIfNoLicense;
|
|
73
|
+
this.skipIfFeatureFlagNotSet = skipIfFeatureFlagNotSet;
|
|
84
74
|
// ./file
|
|
85
|
-
this.getBlobFromAsset =
|
|
86
|
-
this.getFileFromAsset =
|
|
75
|
+
this.getBlobFromAsset = getBlobFromAsset;
|
|
76
|
+
this.getFileFromAsset = getFileFromAsset;
|
|
87
77
|
// ./server
|
|
88
|
-
this.initSetup =
|
|
89
|
-
this.getAdminClient =
|
|
78
|
+
this.initSetup = initSetup;
|
|
79
|
+
this.getAdminClient = getAdminClient;
|
|
90
80
|
// ./test_action
|
|
91
|
-
this.hideDynamicChannelsContent =
|
|
92
|
-
this.waitForAnimationEnd =
|
|
93
|
-
this.waitUntil =
|
|
81
|
+
this.hideDynamicChannelsContent = hideDynamicChannelsContent;
|
|
82
|
+
this.waitForAnimationEnd = waitForAnimationEnd;
|
|
83
|
+
this.waitUntil = waitUntil;
|
|
94
84
|
// unauthenticated page
|
|
95
|
-
this.loginPage = new
|
|
96
|
-
this.landingLoginPage = new
|
|
97
|
-
this.signupPage = new
|
|
98
|
-
this.resetPasswordPage = new
|
|
85
|
+
this.loginPage = new pages.LoginPage(page);
|
|
86
|
+
this.landingLoginPage = new pages.LandingLoginPage(page, isMobile);
|
|
87
|
+
this.signupPage = new pages.SignupPage(page);
|
|
88
|
+
this.resetPasswordPage = new pages.ResetPasswordPage(page);
|
|
99
89
|
// ./mock_browser_api
|
|
100
|
-
this.stubNotification =
|
|
101
|
-
this.waitForNotification =
|
|
90
|
+
this.stubNotification = stubNotification;
|
|
91
|
+
this.waitForNotification = waitForNotification;
|
|
102
92
|
// ./visual
|
|
103
|
-
this.matchSnapshot =
|
|
93
|
+
this.matchSnapshot = matchSnapshot;
|
|
104
94
|
// ./util
|
|
105
|
-
this.duration =
|
|
106
|
-
this.wait =
|
|
107
|
-
this.simpleEmailRe =
|
|
95
|
+
this.duration = duration;
|
|
96
|
+
this.wait = wait;
|
|
97
|
+
this.simpleEmailRe = simpleEmailRe;
|
|
108
98
|
this.random = {
|
|
109
|
-
id:
|
|
110
|
-
channel:
|
|
111
|
-
post:
|
|
112
|
-
team:
|
|
113
|
-
user:
|
|
99
|
+
id: getRandomId,
|
|
100
|
+
channel: createRandomChannel,
|
|
101
|
+
post: createRandomPost,
|
|
102
|
+
team: createRandomTeam,
|
|
103
|
+
user: createRandomUser,
|
|
114
104
|
};
|
|
115
105
|
this.hasSeenLandingPage = async () => {
|
|
116
106
|
// Visit the base URL to be able to set the localStorage
|
|
@@ -119,7 +109,7 @@ class PlaywrightExtended {
|
|
|
119
109
|
};
|
|
120
110
|
}
|
|
121
111
|
}
|
|
122
|
-
class AxeBuilderExtended {
|
|
112
|
+
export class AxeBuilderExtended {
|
|
123
113
|
builder;
|
|
124
114
|
// See https://github.com/dequelabs/axe-core/blob/master/doc/API.md#axe-core-tags
|
|
125
115
|
tags = ['wcag2a', 'wcag2aa'];
|
|
@@ -137,7 +127,7 @@ class AxeBuilderExtended {
|
|
|
137
127
|
// Option: make use of custom theme to improve color contrast.
|
|
138
128
|
disabledRules.push('link-in-text-block');
|
|
139
129
|
}
|
|
140
|
-
return new
|
|
130
|
+
return new AxeBuilder({ page }).withTags(this.tags).disableRules(disabledRules);
|
|
141
131
|
};
|
|
142
132
|
}
|
|
143
133
|
violationFingerprints(accessibilityScanResults) {
|
|
@@ -152,8 +142,8 @@ class AxeBuilderExtended {
|
|
|
152
142
|
return JSON.stringify(fingerprints, null, 2);
|
|
153
143
|
}
|
|
154
144
|
}
|
|
155
|
-
async function waitUntilLocalStorageIsSet(page, key, value, timeout =
|
|
156
|
-
await
|
|
145
|
+
async function waitUntilLocalStorageIsSet(page, key, value, timeout = duration.ten_sec) {
|
|
146
|
+
await waitUntil(() => page.evaluate(({ key, value }) => {
|
|
157
147
|
if (localStorage.getItem(key) === value) {
|
|
158
148
|
return true;
|
|
159
149
|
}
|
|
@@ -161,12 +151,3 @@ async function waitUntilLocalStorageIsSet(page, key, value, timeout = util.durat
|
|
|
161
151
|
return false;
|
|
162
152
|
}, { key, value }), { timeout });
|
|
163
153
|
}
|
|
164
|
-
|
|
165
|
-
Object.defineProperty(exports, "expect", {
|
|
166
|
-
enumerable: true,
|
|
167
|
-
get: function () { return test$1.expect; }
|
|
168
|
-
});
|
|
169
|
-
exports.AxeBuilderExtended = AxeBuilderExtended;
|
|
170
|
-
exports.PlaywrightExtended = PlaywrightExtended;
|
|
171
|
-
exports.test = test;
|
|
172
|
-
//# sourceMappingURL=test_fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/browser_context.ts","../src/constant.ts","../src/file.ts","../src/flag.ts","../src/global_setup.ts","../src/index.ts","../src/mock_browser_api.ts","../src/test_action.ts","../src/test_config.ts","../src/test_fixture.ts","../src/types.ts","../src/util.ts","../src/server/channel.ts","../src/server/client.ts","../src/server/default_config.ts","../src/server/index.ts","../src/server/init.ts","../src/server/post.ts","../src/server/team.ts","../src/server/user.ts","../src/ui/components/footer.ts","../src/ui/components/global_header.ts","../src/ui/components/index.ts","../src/ui/components/main_header.ts","../src/ui/components/channels/app_bar.ts","../src/ui/components/channels/center_view.ts","../src/ui/components/channels/delete_post_confirmation_dialog.ts","../src/ui/components/channels/delete_post_modal.ts","../src/ui/components/channels/emoji_gif_picker.ts","../src/ui/components/channels/find_channels_modal.ts","../src/ui/components/channels/generic_confirm_modal.ts","../src/ui/components/channels/header.ts","../src/ui/components/channels/message_priority.ts","../src/ui/components/channels/post.ts","../src/ui/components/channels/post_create.ts","../src/ui/components/channels/post_dot_menu.ts","../src/ui/components/channels/post_edit.ts","../src/ui/components/channels/post_menu.ts","../src/ui/components/channels/post_reminder_menu.ts","../src/ui/components/channels/restore_post_confirmation_dialog.ts","../src/ui/components/channels/scheduled_draft_menu.ts","../src/ui/components/channels/scheduled_draft_modal.ts","../src/ui/components/channels/search_popover.ts","../src/ui/components/channels/sidebar_left.ts","../src/ui/components/channels/sidebar_right.ts","../src/ui/components/channels/thread_footer.ts","../src/ui/components/channels/user_profile_popover.ts","../src/ui/components/channels/settings/notification_settings.ts","../src/ui/components/channels/settings/settings_modal.ts","../src/ui/components/system_console/navbar.ts","../src/ui/components/system_console/sidebar.ts","../src/ui/components/system_console/sections/system_users/column_toggle_menu.ts","../src/ui/components/system_console/sections/system_users/feature_discovery.ts","../src/ui/components/system_console/sections/system_users/filter_menu.ts","../src/ui/components/system_console/sections/system_users/filter_popover.ts","../src/ui/components/system_console/sections/system_users/mobile_security.ts","../src/ui/components/system_console/sections/system_users/system_users.ts","../src/ui/pages/channels.ts","../src/ui/pages/drafts.ts","../src/ui/pages/index.ts","../src/ui/pages/landing_login.ts","../src/ui/pages/login.ts","../src/ui/pages/reset_password.ts","../src/ui/pages/scheduled_draft.ts","../src/ui/pages/signup.ts","../src/ui/pages/system_console.ts","../src/visual/index.ts","../src/visual/percy.ts"],"version":"5.7.3"}
|
package/dist/types.js
ADDED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('@playwright/test');
|
|
4
|
-
|
|
5
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
6
2
|
// See LICENSE.txt for license information.
|
|
7
|
-
|
|
3
|
+
import { expect } from '@playwright/test';
|
|
4
|
+
export default class ChannelsAppBar {
|
|
8
5
|
container;
|
|
9
6
|
playbooksIcon;
|
|
10
7
|
constructor(container) {
|
|
@@ -12,9 +9,6 @@ class ChannelsAppBar {
|
|
|
12
9
|
this.playbooksIcon = container.locator('#app-bar-icon-playbooks').getByRole('img');
|
|
13
10
|
}
|
|
14
11
|
async toBeVisible() {
|
|
15
|
-
await
|
|
12
|
+
await expect(this.container).toBeVisible();
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
module.exports = ChannelsAppBar;
|
|
20
|
-
//# sourceMappingURL=app_bar.js.map
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('@playwright/test');
|
|
4
|
-
var header = require('./header.js');
|
|
5
|
-
var post_create = require('./post_create.js');
|
|
6
|
-
var post_edit = require('./post_edit.js');
|
|
7
|
-
var post = require('./post.js');
|
|
8
|
-
var util = require('../../../util.js');
|
|
9
|
-
var asyncWaitUntil = require('async-wait-until');
|
|
10
|
-
|
|
11
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
12
2
|
// See LICENSE.txt for license information.
|
|
13
|
-
|
|
3
|
+
import { expect } from '@playwright/test';
|
|
4
|
+
import ChannelsHeader from './header';
|
|
5
|
+
import ChannelsPostCreate from './post_create';
|
|
6
|
+
import ChannelsPostEdit from './post_edit';
|
|
7
|
+
import ChannelsPost from './post';
|
|
8
|
+
import { duration } from '@/util';
|
|
9
|
+
import { waitUntil } from '@/test_action';
|
|
10
|
+
export default class ChannelsCenterView {
|
|
14
11
|
container;
|
|
15
12
|
header;
|
|
16
13
|
postCreate;
|
|
@@ -26,10 +23,10 @@ class ChannelsCenterView {
|
|
|
26
23
|
constructor(container) {
|
|
27
24
|
this.container = container;
|
|
28
25
|
this.scheduledDraftChannelInfoMessageLocator = 'span:has-text("Message scheduled for")';
|
|
29
|
-
this.header = new
|
|
30
|
-
this.postCreate = new
|
|
31
|
-
this.scheduledDraftOptions = new
|
|
32
|
-
this.postEdit = new
|
|
26
|
+
this.header = new ChannelsHeader(this.container.locator('.channel-header'));
|
|
27
|
+
this.postCreate = new ChannelsPostCreate(container.getByTestId('post-create'));
|
|
28
|
+
this.scheduledDraftOptions = new ChannelsPostCreate(container.locator('#dropdown_send_post_options'));
|
|
29
|
+
this.postEdit = new ChannelsPostEdit(container.locator('.post-edit__container'));
|
|
33
30
|
this.postBoxIndicator = container.locator('div.postBoxIndicator');
|
|
34
31
|
this.scheduledDraftChannelIcon = container.locator('#create_post i.icon-draft-indicator');
|
|
35
32
|
this.scheduledDraftChannelInfoMessage = container.locator('div.ScheduledPostIndicator span');
|
|
@@ -38,7 +35,7 @@ class ChannelsCenterView {
|
|
|
38
35
|
this.editedPostIcon = (postID) => container.locator(`#postEdited_${postID}`);
|
|
39
36
|
}
|
|
40
37
|
async toBeVisible() {
|
|
41
|
-
await
|
|
38
|
+
await expect(this.container).toBeVisible();
|
|
42
39
|
await this.postCreate.toBeVisible();
|
|
43
40
|
}
|
|
44
41
|
/**
|
|
@@ -54,7 +51,7 @@ class ChannelsCenterView {
|
|
|
54
51
|
async getFirstPost() {
|
|
55
52
|
const firstPost = this.container.getByTestId('postView').first();
|
|
56
53
|
await firstPost.waitFor();
|
|
57
|
-
return new
|
|
54
|
+
return new ChannelsPost(firstPost);
|
|
58
55
|
}
|
|
59
56
|
/**
|
|
60
57
|
* Return the last post in the Center
|
|
@@ -62,7 +59,7 @@ class ChannelsCenterView {
|
|
|
62
59
|
async getLastPost() {
|
|
63
60
|
const lastPost = this.container.getByTestId('postView').last();
|
|
64
61
|
await lastPost.waitFor();
|
|
65
|
-
return new
|
|
62
|
+
return new ChannelsPost(lastPost);
|
|
66
63
|
}
|
|
67
64
|
/**
|
|
68
65
|
* Return the ID of the last post in the Center
|
|
@@ -82,7 +79,7 @@ class ChannelsCenterView {
|
|
|
82
79
|
async getNthPost(index) {
|
|
83
80
|
const nthPost = this.container.getByTestId('postView').nth(index);
|
|
84
81
|
await nthPost.waitFor();
|
|
85
|
-
return new
|
|
82
|
+
return new ChannelsPost(nthPost);
|
|
86
83
|
}
|
|
87
84
|
/**
|
|
88
85
|
* Returns the Center post by post's id
|
|
@@ -91,17 +88,17 @@ class ChannelsCenterView {
|
|
|
91
88
|
async getPostById(id) {
|
|
92
89
|
const postById = this.container.locator(`[id="post_${id}"]`);
|
|
93
90
|
await postById.waitFor();
|
|
94
|
-
return new
|
|
91
|
+
return new ChannelsPost(postById);
|
|
95
92
|
}
|
|
96
|
-
async waitUntilLastPostContains(text, timeout =
|
|
97
|
-
await
|
|
93
|
+
async waitUntilLastPostContains(text, timeout = duration.ten_sec) {
|
|
94
|
+
await waitUntil(async () => {
|
|
98
95
|
const post = await this.getLastPost();
|
|
99
96
|
const content = await post.container.textContent();
|
|
100
97
|
return content?.includes(text);
|
|
101
98
|
}, { timeout });
|
|
102
99
|
}
|
|
103
|
-
async waitUntilPostWithIdContains(id, text, timeout =
|
|
104
|
-
await
|
|
100
|
+
async waitUntilPostWithIdContains(id, text, timeout = duration.ten_sec) {
|
|
101
|
+
await waitUntil(async () => {
|
|
105
102
|
const post = await this.getPostById(id);
|
|
106
103
|
const content = await post.container.textContent();
|
|
107
104
|
return content?.includes(text);
|
|
@@ -111,7 +108,7 @@ class ChannelsCenterView {
|
|
|
111
108
|
await this.postBoxIndicator.isVisible();
|
|
112
109
|
await this.scheduledDraftChannelIcon.isVisible();
|
|
113
110
|
const messageLocator = this.scheduledDraftChannelInfoMessage.first();
|
|
114
|
-
await
|
|
111
|
+
await expect(messageLocator).toContainText('Message scheduled for');
|
|
115
112
|
}
|
|
116
113
|
async clickOnLastEditedPost(postID) {
|
|
117
114
|
if (postID) {
|
|
@@ -119,6 +116,3 @@ class ChannelsCenterView {
|
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
|
-
|
|
123
|
-
module.exports = ChannelsCenterView;
|
|
124
|
-
//# sourceMappingURL=center_view.js.map
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('@playwright/test');
|
|
4
|
-
|
|
5
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
6
2
|
// See LICENSE.txt for license information.
|
|
7
|
-
|
|
3
|
+
import { expect } from '@playwright/test';
|
|
4
|
+
export default class DeletePostConfirmationDialog {
|
|
8
5
|
container;
|
|
9
6
|
cancelButton;
|
|
10
7
|
confirmButton;
|
|
@@ -14,14 +11,14 @@ class DeletePostConfirmationDialog {
|
|
|
14
11
|
this.confirmButton = container.locator('button#deletePostModalButton');
|
|
15
12
|
}
|
|
16
13
|
async toBeVisible() {
|
|
17
|
-
await
|
|
18
|
-
await
|
|
19
|
-
await
|
|
14
|
+
await expect(this.container).toBeVisible();
|
|
15
|
+
await expect(this.cancelButton).toBeVisible();
|
|
16
|
+
await expect(this.confirmButton).toBeVisible();
|
|
20
17
|
}
|
|
21
18
|
async notToBeVisible() {
|
|
22
|
-
await
|
|
23
|
-
await
|
|
24
|
-
await
|
|
19
|
+
await expect(this.container).not.toBeVisible();
|
|
20
|
+
await expect(this.cancelButton).not.toBeVisible();
|
|
21
|
+
await expect(this.confirmButton).not.toBeVisible();
|
|
25
22
|
}
|
|
26
23
|
async cancelDeletion() {
|
|
27
24
|
await this.cancelButton.click();
|
|
@@ -30,6 +27,3 @@ class DeletePostConfirmationDialog {
|
|
|
30
27
|
await this.confirmButton.click();
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
|
|
34
|
-
module.exports = DeletePostConfirmationDialog;
|
|
35
|
-
//# sourceMappingURL=delete_post_confirmation_dialog.js.map
|