@mattermost/playwright-lib 10.6.0 → 10.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) 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.js +38 -26
  5. package/dist/global_setup.js +33 -22
  6. package/dist/index.d.ts +0 -1
  7. package/dist/index.js +42 -10
  8. package/dist/index.js.map +1 -1
  9. package/dist/mock_browser_api.js +8 -2
  10. package/dist/server/channel.js +9 -3
  11. package/dist/server/client.js +16 -10
  12. package/dist/server/default_config.js +15 -9
  13. package/dist/server/init.js +36 -29
  14. package/dist/server/post.js +9 -3
  15. package/dist/server/team.js +9 -3
  16. package/dist/server/user.js +15 -8
  17. package/dist/test_action.js +14 -3
  18. package/dist/test_config.js +30 -4
  19. package/dist/test_fixture.js +66 -47
  20. package/dist/ui/components/channels/app_bar.js +9 -3
  21. package/dist/ui/components/channels/center_view.js +28 -22
  22. package/dist/ui/components/channels/delete_post_confirmation_dialog.js +14 -8
  23. package/dist/ui/components/channels/delete_post_modal.js +10 -4
  24. package/dist/ui/components/channels/emoji_gif_picker.js +15 -9
  25. package/dist/ui/components/channels/find_channels_modal.js +9 -3
  26. package/dist/ui/components/channels/generic_confirm_modal.js +11 -5
  27. package/dist/ui/components/channels/header.js +9 -3
  28. package/dist/ui/components/channels/message_priority.js +20 -14
  29. package/dist/ui/components/channels/post.js +16 -10
  30. package/dist/ui/components/channels/post_create.js +29 -23
  31. package/dist/ui/components/channels/post_dot_menu.js +9 -3
  32. package/dist/ui/components/channels/post_edit.js +22 -16
  33. package/dist/ui/components/channels/post_menu.js +9 -3
  34. package/dist/ui/components/channels/post_reminder_menu.js +9 -3
  35. package/dist/ui/components/channels/restore_post_confirmation_dialog.js +12 -6
  36. package/dist/ui/components/channels/scheduled_draft_menu.js +9 -3
  37. package/dist/ui/components/channels/scheduled_draft_modal.js +10 -4
  38. package/dist/ui/components/channels/search_popover.js +9 -3
  39. package/dist/ui/components/channels/settings/notification_settings.js +14 -8
  40. package/dist/ui/components/channels/settings/settings_modal.js +13 -7
  41. package/dist/ui/components/channels/sidebar_left.js +14 -8
  42. package/dist/ui/components/channels/sidebar_right.js +26 -20
  43. package/dist/ui/components/channels/thread_footer.js +9 -3
  44. package/dist/ui/components/channels/user_profile_popover.js +9 -3
  45. package/dist/ui/components/footer.js +9 -3
  46. package/dist/ui/components/global_header.js +13 -7
  47. package/dist/ui/components/index.js +74 -72
  48. package/dist/ui/components/main_header.js +9 -3
  49. package/dist/ui/components/system_console/navbar.js +9 -3
  50. package/dist/ui/components/system_console/sections/system_users/column_toggle_menu.js +10 -4
  51. package/dist/ui/components/system_console/sections/system_users/feature_discovery.js +10 -4
  52. package/dist/ui/components/system_console/sections/system_users/filter_menu.js +9 -3
  53. package/dist/ui/components/system_console/sections/system_users/filter_popover.js +14 -8
  54. package/dist/ui/components/system_console/sections/system_users/mobile_security.js +9 -3
  55. package/dist/ui/components/system_console/sections/system_users/system_users.js +16 -10
  56. package/dist/ui/components/system_console/sidebar.js +10 -4
  57. package/dist/ui/pages/channels.js +24 -18
  58. package/dist/ui/pages/drafts.js +23 -17
  59. package/dist/ui/pages/index.js +30 -17
  60. package/dist/ui/pages/landing_login.js +11 -5
  61. package/dist/ui/pages/login.js +14 -8
  62. package/dist/ui/pages/reset_password.js +15 -9
  63. package/dist/ui/pages/scheduled_draft.js +25 -19
  64. package/dist/ui/pages/signup.js +17 -11
  65. package/dist/ui/pages/system_console.js +22 -16
  66. package/dist/util.js +19 -8
  67. package/dist/visual/index.js +20 -14
  68. package/dist/visual/percy.js +10 -4
  69. package/package.json +1 -1
  70. package/dist/server/index.js +0 -9
  71. package/dist/tsconfig.tsbuildinfo +0 -1
  72. package/dist/types.js +0 -3
