@mattermost/playwright-lib 10.7.0-1 → 10.7.0-3

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 (79) hide show
  1. package/dist/browser_context.js +21 -14
  2. package/dist/constant.js +6 -3
  3. package/dist/file.js +20 -20
  4. package/dist/flag.d.ts +2 -2
  5. package/dist/flag.js +77 -35
  6. package/dist/flag.js.map +1 -1
  7. package/dist/global_setup.js +24 -14
  8. package/dist/global_setup.js.map +1 -1
  9. package/dist/index.js +42 -9
  10. package/dist/mock_browser_api.js +8 -2
  11. package/dist/server/channel.js +9 -3
  12. package/dist/server/client.js +16 -10
  13. package/dist/server/default_config.js +15 -9
  14. package/dist/server/index.d.ts +0 -1
  15. package/dist/server/init.js +36 -29
  16. package/dist/server/post.js +9 -3
  17. package/dist/server/team.js +9 -3
  18. package/dist/server/user.js +15 -8
  19. package/dist/test_action.js +14 -3
  20. package/dist/test_config.js +30 -4
  21. package/dist/test_fixture.d.ts +2 -2
  22. package/dist/test_fixture.js +68 -49
  23. package/dist/test_fixture.js.map +1 -1
  24. package/dist/ui/components/channels/app_bar.js +9 -3
  25. package/dist/ui/components/channels/center_view.js +28 -22
  26. package/dist/ui/components/channels/delete_post_confirmation_dialog.js +14 -8
  27. package/dist/ui/components/channels/delete_post_modal.js +10 -4
  28. package/dist/ui/components/channels/emoji_gif_picker.js +15 -9
  29. package/dist/ui/components/channels/find_channels_modal.js +9 -3
  30. package/dist/ui/components/channels/generic_confirm_modal.js +11 -5
  31. package/dist/ui/components/channels/header.js +9 -3
  32. package/dist/ui/components/channels/message_priority.js +20 -14
  33. package/dist/ui/components/channels/post.js +16 -10
  34. package/dist/ui/components/channels/post_create.js +29 -23
  35. package/dist/ui/components/channels/post_dot_menu.js +9 -3
  36. package/dist/ui/components/channels/post_edit.js +22 -16
  37. package/dist/ui/components/channels/post_menu.js +9 -3
  38. package/dist/ui/components/channels/post_reminder_menu.js +9 -3
  39. package/dist/ui/components/channels/restore_post_confirmation_dialog.js +12 -6
  40. package/dist/ui/components/channels/scheduled_draft_menu.js +9 -3
  41. package/dist/ui/components/channels/scheduled_draft_modal.js +10 -4
  42. package/dist/ui/components/channels/search_popover.js +9 -3
  43. package/dist/ui/components/channels/settings/notification_settings.js +14 -8
  44. package/dist/ui/components/channels/settings/settings_modal.js +13 -7
  45. package/dist/ui/components/channels/sidebar_left.js +14 -8
  46. package/dist/ui/components/channels/sidebar_right.js +26 -20
  47. package/dist/ui/components/channels/thread_footer.js +9 -3
  48. package/dist/ui/components/channels/user_profile_popover.js +9 -3
  49. package/dist/ui/components/footer.js +9 -3
  50. package/dist/ui/components/global_header.js +13 -7
  51. package/dist/ui/components/index.js +74 -72
  52. package/dist/ui/components/main_header.js +9 -3
  53. package/dist/ui/components/system_console/navbar.js +9 -3
  54. package/dist/ui/components/system_console/sections/system_users/column_toggle_menu.js +10 -4
  55. package/dist/ui/components/system_console/sections/system_users/feature_discovery.js +10 -4
  56. package/dist/ui/components/system_console/sections/system_users/filter_menu.js +9 -3
  57. package/dist/ui/components/system_console/sections/system_users/filter_popover.js +14 -8
  58. package/dist/ui/components/system_console/sections/system_users/mobile_security.js +9 -3
  59. package/dist/ui/components/system_console/sections/system_users/system_users.js +16 -10
  60. package/dist/ui/components/system_console/sidebar.js +10 -4
  61. package/dist/ui/pages/channels.js +24 -18
  62. package/dist/ui/pages/drafts.js +23 -17
  63. package/dist/ui/pages/index.js +30 -17
  64. package/dist/ui/pages/landing_login.js +11 -5
  65. package/dist/ui/pages/login.js +14 -8
  66. package/dist/ui/pages/reset_password.js +15 -9
  67. package/dist/ui/pages/scheduled_draft.js +25 -19
  68. package/dist/ui/pages/signup.js +17 -11
  69. package/dist/ui/pages/system_console.js +22 -16
  70. package/dist/util.js +19 -8
  71. package/dist/visual/index.js +20 -14
  72. package/dist/visual/percy.js +10 -4
  73. package/package.json +1 -1
  74. package/dist/server/index.js +0 -10
  75. package/dist/server/plugins.d.ts +0 -2
  76. package/dist/server/plugins.js +0 -30
  77. package/dist/server/plugins.js.map +0 -1
  78. package/dist/tsconfig.tsbuildinfo +0 -1
  79. package/dist/types.js +0 -3
