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