@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.
Files changed (75) hide show
  1. package/dist/browser_context.js +14 -21
  2. package/dist/constant.js +3 -6
  3. package/dist/file.js +20 -20
  4. package/dist/flag.d.ts +2 -0
  5. package/dist/flag.js +49 -38
  6. package/dist/flag.js.map +1 -1
  7. package/dist/global_setup.js +14 -49
  8. package/dist/global_setup.js.map +1 -1
  9. package/dist/index.js +9 -42
  10. package/dist/mock_browser_api.js +2 -8
  11. package/dist/server/channel.js +3 -9
  12. package/dist/server/client.js +10 -16
  13. package/dist/server/default_config.js +9 -15
  14. package/dist/server/init.js +29 -36
  15. package/dist/server/plugins.d.ts +1 -1
  16. package/dist/server/plugins.js +13 -14
  17. package/dist/server/plugins.js.map +1 -1
  18. package/dist/server/post.js +3 -9
  19. package/dist/server/team.js +3 -9
  20. package/dist/server/user.js +8 -15
  21. package/dist/test_action.js +3 -14
  22. package/dist/test_config.js +4 -30
  23. package/dist/test_fixture.d.ts +2 -1
  24. package/dist/test_fixture.js +50 -68
  25. package/dist/test_fixture.js.map +1 -1
  26. package/dist/ui/components/channels/app_bar.js +3 -9
  27. package/dist/ui/components/channels/center_view.js +22 -28
  28. package/dist/ui/components/channels/delete_post_confirmation_dialog.js +8 -14
  29. package/dist/ui/components/channels/delete_post_modal.js +4 -10
  30. package/dist/ui/components/channels/emoji_gif_picker.js +9 -15
  31. package/dist/ui/components/channels/find_channels_modal.js +3 -9
  32. package/dist/ui/components/channels/generic_confirm_modal.js +5 -11
  33. package/dist/ui/components/channels/header.js +3 -9
  34. package/dist/ui/components/channels/message_priority.js +14 -20
  35. package/dist/ui/components/channels/post.js +10 -16
  36. package/dist/ui/components/channels/post_create.js +23 -29
  37. package/dist/ui/components/channels/post_dot_menu.js +3 -9
  38. package/dist/ui/components/channels/post_edit.js +16 -22
  39. package/dist/ui/components/channels/post_menu.js +3 -9
  40. package/dist/ui/components/channels/post_reminder_menu.js +3 -9
  41. package/dist/ui/components/channels/restore_post_confirmation_dialog.js +6 -12
  42. package/dist/ui/components/channels/scheduled_draft_menu.js +3 -9
  43. package/dist/ui/components/channels/scheduled_draft_modal.js +4 -10
  44. package/dist/ui/components/channels/search_popover.js +3 -9
  45. package/dist/ui/components/channels/settings/notification_settings.js +8 -14
  46. package/dist/ui/components/channels/settings/settings_modal.js +7 -13
  47. package/dist/ui/components/channels/sidebar_left.js +8 -14
  48. package/dist/ui/components/channels/sidebar_right.js +20 -26
  49. package/dist/ui/components/channels/thread_footer.js +3 -9
  50. package/dist/ui/components/channels/user_profile_popover.js +3 -9
  51. package/dist/ui/components/footer.js +3 -9
  52. package/dist/ui/components/global_header.js +7 -13
  53. package/dist/ui/components/index.js +72 -74
  54. package/dist/ui/components/main_header.js +3 -9
  55. package/dist/ui/components/system_console/navbar.js +3 -9
  56. package/dist/ui/components/system_console/sections/system_users/column_toggle_menu.js +4 -10
  57. package/dist/ui/components/system_console/sections/system_users/feature_discovery.js +4 -10
  58. package/dist/ui/components/system_console/sections/system_users/filter_menu.js +3 -9
  59. package/dist/ui/components/system_console/sections/system_users/filter_popover.js +8 -14
  60. package/dist/ui/components/system_console/sections/system_users/mobile_security.js +3 -9
  61. package/dist/ui/components/system_console/sections/system_users/system_users.js +10 -16
  62. package/dist/ui/components/system_console/sidebar.js +4 -10
  63. package/dist/ui/pages/channels.js +18 -24
  64. package/dist/ui/pages/drafts.js +17 -23
  65. package/dist/ui/pages/index.js +17 -30
  66. package/dist/ui/pages/landing_login.js +5 -11
  67. package/dist/ui/pages/login.js +8 -14
  68. package/dist/ui/pages/reset_password.js +9 -15
  69. package/dist/ui/pages/scheduled_draft.js +19 -25
  70. package/dist/ui/pages/signup.js +11 -17
  71. package/dist/ui/pages/system_console.js +16 -22
  72. package/dist/util.js +8 -19
  73. package/dist/visual/index.js +14 -20
  74. package/dist/visual/percy.js +4 -10
  75. package/package.json +1 -1
