@mattermost/playwright-lib 10.7.0-0 → 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.js +14 -49
- 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 +9 -15
- package/dist/server/init.js +29 -36
- package/dist/server/plugins.d.ts +1 -1
- package/dist/server/plugins.js +13 -14
- package/dist/server/plugins.js.map +1 -1
- 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 +2 -1
- package/dist/test_fixture.js +50 -68
- package/dist/test_fixture.js.map +1 -1
- 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/client.js
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var client = require('@mattermost/client');
|
|
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.
|
|
3
|
+
import { Client4 } from '@mattermost/client';
|
|
4
|
+
import { testConfig } from '@/test_config';
|
|
8
5
|
// Variable to hold cache
|
|
9
6
|
const clients = {};
|
|
10
|
-
async function makeClient(userRequest, opts = { useCache: true, skipLog: false }) {
|
|
11
|
-
const client
|
|
12
|
-
client
|
|
7
|
+
export async function makeClient(userRequest, opts = { useCache: true, skipLog: false }) {
|
|
8
|
+
const client = new Client4();
|
|
9
|
+
client.setUrl(testConfig.baseURL);
|
|
13
10
|
try {
|
|
14
11
|
if (!userRequest) {
|
|
15
|
-
return { client
|
|
12
|
+
return { client, user: null };
|
|
16
13
|
}
|
|
17
14
|
const cacheKey = userRequest.username + userRequest.password;
|
|
18
15
|
if (opts?.useCache && clients[cacheKey] != null) {
|
|
19
16
|
return clients[cacheKey];
|
|
20
17
|
}
|
|
21
|
-
const userProfile = await client
|
|
18
|
+
const userProfile = await client.login(userRequest.username, userRequest.password);
|
|
22
19
|
const user = { ...userProfile, password: userRequest.password };
|
|
23
20
|
if (opts?.useCache) {
|
|
24
|
-
clients[cacheKey] = { client
|
|
21
|
+
clients[cacheKey] = { client, user };
|
|
25
22
|
}
|
|
26
|
-
return { client
|
|
23
|
+
return { client, user };
|
|
27
24
|
}
|
|
28
25
|
catch (err) {
|
|
29
26
|
if (!opts?.skipLog) {
|
|
@@ -31,9 +28,6 @@ async function makeClient(userRequest, opts = { useCache: true, skipLog: false }
|
|
|
31
28
|
// eslint-disable-next-line no-console
|
|
32
29
|
console.log('makeClient', err);
|
|
33
30
|
}
|
|
34
|
-
return { client
|
|
31
|
+
return { client, user: null };
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
|
-
|
|
38
|
-
exports.makeClient = makeClient;
|
|
39
|
-
//# sourceMappingURL=client.js.map
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var merge = require('deepmerge');
|
|
4
|
-
var config = require('@mattermost/types/config');
|
|
5
|
-
var test_config = require('../test_config.js');
|
|
6
|
-
|
|
7
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
8
2
|
// See LICENSE.txt for license information.
|
|
9
|
-
|
|
3
|
+
import merge from 'deepmerge';
|
|
4
|
+
import { CollapsedThreads, } from '@mattermost/types/config';
|
|
5
|
+
import { testConfig } from '@/test_config';
|
|
6
|
+
export function getOnPremServerConfig() {
|
|
10
7
|
return merge(defaultServerConfig, onPremServerConfig());
|
|
11
8
|
}
|
|
12
9
|
// On-prem setting that is different from the default
|
|
13
10
|
const onPremServerConfig = () => {
|
|
14
11
|
return {
|
|
15
12
|
ClusterSettings: {
|
|
16
|
-
Enable:
|
|
17
|
-
ClusterName:
|
|
13
|
+
Enable: testConfig.haClusterEnabled,
|
|
14
|
+
ClusterName: testConfig.haClusterName,
|
|
18
15
|
},
|
|
19
16
|
EmailSettings: {
|
|
20
|
-
PushNotificationServer:
|
|
17
|
+
PushNotificationServer: testConfig.pushNotificationServer,
|
|
21
18
|
},
|
|
22
19
|
LogSettings: {
|
|
23
20
|
EnableDiagnostics: false,
|
|
@@ -45,7 +42,7 @@ const onPremServerConfig = () => {
|
|
|
45
42
|
},
|
|
46
43
|
},
|
|
47
44
|
ServiceSettings: {
|
|
48
|
-
SiteURL:
|
|
45
|
+
SiteURL: testConfig.baseURL,
|
|
49
46
|
EnableOnboardingFlow: false,
|
|
50
47
|
EnableSecurityFixAlert: false,
|
|
51
48
|
GiphySdkKey: 's0glxvzVg9azvPipKxcPLpXV0q1x1fVP',
|
|
@@ -167,7 +164,7 @@ const defaultServerConfig = {
|
|
|
167
164
|
FeatureFlagSyncIntervalSeconds: 30,
|
|
168
165
|
DebugSplit: false,
|
|
169
166
|
ThreadAutoFollow: true,
|
|
170
|
-
CollapsedThreads:
|
|
167
|
+
CollapsedThreads: CollapsedThreads.ALWAYS_ON,
|
|
171
168
|
ManagedResourcePaths: '',
|
|
172
169
|
EnableCustomGroups: true,
|
|
173
170
|
AllowSyncedDrafts: true,
|
|
@@ -757,6 +754,3 @@ const defaultServerConfig = {
|
|
|
757
754
|
MaxPostsPerSync: 50,
|
|
758
755
|
},
|
|
759
756
|
};
|
|
760
|
-
|
|
761
|
-
exports.getOnPremServerConfig = getOnPremServerConfig;
|
|
762
|
-
//# sourceMappingURL=default_config.js.map
|
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/plugins.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Client4 } from '@mattermost/client';
|
|
2
|
-
export declare function ensurePluginsLoaded(client: Client4): Promise<void>;
|
|
2
|
+
export declare function ensurePluginsLoaded(client: Client4, pluginIds?: string[]): Promise<void>;
|
package/dist/server/plugins.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test_config = require('../test_config.js');
|
|
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
|
+
import { testConfig } from '@/test_config';
|
|
5
|
+
// ensurePluginsLoaded is used to ensure all pluginIds including from testConfig.ensurePluginsInstalled are installed and active.
|
|
6
|
+
// If any pluginId is not installed, test will fail.
|
|
7
|
+
// testConfig.ensurePluginsInstalled is derived from `PW_ENSURE_PLUGINS_INSTALLED` environment variable.
|
|
8
|
+
export async function ensurePluginsLoaded(client, pluginIds = []) {
|
|
8
9
|
const pluginStatus = await client.getPluginStatuses();
|
|
9
10
|
const plugins = await client.getPlugins();
|
|
10
|
-
|
|
11
|
+
// Ensure all plugins are installed and active.
|
|
12
|
+
testConfig.ensurePluginsInstalled
|
|
13
|
+
.concat(pluginIds)
|
|
14
|
+
.filter((pluginId) => Boolean(pluginId))
|
|
15
|
+
.forEach(async (pluginId) => {
|
|
11
16
|
const isInstalled = pluginStatus.some((plugin) => plugin.plugin_id === pluginId);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
console.log(`${pluginId} is not installed. Related visual test will fail.`);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
+
// If not installed, test will fail.
|
|
18
|
+
expect(isInstalled, `${pluginId} is not installed. Related test will fail.`).toBe(true);
|
|
17
19
|
const isActive = plugins.active.some((plugin) => plugin.id === pluginId);
|
|
18
20
|
if (!isActive) {
|
|
19
21
|
await client.enablePlugin(pluginId);
|
|
@@ -26,6 +28,3 @@ async function ensurePluginsLoaded(client) {
|
|
|
26
28
|
}
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
|
-
|
|
30
|
-
exports.ensurePluginsLoaded = ensurePluginsLoaded;
|
|
31
|
-
//# sourceMappingURL=plugins.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sources":["../../src/server/plugins.ts"],"sourcesContent":["// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.\n// See LICENSE.txt for license information.\n\nimport {Client4} from '@mattermost/client';\nimport {PluginManifest} from '@mattermost/types/plugins';\n\nimport {testConfig} from '@/test_config';\n\nexport async function ensurePluginsLoaded(client: Client4) {\n const pluginStatus = await client.getPluginStatuses();\n const plugins = await client.getPlugins();\n\n testConfig.ensurePluginsInstalled.forEach(async (pluginId) => {\n const isInstalled = pluginStatus.some((plugin) => plugin.plugin_id === pluginId);\n
|
|
1
|
+
{"version":3,"file":"plugins.js","sources":["../../src/server/plugins.ts"],"sourcesContent":["// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.\n// See LICENSE.txt for license information.\n\nimport {Client4} from '@mattermost/client';\nimport {PluginManifest} from '@mattermost/types/plugins';\nimport { expect } from '@playwright/test';\n\nimport {testConfig} from '@/test_config';\n\n// ensurePluginsLoaded is used to ensure all pluginIds including from testConfig.ensurePluginsInstalled are installed and active.\n// If any pluginId is not installed, test will fail.\n// testConfig.ensurePluginsInstalled can be derived from `PW_ENSURE_PLUGINS_INSTALLED` environment variable.\nexport async function ensurePluginsLoaded(client: Client4, pluginIds: string[] = []) {\n const pluginStatus = await client.getPluginStatuses();\n const plugins = await client.getPlugins();\n\n // Ensure all plugins are installed and active.\n // If not installed, test will fail.\n testConfig.ensurePluginsInstalled.concat(pluginIds).filter((pluginId) => Boolean(pluginId)).forEach(async (pluginId) => {\n const isInstalled = pluginStatus.some((plugin) => plugin.plugin_id === pluginId);\n\n // If not installed, test will fail.\n expect(isInstalled, `${pluginId} is not installed. Related test will fail.`).toBe(true);\n\n const isActive = plugins.active.some((plugin: PluginManifest) => plugin.id === pluginId);\n if (!isActive) {\n await client.enablePlugin(pluginId);\n\n // eslint-disable-next-line no-console\n console.log(`${pluginId} is installed and has been activated.`);\n } else {\n // eslint-disable-next-line no-console\n console.log(`${pluginId} is installed and active.`);\n }\n });\n}\n"],"names":["testConfig","expect"],"mappings":";;;;;AAAA;AACA;AAQA;AACA;AACA;AACO,eAAe,mBAAmB,CAAC,MAAe,EAAE,YAAsB,EAAE,EAAA;AAC/E,IAAA,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,iBAAiB,EAAE;AACrD,IAAA,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE;;;IAIzCA,sBAAU,CAAC,sBAAsB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,QAAQ,KAAI;AACnH,QAAA,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC;;AAGhF,QAAAC,WAAM,CAAC,WAAW,EAAE,CAAA,EAAG,QAAQ,CAAA,0CAAA,CAA4C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AAEvF,QAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAsB,KAAK,MAAM,CAAC,EAAE,KAAK,QAAQ,CAAC;QACxF,IAAI,CAAC,QAAQ,EAAE;AACX,YAAA,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC;;AAGnC,YAAA,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA,qCAAA,CAAuC,CAAC;;aAC5D;;AAEH,YAAA,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA,yBAAA,CAA2B,CAAC;;AAE3D,KAAC,CAAC;AACN;;;;"}
|
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.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Browser, Page } from '@playwright/test';
|
|
|
2
2
|
import { AxeResults } from 'axe-core';
|
|
3
3
|
import { AxeBuilder } from '@axe-core/playwright';
|
|
4
4
|
import { TestBrowser } from './browser_context';
|
|
5
|
-
import { ensureLicense, shouldHaveCallsEnabled, shouldHaveFeatureFlag, shouldRunInLinux, skipIfFeatureFlagNotSet, skipIfNoLicense } from './flag';
|
|
5
|
+
import { ensureLicense, ensureServerDeployment, shouldHaveCallsEnabled, shouldHaveFeatureFlag, shouldRunInLinux, skipIfFeatureFlagNotSet, skipIfNoLicense } from './flag';
|
|
6
6
|
import { getBlobFromAsset, getFileFromAsset } from './file';
|
|
7
7
|
import { createRandomChannel, createRandomPost, createRandomTeam, createRandomUser, ensurePluginsLoaded, getAdminClient, initSetup } from './server';
|
|
8
8
|
import { hideDynamicChannelsContent, waitForAnimationEnd } from './test_action';
|
|
@@ -25,6 +25,7 @@ export declare class PlaywrightExtended {
|
|
|
25
25
|
readonly shouldHaveFeatureFlag: typeof shouldHaveFeatureFlag;
|
|
26
26
|
readonly shouldRunInLinux: typeof shouldRunInLinux;
|
|
27
27
|
readonly ensureLicense: typeof ensureLicense;
|
|
28
|
+
readonly ensureServerDeployment: typeof ensureServerDeployment;
|
|
28
29
|
readonly skipIfNoLicense: typeof skipIfNoLicense;
|
|
29
30
|
readonly skipIfFeatureFlagNotSet: typeof skipIfFeatureFlagNotSet;
|
|
30
31
|
readonly getBlobFromAsset: typeof getBlobFromAsset;
|
package/dist/test_fixture.js
CHANGED
|
@@ -1,29 +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 plugins = require('./server/plugins.js');
|
|
14
|
-
var post = require('./server/post.js');
|
|
15
|
-
var team = require('./server/team.js');
|
|
16
|
-
var user = require('./server/user.js');
|
|
17
|
-
var test_action = require('./test_action.js');
|
|
18
|
-
var index = require('./ui/pages/index.js');
|
|
19
|
-
var index$1 = require('./visual/index.js');
|
|
20
|
-
var mock_browser_api = require('./mock_browser_api.js');
|
|
21
|
-
var util = require('./util.js');
|
|
22
|
-
var asyncWaitUntil = require('async-wait-until');
|
|
23
|
-
|
|
24
1
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
25
2
|
// See LICENSE.txt for license information.
|
|
26
|
-
|
|
3
|
+
import { test as base } from '@playwright/test';
|
|
4
|
+
import { AxeBuilder } from '@axe-core/playwright';
|
|
5
|
+
import { TestBrowser } from './browser_context';
|
|
6
|
+
import { ensureLicense, ensureServerDeployment, shouldHaveCallsEnabled, shouldHaveFeatureFlag, shouldRunInLinux, skipIfFeatureFlagNotSet, skipIfNoLicense, } from './flag';
|
|
7
|
+
import { getBlobFromAsset, getFileFromAsset } from './file';
|
|
8
|
+
import { createRandomChannel, createRandomPost, createRandomTeam, createRandomUser, ensurePluginsLoaded, 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({
|
|
27
16
|
// eslint-disable-next-line no-empty-pattern
|
|
28
17
|
axe: async ({}, use) => {
|
|
29
18
|
const ab = new AxeBuilderExtended();
|
|
@@ -35,7 +24,7 @@ const test = test$1.test.extend({
|
|
|
35
24
|
await pw.testBrowser.close();
|
|
36
25
|
},
|
|
37
26
|
});
|
|
38
|
-
class PlaywrightExtended {
|
|
27
|
+
export class PlaywrightExtended {
|
|
39
28
|
// ./browser_context
|
|
40
29
|
testBrowser;
|
|
41
30
|
// ./flag
|
|
@@ -43,6 +32,7 @@ class PlaywrightExtended {
|
|
|
43
32
|
shouldHaveFeatureFlag;
|
|
44
33
|
shouldRunInLinux;
|
|
45
34
|
ensureLicense;
|
|
35
|
+
ensureServerDeployment;
|
|
46
36
|
skipIfNoLicense;
|
|
47
37
|
skipIfFeatureFlagNotSet;
|
|
48
38
|
// ./file
|
|
@@ -75,45 +65,46 @@ class PlaywrightExtended {
|
|
|
75
65
|
hasSeenLandingPage;
|
|
76
66
|
constructor(browser, page, isMobile) {
|
|
77
67
|
// ./browser_context
|
|
78
|
-
this.testBrowser = new
|
|
68
|
+
this.testBrowser = new TestBrowser(browser);
|
|
79
69
|
// ./flag
|
|
80
|
-
this.shouldHaveCallsEnabled =
|
|
81
|
-
this.shouldHaveFeatureFlag =
|
|
82
|
-
this.shouldRunInLinux =
|
|
83
|
-
this.ensureLicense =
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
70
|
+
this.shouldHaveCallsEnabled = shouldHaveCallsEnabled;
|
|
71
|
+
this.shouldHaveFeatureFlag = shouldHaveFeatureFlag;
|
|
72
|
+
this.shouldRunInLinux = shouldRunInLinux;
|
|
73
|
+
this.ensureLicense = ensureLicense;
|
|
74
|
+
this.ensureServerDeployment = ensureServerDeployment;
|
|
75
|
+
this.skipIfNoLicense = skipIfNoLicense;
|
|
76
|
+
this.skipIfFeatureFlagNotSet = skipIfFeatureFlagNotSet;
|
|
86
77
|
// ./file
|
|
87
|
-
this.getBlobFromAsset =
|
|
88
|
-
this.getFileFromAsset =
|
|
78
|
+
this.getBlobFromAsset = getBlobFromAsset;
|
|
79
|
+
this.getFileFromAsset = getFileFromAsset;
|
|
89
80
|
// ./server
|
|
90
|
-
this.ensurePluginsLoaded =
|
|
91
|
-
this.initSetup =
|
|
92
|
-
this.getAdminClient =
|
|
81
|
+
this.ensurePluginsLoaded = ensurePluginsLoaded;
|
|
82
|
+
this.initSetup = initSetup;
|
|
83
|
+
this.getAdminClient = getAdminClient;
|
|
93
84
|
// ./test_action
|
|
94
|
-
this.hideDynamicChannelsContent =
|
|
95
|
-
this.waitForAnimationEnd =
|
|
96
|
-
this.waitUntil =
|
|
85
|
+
this.hideDynamicChannelsContent = hideDynamicChannelsContent;
|
|
86
|
+
this.waitForAnimationEnd = waitForAnimationEnd;
|
|
87
|
+
this.waitUntil = waitUntil;
|
|
97
88
|
// unauthenticated page
|
|
98
|
-
this.loginPage = new
|
|
99
|
-
this.landingLoginPage = new
|
|
100
|
-
this.signupPage = new
|
|
101
|
-
this.resetPasswordPage = new
|
|
89
|
+
this.loginPage = new pages.LoginPage(page);
|
|
90
|
+
this.landingLoginPage = new pages.LandingLoginPage(page, isMobile);
|
|
91
|
+
this.signupPage = new pages.SignupPage(page);
|
|
92
|
+
this.resetPasswordPage = new pages.ResetPasswordPage(page);
|
|
102
93
|
// ./mock_browser_api
|
|
103
|
-
this.stubNotification =
|
|
104
|
-
this.waitForNotification =
|
|
94
|
+
this.stubNotification = stubNotification;
|
|
95
|
+
this.waitForNotification = waitForNotification;
|
|
105
96
|
// ./visual
|
|
106
|
-
this.matchSnapshot =
|
|
97
|
+
this.matchSnapshot = matchSnapshot;
|
|
107
98
|
// ./util
|
|
108
|
-
this.duration =
|
|
109
|
-
this.wait =
|
|
110
|
-
this.simpleEmailRe =
|
|
99
|
+
this.duration = duration;
|
|
100
|
+
this.wait = wait;
|
|
101
|
+
this.simpleEmailRe = simpleEmailRe;
|
|
111
102
|
this.random = {
|
|
112
|
-
id:
|
|
113
|
-
channel:
|
|
114
|
-
post:
|
|
115
|
-
team:
|
|
116
|
-
user:
|
|
103
|
+
id: getRandomId,
|
|
104
|
+
channel: createRandomChannel,
|
|
105
|
+
post: createRandomPost,
|
|
106
|
+
team: createRandomTeam,
|
|
107
|
+
user: createRandomUser,
|
|
117
108
|
};
|
|
118
109
|
this.hasSeenLandingPage = async () => {
|
|
119
110
|
// Visit the base URL to be able to set the localStorage
|
|
@@ -122,7 +113,7 @@ class PlaywrightExtended {
|
|
|
122
113
|
};
|
|
123
114
|
}
|
|
124
115
|
}
|
|
125
|
-
class AxeBuilderExtended {
|
|
116
|
+
export class AxeBuilderExtended {
|
|
126
117
|
builder;
|
|
127
118
|
// See https://github.com/dequelabs/axe-core/blob/master/doc/API.md#axe-core-tags
|
|
128
119
|
tags = ['wcag2a', 'wcag2aa'];
|
|
@@ -140,7 +131,7 @@ class AxeBuilderExtended {
|
|
|
140
131
|
// Option: make use of custom theme to improve color contrast.
|
|
141
132
|
disabledRules.push('link-in-text-block');
|
|
142
133
|
}
|
|
143
|
-
return new
|
|
134
|
+
return new AxeBuilder({ page }).withTags(this.tags).disableRules(disabledRules);
|
|
144
135
|
};
|
|
145
136
|
}
|
|
146
137
|
violationFingerprints(accessibilityScanResults) {
|
|
@@ -155,8 +146,8 @@ class AxeBuilderExtended {
|
|
|
155
146
|
return JSON.stringify(fingerprints, null, 2);
|
|
156
147
|
}
|
|
157
148
|
}
|
|
158
|
-
async function waitUntilLocalStorageIsSet(page, key, value, timeout =
|
|
159
|
-
await
|
|
149
|
+
async function waitUntilLocalStorageIsSet(page, key, value, timeout = duration.ten_sec) {
|
|
150
|
+
await waitUntil(() => page.evaluate(({ key, value }) => {
|
|
160
151
|
if (localStorage.getItem(key) === value) {
|
|
161
152
|
return true;
|
|
162
153
|
}
|
|
@@ -164,12 +155,3 @@ async function waitUntilLocalStorageIsSet(page, key, value, timeout = util.durat
|
|
|
164
155
|
return false;
|
|
165
156
|
}, { key, value }), { timeout });
|
|
166
157
|
}
|
|
167
|
-
|
|
168
|
-
Object.defineProperty(exports, "expect", {
|
|
169
|
-
enumerable: true,
|
|
170
|
-
get: function () { return test$1.expect; }
|
|
171
|
-
});
|
|
172
|
-
exports.AxeBuilderExtended = AxeBuilderExtended;
|
|
173
|
-
exports.PlaywrightExtended = PlaywrightExtended;
|
|
174
|
-
exports.test = test;
|
|
175
|
-
//# sourceMappingURL=test_fixture.js.map
|