@@ -1,26 +1,29 @@
1
+ 'use strict';
2
+
3
+ var client = require('@mattermost/client');
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
- import { Client4 } from '@mattermost/client';
4
- import { testConfig } from '@/test_config';
5
8
  // Variable to hold cache
6
9
  const clients = {};
7
- export async function makeClient(userRequest, opts = { useCache: true, skipLog: false }) {
8
- const client = new Client4();
9
- client.setUrl(testConfig.baseURL);
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);
10
13
  try {
11
14
  if (!userRequest) {
12
- return { client, user: null };
15
+ return { client: client$1, user: null };
13
16
  }
14
17
  const cacheKey = userRequest.username + userRequest.password;
15
18
  if (opts?.useCache && clients[cacheKey] != null) {
16
19
  return clients[cacheKey];
17
20
  }
18
- const userProfile = await client.login(userRequest.username, userRequest.password);
21
+ const userProfile = await client$1.login(userRequest.username, userRequest.password);
19
22
  const user = { ...userProfile, password: userRequest.password };
20
23
  if (opts?.useCache) {
21
- clients[cacheKey] = { client, user };
24
+ clients[cacheKey] = { client: client$1, user };
22
25
  }
23
- return { client, user };
26
+ return { client: client$1, user };
24
27
  }