@@ -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$1 = new client.Client4();
12
- client$1.setUrl(test_config.testConfig.baseURL);
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: client$1, user: null };
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$1.login(userRequest.username, userRequest.password);
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: client$1, user };
21
+ clients[cacheKey] = { client, user };
25
22
  }
26
- return { client: client$1, user };
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: client$1, user: null };
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
- function getOnPremServerConfig() {
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: test_config.testConfig.haClusterEnabled,
17
- ClusterName: test_config.testConfig.haClusterName,
13
+ Enable: testConfig.haClusterEnabled,
14
+ ClusterName: testConfig.haClusterName,
18
15
  },
19
16
  EmailSettings: {
20
- PushNotificationServer: test_config.testConfig.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: test_config.testConfig.baseURL,
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: config.CollapsedThreads.ALWAYS_ON,
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
@@ -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
- async function initSetup({ userPrefix = 'user', teamPrefix = { name: 'team', displayName: 'Team' }, withDefaultProfileImage = true, } = {}) {
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(default_config.getOnPremServerConfig());
21
+ const adminConfig = await adminClient.updateConfig(getOnPremServerConfig());
25
22
  // Create new team
26
- const team$1 = await adminClient.createTeam(team.createRandomTeam(teamPrefix.name, teamPrefix.displayName));
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 = 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);
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 client.makeClient(user$1);
30
+ const { client: userClient } = await makeClient(user);
34
31
  if (withDefaultProfileImage) {
35
- const file$1 = file.getFileFromCommonAsset('mattermost-icon_128x128.png');
36
- await userClient.uploadProfileImage(user$1.id, file$1);
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$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' },
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$1.id, preferences);
40
+ await userClient.savePreferences(user.id, preferences);
44
41
  return {
45
42
  adminClient,
46
43
  adminUser,
47
44
  adminConfig,
48
- user: user$1,
45
+ user,
49
46
  userClient,
50
- team: team$1,
51
- offTopicUrl: getUrl(team$1.name, 'off-topic'),
52
- townSquareUrl: getUrl(team$1.name, 'town-square'),
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
- test.expect(error, 'Should not throw an error').toBeFalsy();
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 client.makeClient({
62
- username: test_config.testConfig.adminUsername,
63
- password: test_config.testConfig.adminPassword,
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
@@ -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>;
@@ -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
- async function ensurePluginsLoaded(client) {
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
- test_config.testConfig.ensurePluginsInstalled.forEach(async (pluginId) => {
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
- if (!isInstalled) {
13
- // eslint-disable-next-line no-console
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 if (!isInstalled) {\n // eslint-disable-next-line no-console\n console.log(`${pluginId} is not installed. Related visual test will fail.`);\n return;\n }\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"],"mappings":";;;;AAAA;AACA;AAOO,eAAe,mBAAmB,CAAC,MAAe,EAAA;AACrD,IAAA,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,iBAAiB,EAAE;AACrD,IAAA,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE;IAEzCA,sBAAU,CAAC,sBAAsB,CAAC,OAAO,CAAC,OAAO,QAAQ,KAAI;AACzD,QAAA,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC;QAChF,IAAI,CAAC,WAAW,EAAE;;AAEd,YAAA,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA,iDAAA,CAAmD,CAAC;YAC3E;;AAGJ,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;;;;"}
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;;;;"}
@@ -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
- function createRandomPost(post) {
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 ?? ''}${util.getRandomId()}`,
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
@@ -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
- function createRandomTeam(name = 'team', displayName = 'Team', type = 'O', unique = true) {
8
- const randomSuffix = util.getRandomId();
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
@@ -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
- function createRandomUser(prefix = 'user') {
9
- const randomId = util.getRandomId();
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: test_config.testConfig.adminUsername,
23
- password: test_config.testConfig.adminPassword,
19
+ username: testConfig.adminUsername,
20
+ password: testConfig.adminPassword,
24
21
  first_name: 'Kenneth',
25
22
  last_name: 'Moreno',
26
- email: test_config.testConfig.adminEmail,
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
@@ -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
@@ -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
- dotenv__namespace.config();
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
@@ -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;
@@ -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
- const test = test$1.test.extend({
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 browser_context.TestBrowser(browser);
68
+ this.testBrowser = new TestBrowser(browser);
79
69
  // ./flag
80
- this.shouldHaveCallsEnabled = flag.shouldHaveCallsEnabled;
81
- this.shouldHaveFeatureFlag = flag.shouldHaveFeatureFlag;
82
- this.shouldRunInLinux = flag.shouldRunInLinux;
83
- this.ensureLicense = flag.ensureLicense;
84
- this.skipIfNoLicense = flag.skipIfNoLicense;
85
- this.skipIfFeatureFlagNotSet = flag.skipIfFeatureFlagNotSet;
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 = file.getBlobFromAsset;
88
- this.getFileFromAsset = file.getFileFromAsset;
78
+ this.getBlobFromAsset = getBlobFromAsset;
79
+ this.getFileFromAsset = getFileFromAsset;
89
80
  // ./server
90
- this.ensurePluginsLoaded = plugins.ensurePluginsLoaded;
91
- this.initSetup = init.initSetup;
92
- this.getAdminClient = init.getAdminClient;
81
+ this.ensurePluginsLoaded = ensurePluginsLoaded;
82
+ this.initSetup = initSetup;
83
+ this.getAdminClient = getAdminClient;
93
84
  // ./test_action
94
- this.hideDynamicChannelsContent = test_action.hideDynamicChannelsContent;
95
- this.waitForAnimationEnd = test_action.waitForAnimationEnd;
96
- this.waitUntil = asyncWaitUntil.waitUntil;
85
+ this.hideDynamicChannelsContent = hideDynamicChannelsContent;
86
+ this.waitForAnimationEnd = waitForAnimationEnd;
87
+ this.waitUntil = waitUntil;
97
88
  // unauthenticated page
98
- this.loginPage = new index.pages.LoginPage(page);
99
- this.landingLoginPage = new index.pages.LandingLoginPage(page, isMobile);
100
- this.signupPage = new index.pages.SignupPage(page);
101
- this.resetPasswordPage = new index.pages.ResetPasswordPage(page);
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 = mock_browser_api.stubNotification;
104
- this.waitForNotification = mock_browser_api.waitForNotification;
94
+ this.stubNotification = stubNotification;
95
+ this.waitForNotification = waitForNotification;
105
96
  // ./visual
106
- this.matchSnapshot = index$1.matchSnapshot;
97
+ this.matchSnapshot = matchSnapshot;
107
98
  // ./util
108
- this.duration = util.duration;
109
- this.wait = util.wait;
110
- this.simpleEmailRe = util.simpleEmailRe;
99
+ this.duration = duration;
100
+ this.wait = wait;
101
+ this.simpleEmailRe = simpleEmailRe;
111
102
  this.random = {
112
- id: util.getRandomId,
113
- channel: channel.createRandomChannel,
114
- post: post.createRandomPost,
115
- team: team.createRandomTeam,
116
- user: user.createRandomUser,
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 playwright.AxeBuilder({ page }).withTags(this.tags).disableRules(disabledRules);
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 = util.duration.ten_sec) {
159
- await asyncWaitUntil.waitUntil(() => page.evaluate(({ key, value }) => {
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