@@ -1,10 +1,13 @@
1
+ 'use strict';
2
+
3
+ var promises = require('node:fs/promises');
4
+ var test = require('@playwright/test');
5
+ var test_config = require('./test_config.js');
6
+ var index = require('./ui/pages/index.js');
7
+
1
8
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
9
  // See LICENSE.txt for license information.
3
- import { writeFile } from 'node:fs/promises';
4
- import { request } from '@playwright/test';
5
- import { testConfig } from './test_config';
6
- import { pages } from './ui/pages';
7
- export class TestBrowser {
10
+ class TestBrowser {
8
11
  browser;
9
12
  context;
10
13
  constructor(browser) {
@@ -21,10 +24,10 @@ export class TestBrowser {
21
24
  // Sign in a user in new browser context
22
25
  const context = await this.browser.newContext(options);
23
26
  const page = await context.newPage();
24
- const channelsPage = new pages.ChannelsPage(page);
25
- const systemConsolePage = new pages.SystemConsolePage(page);
26
- const scheduledDraftPage = new pages.ScheduledDraftPage(page);
27
- const draftPage = new pages.DraftPage(page);
27
+ const channelsPage = new index.pages.ChannelsPage(page);
28
+ const systemConsolePage = new index.pages.SystemConsolePage(page);
29
+ const scheduledDraftPage = new index.pages.ScheduledDraftPage(page);
30
+ const draftPage = new index.pages.DraftPage(page);
28
31
  this.context = context;
29
32
  return { context, page, channelsPage, systemConsolePage, scheduledDraftPage, draftPage };
30
33
  }
@@ -34,8 +37,8 @@ export class TestBrowser {
34
37
  }
35
38
  }
36
39
  }
37
- export async function loginByAPI(loginId, password, token = '', ldapOnly = false) {
38
- const requestContext = await request.newContext();
40
+ async function loginByAPI(loginId, password, token = '', ldapOnly = false) {
41
+ const requestContext = await test.request.newContext();
39
42
  const data = {
40
43
  login_id: loginId,
41
44
  password,
@@ -46,7 +49,7 @@ export async function loginByAPI(loginId, password, token = '', ldapOnly = false
46
49
  data.ldap_only = 'true';
47
50
  }
48
51
  // Log in via API
49
- await requestContext.post(`${testConfig.baseURL}/api/v4/users/login`, {
52
+ await requestContext.post(`${test_config.testConfig.baseURL}/api/v4/users/login`, {
50
53
  data,
51
54
  headers: { 'X-Requested-With': 'XMLHttpRequest' },
52
55
  });
@@ -56,9 +59,13 @@ export async function loginByAPI(loginId, password, token = '', ldapOnly = false
56
59
  await requestContext.dispose();
57
60
  // Append origins to bypass seeing landing page then write to file
58
61
  storageState.origins.push({
59
- origin: testConfig.baseURL,
62
+ origin: test_config.testConfig.baseURL,
60
63
  localStorage: [{ name: '__landingPageSeen__', value: 'true' }],
61
64
  });
62
- await writeFile(storagePath, JSON.stringify(storageState));
65
+ await promises.writeFile(storagePath, JSON.stringify(storageState));
63
66
  return storagePath;
64
67
  }
68
+
69
+ exports.TestBrowser = TestBrowser;
70
+ exports.loginByAPI = loginByAPI;
71
+ //# sourceMappingURL=browser_context.js.map
package/dist/constant.js CHANGED
@@ -1,5 +1,8 @@
1
+ 'use strict';
2
+
1
3
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
4
  // See LICENSE.txt for license information.
3
- export const appsPluginId = 'com.mattermost.apps';
4
- export const callsPluginId = 'com.mattermost.calls';
5
- export const playbooksPluginId = 'playbooks';
5
+ const callsPluginId = 'com.mattermost.calls';
6
+
7
+ exports.callsPluginId = callsPluginId;
8
+ //# sourceMappingURL=constant.js.map
package/dist/file.js CHANGED
@@ -1,19 +1,20 @@
1
+ 'use strict';
2
+
3
+ var path = require('node:path');
4
+ var fs = require('node:fs');
5
+ var mime = require('mime-types');
6
+
1
7
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
8
  // See LICENSE.txt for license information.
3
- import path from 'node:path';
4
- import fs from 'node:fs';
5
- import mime from 'mime-types';
6
9
  const commonAssetPath = path.resolve(__dirname, 'asset');
7
- export const assetPath = path.resolve(process.cwd(), 'asset');
8
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
- const availableFiles = ['mattermost-icon_128x128.png'];
10
+ const assetPath = path.resolve(process.cwd(), 'asset');
10
11
  /**
11
12
  * Reads file data and creates a File object.
12
13
  * @param filePath - The path to the file.
13
14
  * @returns A File object containing the file data.
14
15
  * @throws If the file does not exist.
15
16
  */
16
- export function getFileData(filePath) {
17
+ function getFileData(filePath) {
17
18
  if (!fs.existsSync(filePath)) {
18
19
  throw new Error(`File not found at path: ${filePath}`);
19
20
  }
@@ -28,7 +29,7 @@ export function getFileData(filePath) {
28
29
  * @returns A Blob object containing the file data.
29
30
  * @throws If the file does not exist.
30
31
  */
31
- export function getBlobData(filePath) {
32
+ function getBlobData(filePath) {
32
33
  if (!fs.existsSync(filePath)) {
33
34
  throw new Error(`File not found at path: ${filePath}`);
34
35
  }
@@ -41,7 +42,7 @@ export function getBlobData(filePath) {
41
42
  * @param filename - The name of the file in the "asset" directory.
42
43
  * @returns An object containing a File object
43
44
  */
44
- export function getFileFromAsset(filename) {
45
+ function getFileFromAsset(filename) {
45
46
  const filePath = path.join(assetPath, filename);
46
47
  return getFileData(filePath);
47
48
  }
@@ -50,7 +51,7 @@ export function getFileFromAsset(filename) {
50
51
  * @param filename - The name of the file in the "asset" directory.
51
52
  * @returns An object containing a Blob object
52
53
  */
53
- export function getBlobFromAsset(filename) {
54
+ function getBlobFromAsset(filename) {
54
55
  const filePath = path.join(assetPath, filename);
55
56
  return getBlobData(filePath);
56
57
  }
@@ -59,16 +60,15 @@ export function getBlobFromAsset(filename) {
59
60
  * @param filename - The name of the file in the "asset" directory.
60
61
  * @returns An object containing a File object
61
62
  */
62
- export function getFileFromCommonAsset(filename) {
63
+ function getFileFromCommonAsset(filename) {
63
64
  const filePath = path.join(commonAssetPath, filename);
64
65
  return getFileData(filePath);
65
66
  }
66
- /**
67
- * Reads file data from the lib "asset" directory and creates a Blob object.
68
- * @param filename - The name of the file in the "asset" directory.
69
- * @returns An object containing a Blob object
70
- */
71
- export function getBlobFromCommonAsset(filename) {
72
- const filePath = path.join(commonAssetPath, filename);
73
- return getBlobData(filePath);
74
- }
67
+
68
+ exports.assetPath = assetPath;
69
+ exports.getBlobData = getBlobData;
70
+ exports.getBlobFromAsset = getBlobFromAsset;
71
+ exports.getFileData = getFileData;
72
+ exports.getFileFromAsset = getFileFromAsset;
73
+ exports.getFileFromCommonAsset = getFileFromCommonAsset;
74
+ //# sourceMappingURL=file.js.map
package/dist/flag.js CHANGED
@@ -1,39 +1,42 @@
1
+ 'use strict';
2
+
3
+ var os = require('node:os');
4
+ var test = require('@playwright/test');
5
+ var constant = require('./constant.js');
6
+ var init = require('./server/init.js');
7
+
1
8
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
9
  // See LICENSE.txt for license information.
3
- import os from 'node:os';
4
- import { expect, test } from '@playwright/test';
5
- import { callsPluginId } from './constant';
6
- import { getAdminClient } from './server/init';
7
- export async function shouldHaveCallsEnabled(enabled = true) {
8
- const { adminClient } = await getAdminClient();
10
+ async function shouldHaveCallsEnabled(enabled = true) {
11
+ const { adminClient } = await init.getAdminClient();
9
12
  const config = await adminClient.getConfig();
10
- const callsEnabled = config.PluginSettings.PluginStates[callsPluginId].Enable;
13
+ const callsEnabled = config.PluginSettings.PluginStates[constant.callsPluginId].Enable;
11
14
  const matched = callsEnabled === enabled;
12
- expect(matched, matched ? '' : `Calls expect "${enabled}" but actual "${callsEnabled}"`).toBeTruthy();
15
+ test.expect(matched, matched ? '' : `Calls expect "${enabled}" but actual "${callsEnabled}"`).toBeTruthy();
13
16
  }
14
- export async function shouldHaveFeatureFlag(name, value) {
15
- const { adminClient } = await getAdminClient();
17
+ async function shouldHaveFeatureFlag(name, value) {
18
+ const { adminClient } = await init.getAdminClient();
16
19
  const config = await adminClient.getConfig();
17
20
  const matched = config.FeatureFlags[name] === value;
18
- expect(matched, matched ? '' : `FeatureFlags["${name}'] expect "${value}" but actual "${config.FeatureFlags[name]}"`).toBeTruthy();
21
+ test.expect(matched, matched ? '' : `FeatureFlags["${name}'] expect "${value}" but actual "${config.FeatureFlags[name]}"`).toBeTruthy();
19
22
  }
20
- export async function shouldRunInLinux() {
23
+ async function shouldRunInLinux() {
21
24
  const platform = os.platform();
22
- expect(platform, 'Run in Linux or Playwright docker image only').toBe('linux');
25
+ test.expect(platform, 'Run in Linux or Playwright docker image only').toBe('linux');
23
26
  }
24
- export async function ensureLicense() {
25
- const { adminClient } = await getAdminClient();
27
+ async function ensureLicense() {
28
+ const { adminClient } = await init.getAdminClient();
26
29
  let license = await adminClient.getClientLicenseOld();
27
30
  if (license?.IsLicensed !== 'true') {
28
31
  const config = await adminClient.getClientConfigOld();
29
- expect(config.ServiceEnvironment === 'dev', 'The trial license request fails in the local development environment. Please manually upload the test license.').toBeFalsy();
32
+ test.expect(config.ServiceEnvironment === 'dev', 'The trial license request fails in the local development environment. Please manually upload the test license.').toBeFalsy();
30
33
  await requestTrialLicense();
31
34
  license = await adminClient.getClientLicenseOld();
32
35
  }
33
- expect(license?.IsLicensed === 'true', 'Ensure server has license').toBeTruthy();
36
+ test.expect(license?.IsLicensed === 'true', 'Ensure server has license').toBeTruthy();
34
37
  }
35
- export async function requestTrialLicense() {
36
- const { adminClient } = await getAdminClient();
38
+ async function requestTrialLicense() {
39
+ const { adminClient } = await init.getAdminClient();
37
40
  const admin = await adminClient.getMe();
38
41
  try {
39
42
  await adminClient.requestTrialLicense({
@@ -48,17 +51,26 @@ export async function requestTrialLicense() {
48
51
  });
49
52
  }
50
53
  catch (error) {
51
- expect(error, 'Failed to request trial license').toBeFalsy();
54
+ test.expect(error, 'Failed to request trial license').toBeFalsy();
52
55
  throw error;
53
56
  }
54
57
  }
55
- export async function skipIfNoLicense() {
56
- const { adminClient } = await getAdminClient();
58
+ async function skipIfNoLicense() {
59
+ const { adminClient } = await init.getAdminClient();
57
60
  const license = await adminClient.getClientLicenseOld();
58
- test.skip(license.IsLicensed === 'false', 'Skipping test - server not licensed');
61
+ test.test.skip(license.IsLicensed === 'false', 'Skipping test - server not licensed');
59
62
  }
60
- export async function skipIfFeatureFlagNotSet(name, value) {
61
- const { adminClient } = await getAdminClient();
63
+ async function skipIfFeatureFlagNotSet(name, value) {
64
+ const { adminClient } = await init.getAdminClient();
62
65
  const cfg = await adminClient.getConfig();
63
- test.skip(cfg.FeatureFlags[name] !== value, `Skipping test - Feature Flag ${name} needs to be set to ${value}`);
66
+ test.test.skip(cfg.FeatureFlags[name] !== value, `Skipping test - Feature Flag ${name} needs to be set to ${value}`);
64
67
  }
68
+
69
+ exports.ensureLicense = ensureLicense;
70
+ exports.requestTrialLicense = requestTrialLicense;
71
+ exports.shouldHaveCallsEnabled = shouldHaveCallsEnabled;
72
+ exports.shouldHaveFeatureFlag = shouldHaveFeatureFlag;
73
+ exports.shouldRunInLinux = shouldRunInLinux;
74
+ exports.skipIfFeatureFlagNotSet = skipIfFeatureFlagNotSet;
75
+ exports.skipIfNoLicense = skipIfNoLicense;
76
+ //# sourceMappingURL=flag.js.map
@@ -1,20 +1,27 @@
1
+ 'use strict';
2
+
3
+ var test = require('@playwright/test');
4
+ var client = require('@mattermost/client');
5
+ var util = require('./util.js');
6
+ var client$1 = require('./server/client.js');
7
+ require('./server/default_config.js');
8
+ var init = require('./server/init.js');
9
+ var team = require('./server/team.js');
10
+ var user = require('./server/user.js');
11
+ var test_config = require('./test_config.js');
12
+
1
13
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
14
  // See LICENSE.txt for license information.
3
- import { expect } from '@playwright/test';
4
- import { Client4 } from '@mattermost/client';
5
- import { defaultTeam } from './util';
6
- import { createRandomTeam, getAdminClient, getDefaultAdminUser, makeClient } from './server';
7
- import { testConfig } from './test_config';
8
- export async function baseGlobalSetup() {
15
+ async function baseGlobalSetup() {
9
16
  let adminClient;
10
17
  let adminUser;
11
- ({ adminClient, adminUser } = await getAdminClient({ skipLog: true }));
18
+ ({ adminClient, adminUser } = await init.getAdminClient({ skipLog: true }));
12
19
  if (!adminUser) {
13
- const firstClient = new Client4();
14
- firstClient.setUrl(testConfig.baseURL);
15
- const defaultAdmin = getDefaultAdminUser();
20
+ const firstClient = new client.Client4();
21
+ firstClient.setUrl(test_config.testConfig.baseURL);
22
+ const defaultAdmin = user.getDefaultAdminUser();
16
23
  await firstClient.createUser(defaultAdmin, '', '');
17
- ({ client: adminClient, user: adminUser } = await makeClient(defaultAdmin));
24
+ ({ client: adminClient, user: adminUser } = await client$1.makeClient(defaultAdmin));
18
25
  }
19
26
  await sysadminSetup(adminClient, adminUser);
20
27
  }
@@ -29,12 +36,12 @@ async function sysadminSetup(client, user) {
29
36
  // Create default team if not present.
30
37
  // Otherwise, create other teams and channels other than the default team cna channels (town-square and off-topic).
31
38
  const myTeams = await client.getMyTeams();
32
- const myDefaultTeam = myTeams && myTeams.length > 0 && myTeams.find((team) => team.name === defaultTeam.name);
39
+ const myDefaultTeam = myTeams && myTeams.length > 0 && myTeams.find((team) => team.name === util.defaultTeam.name);
33
40
  if (!myDefaultTeam) {
34
- await client.createTeam(createRandomTeam(defaultTeam.name, defaultTeam.displayName, 'O', false));
41
+ await client.createTeam(team.createRandomTeam(util.defaultTeam.name, util.defaultTeam.displayName, 'O', false));
35
42
  }
36
- else if (myDefaultTeam && testConfig.resetBeforeTest) {
37
- await Promise.all(myTeams.filter((team) => team.name !== defaultTeam.name).map((team) => client.deleteTeam(team.id)));
43
+ else if (myDefaultTeam && test_config.testConfig.resetBeforeTest) {
44
+ await Promise.all(myTeams.filter((team) => team.name !== util.defaultTeam.name).map((team) => client.deleteTeam(team.id)));
38
45
  const myChannels = await client.getMyChannels(myDefaultTeam.id);
39
46
  await Promise.all(myChannels
40
47
  .filter((channel) => {
@@ -82,10 +89,10 @@ async function printClientInfo(client) {
82
89
  - ServiceSettings.EnableSecurityFixAlert = ${ServiceSettings?.EnableSecurityFixAlert}
83
90
  - LogSettings.EnableDiagnostics = ${LogSettings?.EnableDiagnostics}`);
84
91
  }
85
- export async function ensurePluginsLoaded(client) {
92
+ async function ensurePluginsLoaded(client) {
86
93
  const pluginStatus = await client.getPluginStatuses();
87
94
  const plugins = await client.getPlugins();
88
- testConfig.ensurePluginsInstalled.forEach(async (pluginId) => {
95
+ test_config.testConfig.ensurePluginsInstalled.forEach(async (pluginId) => {
89
96
  const isInstalled = pluginStatus.some((plugin) => plugin.plugin_id === pluginId);
90
97
  if (!isInstalled) {
91
98
  // eslint-disable-next-line no-console
@@ -126,17 +133,17 @@ async function printPluginDetails(client) {
126
133
  console.log('');
127
134
  }
128
135
  async function ensureServerDeployment(client) {
129
- if (testConfig.haClusterEnabled) {
130
- const { haClusterNodeCount, haClusterName } = testConfig;
136
+ if (test_config.testConfig.haClusterEnabled) {
137
+ const { haClusterNodeCount, haClusterName } = test_config.testConfig;
131
138
  const { Enable, ClusterName } = (await client.getConfig()).ClusterSettings;
132
- expect(Enable, Enable ? '' : 'Should have cluster enabled').toBe(true);
139
+ test.expect(Enable, Enable ? '' : 'Should have cluster enabled').toBe(true);
133
140
  const sameClusterName = ClusterName === haClusterName;
134
- expect(sameClusterName, sameClusterName
141
+ test.expect(sameClusterName, sameClusterName
135
142
  ? ''
136
143
  : `Should have cluster name set and as expected. Got "${ClusterName}" but expected "${haClusterName}"`).toBe(true);
137
144
  const clusterInfo = await client.getClusterStatus();
138
145
  const sameCount = clusterInfo?.length === haClusterNodeCount;
139
- expect(sameCount, sameCount
146
+ test.expect(sameCount, sameCount
140
147
  ? ''
141
148
  : `Should match number of nodes in a cluster as expected. Got "${clusterInfo?.length}" but expected "${haClusterNodeCount}"`).toBe(true);
142
149
  clusterInfo.forEach((info) =>
@@ -160,3 +167,7 @@ async function savePreferences(client, userId) {
160
167
  console.log('Error saving preferences', error);
161
168
  }
162
169
  }
170
+
171
+ exports.baseGlobalSetup = baseGlobalSetup;
172
+ exports.ensurePluginsLoaded = ensurePluginsLoaded;
173
+ //# sourceMappingURL=global_setup.js.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export { Client4 } from '@mattermost/client';
2
1
  export { test, expect, PlaywrightExtended } from './test_fixture';
3
2
  export { testConfig } from './test_config';
4
3
  export { baseGlobalSetup } from './global_setup';
package/dist/index.js CHANGED
@@ -1,10 +1,42 @@
1
- // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
- // See LICENSE.txt for license information.
3
- export { Client4 } from '@mattermost/client';
4
- export { test, expect, PlaywrightExtended } from './test_fixture';
5
- export { testConfig } from './test_config';
6
- export { baseGlobalSetup } from './global_setup';
7
- export { TestBrowser } from './browser_context';
8
- export { getBlobFromAsset, getFileFromAsset } from './file';
9
- export { duration, wait } from './util';
10
- export { ChannelsPage, LandingLoginPage, LoginPage, ResetPasswordPage, SignupPage, ScheduledDraftPage, SystemConsolePage, DraftPage, } from './ui/pages';
1
+ 'use strict';
2
+
3
+ var test_fixture = require('./test_fixture.js');
4
+ var test_config = require('./test_config.js');
5
+ var global_setup = require('./global_setup.js');
6
+ var browser_context = require('./browser_context.js');
7
+ var file = require('./file.js');
8
+ var util = require('./util.js');
9
+ var channels = require('./ui/pages/channels.js');
10
+ var landing_login = require('./ui/pages/landing_login.js');
11
+ var login = require('./ui/pages/login.js');
12
+ var reset_password = require('./ui/pages/reset_password.js');
13
+ var signup = require('./ui/pages/signup.js');
14
+ var system_console = require('./ui/pages/system_console.js');
15
+ var scheduled_draft = require('./ui/pages/scheduled_draft.js');
16
+ var drafts = require('./ui/pages/drafts.js');
17
+ var test = require('@playwright/test');
18
+
19
+
20
+
21
+ exports.PlaywrightExtended = test_fixture.PlaywrightExtended;
22
+ exports.test = test_fixture.test;
23
+ exports.testConfig = test_config.testConfig;
24
+ exports.baseGlobalSetup = global_setup.baseGlobalSetup;
25
+ exports.TestBrowser = browser_context.TestBrowser;
26
+ exports.getBlobFromAsset = file.getBlobFromAsset;
27
+ exports.getFileFromAsset = file.getFileFromAsset;
28
+ exports.duration = util.duration;
29
+ exports.wait = util.wait;
30
+ exports.ChannelsPage = channels;
31
+ exports.LandingLoginPage = landing_login;
32
+ exports.LoginPage = login;
33
+ exports.ResetPasswordPage = reset_password;
34
+ exports.SignupPage = signup;
35
+ exports.SystemConsolePage = system_console;
36
+ exports.ScheduledDraftPage = scheduled_draft;
37
+ exports.DraftPage = drafts;
38
+ Object.defineProperty(exports, "expect", {
39
+ enumerable: true,
40
+ get: function () { return test.expect; }
41
+ });
42
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,3 +1,5 @@
1
+ 'use strict';
2
+
1
3
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
4
  // See LICENSE.txt for license information.
3
5
  /**
@@ -10,7 +12,7 @@
10
12
  * @param page Page object
11
13
  * @param permission Permission setting for notifications, with possible values: "default" | "granted" | "denied". Note: A notification sound may still occur even when set to "denied", as the browser might attempt to trigger system notifications.
12
14
  */
13
- export async function stubNotification(page, permission) {
15
+ async function stubNotification(page, permission) {
14
16
  await page.evaluate((notificationPermission) => {
15
17
  // Override the Notification.requestPermission method
16
18
  window.Notification.requestPermission = () => Promise.resolve(permission);
@@ -50,7 +52,7 @@ export async function stubNotification(page, permission) {
50
52
  * @param timeout Wait time in milliseconds. (default: 5000ms)
51
53
  * @returns An array of notifications received
52
54
  */
53
- export async function waitForNotification(page, expectedCount = 1, timeout = 5000) {
55
+ async function waitForNotification(page, expectedCount = 1, timeout = 5000) {
54
56
  const start = Date.now();
55
57
  while (Date.now() - start < timeout) {
56
58
  const notifications = await page.evaluate(() => window.getNotifications());
@@ -63,3 +65,7 @@ export async function waitForNotification(page, expectedCount = 1, timeout = 500
63
65
  console.error(`Notification not received within the timeout period of ${timeout}ms`);
64
66
  return [];
65
67
  }
68
+
69
+ exports.stubNotification = stubNotification;
70
+ exports.waitForNotification = waitForNotification;
71
+ //# sourceMappingURL=mock_browser_api.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 createRandomChannel(channelInput) {
7
+ function createRandomChannel(channelInput) {
5
8
  const channel = {
6
9
  team_id: channelInput.teamId,
7
10
  name: channelInput.name,
@@ -11,9 +14,12 @@ export function createRandomChannel(channelInput) {
11
14
  header: channelInput.type || '',
12
15
  };
13
16
  if (channelInput.unique) {
14
- const randomSuffix = getRandomId();
17
+ const randomSuffix = util.getRandomId();
15
18
  channel.name = `${channelInput.name}-${randomSuffix}`;
16
19
  channel.display_name = `${channelInput.displayName} ${randomSuffix}`;
17
20
  }
18
21
  return channel;
19
22
  }
23
+
24
+ exports.createRandomChannel = createRandomChannel;
25
+ //# sourceMappingURL=channel.js.map
@@ -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,
@@ -747,3 +750,6 @@ const defaultServerConfig = {
747
750
  MaxPostsPerSync: 50,
748
751
  },
749
752
  };
753
+
754
+ exports.getOnPremServerConfig = getOnPremServerConfig;
755
+ //# sourceMappingURL=default_config.js.map