25
28
  catch (err) {
26
29
  if (!opts?.skipLog) {
@@ -28,6 +31,9 @@ export async function makeClient(userRequest, opts = { useCache: true, skipLog:
28
31
  // eslint-disable-next-line no-console
29
32
  console.log('makeClient', err);
30
33
  }
31
- return { client, user: null };
34
+ return { client: client$1, user: null };
32
35
  }
33
36
  }
37
+
38
+ exports.makeClient = makeClient;
39
+ //# sourceMappingURL=client.js.map
@@ -1,20 +1,23 @@
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
+
1
7
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
8
  // See LICENSE.txt for license information.
3
- import merge from 'deepmerge';
4
- import { CollapsedThreads, } from '@mattermost/types/config';
5
- import { testConfig } from '@/test_config';
6
- export function getOnPremServerConfig() {
9
+ function getOnPremServerConfig() {
7
10
  return merge(defaultServerConfig, onPremServerConfig());
8
11
  }
9
12
  // On-prem setting that is different from the default
10
13
  const onPremServerConfig = () => {
11
14
  return {
12
15
  ClusterSettings: {
13
- Enable: testConfig.haClusterEnabled,
14
- ClusterName: testConfig.haClusterName,
16
+ Enable: test_config.testConfig.haClusterEnabled,
17
+ ClusterName: test_config.testConfig.haClusterName,
15
18
  },
16
19
  EmailSettings: {
17
- PushNotificationServer: testConfig.pushNotificationServer,
20
+ PushNotificationServer: test_config.testConfig.pushNotificationServer,
18
21
  },
19
22
  LogSettings: {
20
23
  EnableDiagnostics: false,
@@ -42,7 +45,7 @@ const onPremServerConfig = () => {
42
45
  },
43
46
  },
44
47
  ServiceSettings: {
45
- SiteURL: testConfig.baseURL,
48
+ SiteURL: test_config.testConfig.baseURL,
46
49
  EnableOnboardingFlow: false,
47
50
  EnableSecurityFixAlert: false,
48
51
  GiphySdkKey: 's0glxvzVg9azvPipKxcPLpXV0q1x1fVP',
@@ -164,7 +167,7 @@ const defaultServerConfig = {
164
167
  FeatureFlagSyncIntervalSeconds: 30,
165
168
  DebugSplit: false,
166
169
  ThreadAutoFollow: true,
167
- CollapsedThreads: CollapsedThreads.ALWAYS_ON,
170
+ CollapsedThreads: config.CollapsedThreads.ALWAYS_ON,
168
171
  ManagedResourcePaths: '',
169
172
  EnableCustomGroups: true,
170
173
  AllowSyncedDrafts: true,
@@ -754,3 +757,6 @@ const defaultServerConfig = {
754
757
  MaxPostsPerSync: 50,
755
758
  },
756
759
  };
760
+
761
+ exports.getOnPremServerConfig = getOnPremServerConfig;
762
+ //# sourceMappingURL=default_config.js.map
@@ -2,7 +2,6 @@ export { makeClient } from './client';
2
2
  export { createRandomChannel } from './channel';
3
3
  export { getOnPremServerConfig } from './default_config';
4
4
  export { initSetup, getAdminClient } from './init';
5
- export { ensurePluginsLoaded } from './plugins';
6
5
  export { createRandomPost } from './post';
7
6
  export { createRandomTeam } from './team';
8
7
  export { createRandomUser, getDefaultAdminUser } from './user';
@@ -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
- 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, } = {}) {
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
- export async function getAdminClient(opts = { skipLog: false }) {
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
@@ -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
- import { getRandomId } from '@/util';
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
@@ -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
- import { getRandomId } from '@/util';
4
- export function createRandomTeam(name = 'team', displayName = 'Team', type = 'O', unique = true) {
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
@@ -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
- import { getRandomId } from '@/util';
4
- import { testConfig } from '@/test_config';
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
- export function getDefaultAdminUser() {
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
@@ -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
- export async function hideDynamicChannelsContent(page) {
11
+ async function hideDynamicChannelsContent(page) {
9
12
  await page.addStyleTag({ content: hideTeamHeader + hidePostHeaderTime + hidePostProfileIcon });
10
13
  }
11
- export async function waitForAnimationEnd(locator) {
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
@@ -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
- import * as dotenv from 'dotenv';
4
- dotenv.config();
26
+ dotenv__namespace.config();
5
27
  // All process.env should be defined here
6
- export class TestConfig {
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
- export const testConfig = new TestConfig();
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
@@ -2,9 +2,9 @@ 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, ensureServerDeployment, shouldHaveCallsEnabled, shouldHaveFeatureFlag, shouldRunInLinux, skipIfFeatureFlagNotSet, skipIfNoLicense } from './flag';
5
+ import { ensureLicense, ensurePluginsLoaded, ensureServerDeployment, shouldHaveCallsEnabled, shouldHaveFeatureFlag, shouldRunInLinux, skipIfFeatureFlagNotSet, skipIfNoLicense } from './flag';
6
6
  import { getBlobFromAsset, getFileFromAsset } from './file';
7
- import { createRandomChannel, createRandomPost, createRandomTeam, createRandomUser, ensurePluginsLoaded, getAdminClient, initSetup } from './server';
7
+ import { createRandomChannel, createRandomPost, createRandomTeam, createRandomUser, getAdminClient, initSetup } from './server';
8
8
  import { hideDynamicChannelsContent, waitForAnimationEnd } from './test_action';
9
9
  import { matchSnapshot } from './visual';
10
10
  import { stubNotification, waitForNotification } from './mock_browser_api';
@@ -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
- 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({
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
- export class PlaywrightExtended {
37
+ class PlaywrightExtended {
28
38
  // ./browser_context
29
39
  testBrowser;
30
40
  // ./flag
@@ -65,46 +75,46 @@ export class PlaywrightExtended {
65
75
  hasSeenLandingPage;
66
76
  constructor(browser, page, isMobile) {
67
77
  // ./browser_context
68
- this.testBrowser = new TestBrowser(browser);
78
+ this.testBrowser = new browser_context.TestBrowser(browser);
69
79
  // ./flag
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;
80
+ this.shouldHaveCallsEnabled = flag.shouldHaveCallsEnabled;
81
+ this.shouldHaveFeatureFlag = flag.shouldHaveFeatureFlag;
82
+ this.shouldRunInLinux = flag.shouldRunInLinux;
83
+ this.ensureLicense = flag.ensureLicense;
84
+ this.ensureServerDeployment = flag.ensureServerDeployment;
85
+ this.skipIfNoLicense = flag.skipIfNoLicense;
86
+ this.skipIfFeatureFlagNotSet = flag.skipIfFeatureFlagNotSet;
77
87
  // ./file
78
- this.getBlobFromAsset = getBlobFromAsset;
79
- this.getFileFromAsset = getFileFromAsset;
88
+ this.getBlobFromAsset = file.getBlobFromAsset;
89
+ this.getFileFromAsset = file.getFileFromAsset;
80
90
  // ./server
81
- this.ensurePluginsLoaded = ensurePluginsLoaded;
82
- this.initSetup = initSetup;
83
- this.getAdminClient = getAdminClient;
91
+ this.ensurePluginsLoaded = flag.ensurePluginsLoaded;
92
+ this.initSetup = init.initSetup;
93
+ this.getAdminClient = init.getAdminClient;
84
94
  // ./test_action
85
- this.hideDynamicChannelsContent = hideDynamicChannelsContent;
86
- this.waitForAnimationEnd = waitForAnimationEnd;
87
- this.waitUntil = waitUntil;
95
+ this.hideDynamicChannelsContent = test_action.hideDynamicChannelsContent;
96
+ this.waitForAnimationEnd = test_action.waitForAnimationEnd;
97
+ this.waitUntil = asyncWaitUntil.waitUntil;
88
98
  // unauthenticated 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);
99
+ this.loginPage = new index.pages.LoginPage(page);
100
+ this.landingLoginPage = new index.pages.LandingLoginPage(page, isMobile);
101
+ this.signupPage = new index.pages.SignupPage(page);
102
+ this.resetPasswordPage = new index.pages.ResetPasswordPage(page);
93
103
  // ./mock_browser_api
94
- this.stubNotification = stubNotification;
95
- this.waitForNotification = waitForNotification;
104
+ this.stubNotification = mock_browser_api.stubNotification;
105
+ this.waitForNotification = mock_browser_api.waitForNotification;
96
106
  // ./visual
97
- this.matchSnapshot = matchSnapshot;
107
+ this.matchSnapshot = index$1.matchSnapshot;
98
108
  // ./util
99
- this.duration = duration;
100
- this.wait = wait;
101
- this.simpleEmailRe = simpleEmailRe;
109
+ this.duration = util.duration;
110
+ this.wait = util.wait;
111
+ this.simpleEmailRe = util.simpleEmailRe;
102
112
  this.random = {
103
- id: getRandomId,
104
- channel: createRandomChannel,
105
- post: createRandomPost,
106
- team: createRandomTeam,
107
- user: createRandomUser,
113
+ id: util.getRandomId,
114
+ channel: channel.createRandomChannel,
115
+ post: post.createRandomPost,
116
+ team: team.createRandomTeam,
117
+ user: user.createRandomUser,
108
118
  };
109
119
  this.hasSeenLandingPage = async () => {
110
120
  // Visit the base URL to be able to set the localStorage
@@ -113,7 +123,7 @@ export class PlaywrightExtended {
113
123
  };
114
124
  }
115
125
  }
116
- export class AxeBuilderExtended {
126
+ class AxeBuilderExtended {
117
127
  builder;
118
128
  // See https://github.com/dequelabs/axe-core/blob/master/doc/API.md#axe-core-tags
119
129
  tags = ['wcag2a', 'wcag2aa'];
@@ -131,7 +141,7 @@ export class AxeBuilderExtended {
131
141
  // Option: make use of custom theme to improve color contrast.
132
142
  disabledRules.push('link-in-text-block');
133
143
  }
134
- return new AxeBuilder({ page }).withTags(this.tags).disableRules(disabledRules);
144
+ return new playwright.AxeBuilder({ page }).withTags(this.tags).disableRules(disabledRules);
135
145
  };
136
146
  }
137
147
  violationFingerprints(accessibilityScanResults) {
@@ -146,8 +156,8 @@ export class AxeBuilderExtended {
146
156
  return JSON.stringify(fingerprints, null, 2);
147
157
  }
148
158
  }
149
- async function waitUntilLocalStorageIsSet(page, key, value, timeout = duration.ten_sec) {
150
- await waitUntil(() => page.evaluate(({ key, value }) => {
159
+ async function waitUntilLocalStorageIsSet(page, key, value, timeout = util.duration.ten_sec) {
160
+ await asyncWaitUntil.waitUntil(() => page.evaluate(({ key, value }) => {
151
161
  if (localStorage.getItem(key) === value) {
152
162
  return true;
153
163
  }
@@ -155,3 +165,12 @@ async function waitUntilLocalStorageIsSet(page, key, value, timeout = duration.t
155
165
  return false;
156
166
  }, { key, value }), { timeout });
157
167
  }
168
+
169
+ Object.defineProperty(exports, "expect", {
170
+ enumerable: true,
171
+ get: function () { return test$1.expect; }
172
+ });
173
+ exports.AxeBuilderExtended = AxeBuilderExtended;
174
+ exports.PlaywrightExtended = PlaywrightExtended;
175
+ exports.test = test;
176
+ //# sourceMappingURL=test_fixture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test_fixture.js","sources":["../src/test_fixture.ts"],"sourcesContent":["// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.\n// See LICENSE.txt for license information.\n\nimport {Browser, Page, test as base} from '@playwright/test';\nimport {AxeResults} from 'axe-core';\nimport {AxeBuilder} from '@axe-core/playwright';\n\nimport {TestBrowser} from './browser_context';\nimport {\n ensureLicense,\n ensureServerDeployment,\n shouldHaveCallsEnabled,\n shouldHaveFeatureFlag,\n shouldRunInLinux,\n skipIfFeatureFlagNotSet,\n skipIfNoLicense,\n} from './flag';\nimport {getBlobFromAsset, getFileFromAsset} from './file';\nimport {\n createRandomChannel,\n createRandomPost,\n createRandomTeam,\n createRandomUser,\n ensurePluginsLoaded,\n getAdminClient,\n initSetup,\n} from './server';\nimport {hideDynamicChannelsContent, waitForAnimationEnd, waitUntil} from './test_action';\nimport {pages} from './ui/pages';\nimport {matchSnapshot} from './visual';\nimport {stubNotification, waitForNotification} from './mock_browser_api';\nimport {duration, getRandomId, simpleEmailRe, wait} from './util';\n\nexport {expect} from '@playwright/test';\n\nexport type ExtendedFixtures = {\n axe: AxeBuilderExtended;\n pw: PlaywrightExtended;\n};\n\ntype AxeBuilderOptions = {\n disableColorContrast?: boolean;\n disableLinkInTextBlock?: boolean;\n};\n\nexport const test = base.extend<ExtendedFixtures>({\n // eslint-disable-next-line no-empty-pattern\n axe: async ({}, use) => {\n const ab = new AxeBuilderExtended();\n await use(ab);\n },\n pw: async ({browser, page, isMobile}, use) => {\n const pw = new PlaywrightExtended(browser, page, isMobile);\n await use(pw);\n await pw.testBrowser.close();\n },\n});\n\nexport class PlaywrightExtended {\n // ./browser_context\n readonly testBrowser;\n\n // ./flag\n readonly shouldHaveCallsEnabled;\n readonly shouldHaveFeatureFlag;\n readonly shouldRunInLinux;\n readonly ensureLicense;\n readonly ensureServerDeployment;\n readonly skipIfNoLicense;\n readonly skipIfFeatureFlagNotSet;\n\n // ./file\n readonly getBlobFromAsset;\n readonly getFileFromAsset;\n\n // ./server\n readonly ensurePluginsLoaded;\n readonly getAdminClient;\n readonly initSetup;\n\n // ./test_action\n readonly hideDynamicChannelsContent;\n readonly waitForAnimationEnd;\n readonly waitUntil;\n\n // ./mock_browser_api\n readonly stubNotification;\n readonly waitForNotification;\n\n // ./visual\n readonly matchSnapshot;\n\n // ./util\n readonly duration;\n readonly simpleEmailRe;\n readonly wait;\n\n // random\n readonly random;\n\n // unauthenticated page\n readonly loginPage;\n readonly landingLoginPage;\n readonly signupPage;\n readonly resetPasswordPage;\n\n readonly hasSeenLandingPage;\n\n constructor(browser: Browser, page: Page, isMobile: boolean) {\n // ./browser_context\n this.testBrowser = new TestBrowser(browser);\n\n // ./flag\n this.shouldHaveCallsEnabled = shouldHaveCallsEnabled;\n this.shouldHaveFeatureFlag = shouldHaveFeatureFlag;\n this.shouldRunInLinux = shouldRunInLinux;\n this.ensureLicense = ensureLicense;\n this.ensureServerDeployment = ensureServerDeployment;\n this.skipIfNoLicense = skipIfNoLicense;\n this.skipIfFeatureFlagNotSet = skipIfFeatureFlagNotSet;\n\n // ./file\n this.getBlobFromAsset = getBlobFromAsset;\n this.getFileFromAsset = getFileFromAsset;\n\n // ./server\n this.ensurePluginsLoaded = ensurePluginsLoaded;\n this.initSetup = initSetup;\n this.getAdminClient = getAdminClient;\n\n // ./test_action\n this.hideDynamicChannelsContent = hideDynamicChannelsContent;\n this.waitForAnimationEnd = waitForAnimationEnd;\n this.waitUntil = waitUntil;\n\n // unauthenticated page\n this.loginPage = new pages.LoginPage(page);\n this.landingLoginPage = new pages.LandingLoginPage(page, isMobile);\n this.signupPage = new pages.SignupPage(page);\n this.resetPasswordPage = new pages.ResetPasswordPage(page);\n\n // ./mock_browser_api\n this.stubNotification = stubNotification;\n this.waitForNotification = waitForNotification;\n\n // ./visual\n this.matchSnapshot = matchSnapshot;\n\n // ./util\n this.duration = duration;\n this.wait = wait;\n this.simpleEmailRe = simpleEmailRe;\n\n this.random = {\n id: getRandomId,\n channel: createRandomChannel,\n post: createRandomPost,\n team: createRandomTeam,\n user: createRandomUser,\n };\n\n this.hasSeenLandingPage = async () => {\n // Visit the base URL to be able to set the localStorage\n await page.goto('/');\n return await waitUntilLocalStorageIsSet(page, '__landingPageSeen__', 'true');\n };\n }\n}\n\nexport class AxeBuilderExtended {\n readonly builder: (page: Page, options?: AxeBuilderOptions) => AxeBuilder;\n\n // See https://github.com/dequelabs/axe-core/blob/master/doc/API.md#axe-core-tags\n readonly tags: string[] = ['wcag2a', 'wcag2aa'];\n\n constructor() {\n this.builder = (page: Page, options: AxeBuilderOptions = {}) => {\n // See https://github.com/dequelabs/axe-core/blob/master/doc/rule-descriptions.md#wcag-20-level-a--aa-rules\n const disabledRules: string[] = [];\n\n if (options.disableColorContrast) {\n // Disabled in pages due to impact to overall theme of Mattermost.\n // Option: make use of custom theme to improve color contrast.\n disabledRules.push('color-contrast');\n }\n\n if (options.disableLinkInTextBlock) {\n // Disabled in pages due to impact to overall theme of Mattermost.\n // Option: make use of custom theme to improve color contrast.\n disabledRules.push('link-in-text-block');\n }\n\n return new AxeBuilder({page}).withTags(this.tags).disableRules(disabledRules);\n };\n }\n\n violationFingerprints(accessibilityScanResults: AxeResults) {\n const fingerprints = accessibilityScanResults.violations.map((violation) => ({\n rule: violation.id,\n description: violation.description,\n helpUrl: violation.helpUrl,\n targets: violation.nodes.map((node) => {\n return {target: node.target, impact: node.impact, html: node.html};\n }),\n }));\n\n return JSON.stringify(fingerprints, null, 2);\n }\n}\n\nasync function waitUntilLocalStorageIsSet(page: Page, key: string, value: string, timeout = duration.ten_sec) {\n await waitUntil(\n () =>\n page.evaluate(\n ({key, value}) => {\n if (localStorage.getItem(key) === value) {\n return true;\n }\n localStorage.setItem(key, value);\n return false;\n },\n {key, value},\n ),\n {timeout},\n );\n}\n"],"names":["base","TestBrowser","shouldHaveCallsEnabled","shouldHaveFeatureFlag","shouldRunInLinux","ensureLicense","ensureServerDeployment","skipIfNoLicense","skipIfFeatureFlagNotSet","getBlobFromAsset","getFileFromAsset","ensurePluginsLoaded","initSetup","getAdminClient","hideDynamicChannelsContent","waitForAnimationEnd","waitUntil","pages","stubNotification","waitForNotification","matchSnapshot","duration","wait","simpleEmailRe","getRandomId","createRandomChannel","createRandomPost","createRandomTeam","createRandomUser","AxeBuilder"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AA4Ca,MAAA,IAAI,GAAGA,WAAI,CAAC,MAAM,CAAmB;;AAE9C,IAAA,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,KAAI;AACnB,QAAA,MAAM,EAAE,GAAG,IAAI,kBAAkB,EAAE;AACnC,QAAA,MAAM,GAAG,CAAC,EAAE,CAAC;KAChB;AACD,IAAA,EAAE,EAAE,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAC,EAAE,GAAG,KAAI;QACzC,MAAM,EAAE,GAAG,IAAI,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC;AAC1D,QAAA,MAAM,GAAG,CAAC,EAAE,CAAC;AACb,QAAA,MAAM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AQ,CAAC,OAAO,EAAA;AACxG,IAAA,MAAML,wBAAS,CACX,MACI,IAAI,CAAC,QAAQ,CACT,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,KAAI;QACb,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE;AACrC,YAAA,OAAO,IAAI;;AAEf,QAAA,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC;AAChC,QAAA,OAAO,KAAK;AAChB,KAAC,EACD,EAAC,GAAG,EAAE,KAAK,EAAC,CACf,EACL,EAAC,OAAO,EAAC,CACZ;AACL;;;;;;;;;;"}
1
+ {"version":3,"file":"test_fixture.js","sources":["../src/test_fixture.ts"],"sourcesContent":["// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.\n// See LICENSE.txt for license information.\n\nimport {Browser, Page, test as base} from '@playwright/test';\nimport {AxeResults} from 'axe-core';\nimport {AxeBuilder} from '@axe-core/playwright';\n\nimport {TestBrowser} from './browser_context';\nimport {\n ensureLicense,\n ensurePluginsLoaded,\n ensureServerDeployment,\n shouldHaveCallsEnabled,\n shouldHaveFeatureFlag,\n shouldRunInLinux,\n skipIfFeatureFlagNotSet,\n skipIfNoLicense,\n} from './flag';\nimport {getBlobFromAsset, getFileFromAsset} from './file';\nimport {\n createRandomChannel,\n createRandomPost,\n createRandomTeam,\n createRandomUser,\n getAdminClient,\n initSetup,\n} from './server';\nimport {hideDynamicChannelsContent, waitForAnimationEnd, waitUntil} from './test_action';\nimport {pages} from './ui/pages';\nimport {matchSnapshot} from './visual';\nimport {stubNotification, waitForNotification} from './mock_browser_api';\nimport {duration, getRandomId, simpleEmailRe, wait} from './util';\n\nexport {expect} from '@playwright/test';\n\nexport type ExtendedFixtures = {\n axe: AxeBuilderExtended;\n pw: PlaywrightExtended;\n};\n\ntype AxeBuilderOptions = {\n disableColorContrast?: boolean;\n disableLinkInTextBlock?: boolean;\n};\n\nexport const test = base.extend<ExtendedFixtures>({\n // eslint-disable-next-line no-empty-pattern\n axe: async ({}, use) => {\n const ab = new AxeBuilderExtended();\n await use(ab);\n },\n pw: async ({browser, page, isMobile}, use) => {\n const pw = new PlaywrightExtended(browser, page, isMobile);\n await use(pw);\n await pw.testBrowser.close();\n },\n});\n\nexport class PlaywrightExtended {\n // ./browser_context\n readonly testBrowser;\n\n // ./flag\n readonly shouldHaveCallsEnabled;\n readonly shouldHaveFeatureFlag;\n readonly shouldRunInLinux;\n readonly ensureLicense;\n readonly ensureServerDeployment;\n readonly skipIfNoLicense;\n readonly skipIfFeatureFlagNotSet;\n\n // ./file\n readonly getBlobFromAsset;\n readonly getFileFromAsset;\n\n // ./server\n readonly ensurePluginsLoaded;\n readonly getAdminClient;\n readonly initSetup;\n\n // ./test_action\n readonly hideDynamicChannelsContent;\n readonly waitForAnimationEnd;\n readonly waitUntil;\n\n // ./mock_browser_api\n readonly stubNotification;\n readonly waitForNotification;\n\n // ./visual\n readonly matchSnapshot;\n\n // ./util\n readonly duration;\n readonly simpleEmailRe;\n readonly wait;\n\n // random\n readonly random;\n\n // unauthenticated page\n readonly loginPage;\n readonly landingLoginPage;\n readonly signupPage;\n readonly resetPasswordPage;\n\n readonly hasSeenLandingPage;\n\n constructor(browser: Browser, page: Page, isMobile: boolean) {\n // ./browser_context\n this.testBrowser = new TestBrowser(browser);\n\n // ./flag\n this.shouldHaveCallsEnabled = shouldHaveCallsEnabled;\n this.shouldHaveFeatureFlag = shouldHaveFeatureFlag;\n this.shouldRunInLinux = shouldRunInLinux;\n this.ensureLicense = ensureLicense;\n this.ensureServerDeployment = ensureServerDeployment;\n this.skipIfNoLicense = skipIfNoLicense;\n this.skipIfFeatureFlagNotSet = skipIfFeatureFlagNotSet;\n\n // ./file\n this.getBlobFromAsset = getBlobFromAsset;\n this.getFileFromAsset = getFileFromAsset;\n\n // ./server\n this.ensurePluginsLoaded = ensurePluginsLoaded;\n this.initSetup = initSetup;\n this.getAdminClient = getAdminClient;\n\n // ./test_action\n this.hideDynamicChannelsContent = hideDynamicChannelsContent;\n this.waitForAnimationEnd = waitForAnimationEnd;\n this.waitUntil = waitUntil;\n\n // unauthenticated page\n this.loginPage = new pages.LoginPage(page);\n this.landingLoginPage = new pages.LandingLoginPage(page, isMobile);\n this.signupPage = new pages.SignupPage(page);\n this.resetPasswordPage = new pages.ResetPasswordPage(page);\n\n // ./mock_browser_api\n this.stubNotification = stubNotification;\n this.waitForNotification = waitForNotification;\n\n // ./visual\n this.matchSnapshot = matchSnapshot;\n\n // ./util\n this.duration = duration;\n this.wait = wait;\n this.simpleEmailRe = simpleEmailRe;\n\n this.random = {\n id: getRandomId,\n channel: createRandomChannel,\n post: createRandomPost,\n team: createRandomTeam,\n user: createRandomUser,\n };\n\n this.hasSeenLandingPage = async () => {\n // Visit the base URL to be able to set the localStorage\n await page.goto('/');\n return await waitUntilLocalStorageIsSet(page, '__landingPageSeen__', 'true');\n };\n }\n}\n\nexport class AxeBuilderExtended {\n readonly builder: (page: Page, options?: AxeBuilderOptions) => AxeBuilder;\n\n // See https://github.com/dequelabs/axe-core/blob/master/doc/API.md#axe-core-tags\n readonly tags: string[] = ['wcag2a', 'wcag2aa'];\n\n constructor() {\n this.builder = (page: Page, options: AxeBuilderOptions = {}) => {\n // See https://github.com/dequelabs/axe-core/blob/master/doc/rule-descriptions.md#wcag-20-level-a--aa-rules\n const disabledRules: string[] = [];\n\n if (options.disableColorContrast) {\n // Disabled in pages due to impact to overall theme of Mattermost.\n // Option: make use of custom theme to improve color contrast.\n disabledRules.push('color-contrast');\n }\n\n if (options.disableLinkInTextBlock) {\n // Disabled in pages due to impact to overall theme of Mattermost.\n // Option: make use of custom theme to improve color contrast.\n disabledRules.push('link-in-text-block');\n }\n\n return new AxeBuilder({page}).withTags(this.tags).disableRules(disabledRules);\n };\n }\n\n violationFingerprints(accessibilityScanResults: AxeResults) {\n const fingerprints = accessibilityScanResults.violations.map((violation) => ({\n rule: violation.id,\n description: violation.description,\n helpUrl: violation.helpUrl,\n targets: violation.nodes.map((node) => {\n return {target: node.target, impact: node.impact, html: node.html};\n }),\n }));\n\n return JSON.stringify(fingerprints, null, 2);\n }\n}\n\nasync function waitUntilLocalStorageIsSet(page: Page, key: string, value: string, timeout = duration.ten_sec) {\n await waitUntil(\n () =>\n page.evaluate(\n ({key, value}) => {\n if (localStorage.getItem(key) === value) {\n return true;\n }\n localStorage.setItem(key, value);\n return false;\n },\n {key, value},\n ),\n {timeout},\n );\n}\n"],"names":["base","TestBrowser","shouldHaveCallsEnabled","shouldHaveFeatureFlag","shouldRunInLinux","ensureLicense","ensureServerDeployment","skipIfNoLicense","skipIfFeatureFlagNotSet","getBlobFromAsset","getFileFromAsset","ensurePluginsLoaded","initSetup","getAdminClient","hideDynamicChannelsContent","waitForAnimationEnd","waitUntil","pages","stubNotification","waitForNotification","matchSnapshot","duration","wait","simpleEmailRe","getRandomId","createRandomChannel","createRandomPost","createRandomTeam","createRandomUser","AxeBuilder"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AA4Ca,MAAA,IAAI,GAAGA,WAAI,CAAC,MAAM,CAAmB;;AAE9C,IAAA,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,KAAI;AACnB,QAAA,MAAM,EAAE,GAAG,IAAI,kBAAkB,EAAE;AACnC,QAAA,MAAM,GAAG,CAAC,EAAE,CAAC;KAChB;AACD,IAAA,EAAE,EAAE,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAC,EAAE,GAAG,KAAI;QACzC,MAAM,EAAE,GAAG,IAAI,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC;AAC1D,QAAA,MAAM,GAAG,CAAC,EAAE,CAAC;AACb,QAAA,MAAM,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE;KAC/B;AACJ,CAAA;MAEY,kBAAkB,CAAA;;AAElB,IAAA,WAAW;;AAGX,IAAA,sBAAsB;AACtB,IAAA,qBAAqB;AACrB,IAAA,gBAAgB;AAChB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,CAAC,KAAK,KAAK,EAAE;AACrC,YAAA,OAAO,IAAI;;AAEf,QAAA,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC;AAChC,QAAA,OAAO,KAAK;AAChB,KAAC,EACD,EAAC,GAAG,EAAE,KAAK,EAAC,CACf,EACL,EAAC,OAAO,EAAC,CACZ;AACL;;;;;;;;;;"}
@@ -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
- import { expect } from '@playwright/test';
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