@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,9 +1,12 @@
1
+ 'use strict';
2
+
3
+ var test = require('@playwright/test');
4
+ var util = require('../../util.js');
5
+ var index = require('../components/index.js');
6
+
1
7
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
8
  // See LICENSE.txt for license information.
3
- import { expect } from '@playwright/test';
4
- import { duration, wait } from '@/util';
5
- import { components } from '@/ui/components';
6
- export default class SignupPage {
9
+ class SignupPage {
7
10
  page;
8
11
  title;
9
12
  subtitle;
@@ -45,17 +48,17 @@ export default class SignupPage {
45
48
  const agreementBlock = page.locator('.signup-body-card-agreement');
46
49
  this.agreementTermsOfUseLink = agreementBlock.locator('text=Terms of Use');
47
50
  this.agreementPrivacyPolicyLink = agreementBlock.locator('text=Privacy Policy');
48
- this.header = new components.MainHeader(page.locator('.hfroute-header'));
49
- this.footer = new components.Footer(page.locator('.hfroute-footer'));
51
+ this.header = new index.components.MainHeader(page.locator('.hfroute-header'));
52
+ this.footer = new index.components.Footer(page.locator('.hfroute-footer'));
50
53
  }
51
54
  async toBeVisible() {
52
55
  await this.page.waitForLoadState('networkidle');
53
56
  await this.page.waitForLoadState('domcontentloaded');
54
- await wait(duration.half_sec);
55
- await expect(this.title).toBeVisible();
56
- await expect(this.emailInput).toBeVisible();
57
- await expect(this.usernameInput).toBeVisible();
58
- await expect(this.passwordInput).toBeVisible();
57
+ await util.wait(util.duration.half_sec);
58
+ await test.expect(this.title).toBeVisible();
59
+ await test.expect(this.emailInput).toBeVisible();
60
+ await test.expect(this.usernameInput).toBeVisible();
61
+ await test.expect(this.passwordInput).toBeVisible();
59
62
  }
60
63
  async goto() {
61
64
  await this.page.goto('/signup_user_complete');
@@ -70,3 +73,6 @@ export default class SignupPage {
70
73
  }
71
74
  }
72
75
  }
76
+
77
+ module.exports = SignupPage;
78
+ //# sourceMappingURL=signup.js.map
@@ -1,7 +1,10 @@
1
+ 'use strict';
2
+
3
+ var index = require('../components/index.js');
4
+
1
5
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
6
  // See LICENSE.txt for license information.
3
- import { components } from '@/ui/components';
4
- export default class SystemConsolePage {
7
+ class SystemConsolePage {
5
8
  page;
6
9
  sidebar;
7
10
  navbar;
@@ -24,22 +27,22 @@ export default class SystemConsolePage {
24
27
  constructor(page) {
25
28
  this.page = page;
26
29
  // Areas of the page
27
- this.navbar = new components.SystemConsoleNavbar(page.locator('.backstage-navbar'));
28
- this.sidebar = new components.SystemConsoleSidebar(page.locator('.admin-sidebar'));
30
+ this.navbar = new index.components.SystemConsoleNavbar(page.locator('.backstage-navbar'));
31
+ this.sidebar = new index.components.SystemConsoleSidebar(page.locator('.admin-sidebar'));
29
32
  // Sections and sub-sections
30
- this.systemUsers = new components.SystemUsers(page.getByTestId('systemUsersSection'));
31
- this.mobileSecurity = new components.SystemConsoleMobileSecurity(page.getByTestId('sysconsole_section_MobileSecuritySettings'));
32
- this.featureDiscovery = new components.SystemConsoleFeatureDiscovery(page.getByTestId('featureDiscovery'));
33
+ this.systemUsers = new index.components.SystemUsers(page.getByTestId('systemUsersSection'));
34
+ this.mobileSecurity = new index.components.SystemConsoleMobileSecurity(page.getByTestId('sysconsole_section_MobileSecuritySettings'));
35
+ this.featureDiscovery = new index.components.SystemConsoleFeatureDiscovery(page.getByTestId('featureDiscovery'));
33
36
  // Menus & Popovers
34
- this.systemUsersFilterPopover = new components.SystemUsersFilterPopover(page.locator('#systemUsersFilterPopover'));
35
- this.systemUsersRoleMenu = new components.SystemUsersFilterMenu(page.locator('#DropdownInput_filterRole'));
36
- this.systemUsersStatusMenu = new components.SystemUsersFilterMenu(page.locator('#DropdownInput_filterStatus'));
37
- this.systemUsersColumnToggleMenu = new components.SystemUsersColumnToggleMenu(page.locator('#systemUsersColumnTogglerMenu'));
38
- this.systemUsersDateRangeMenu = new components.SystemUsersFilterMenu(page.locator('#systemUsersDateRangeSelectorMenu'));
39
- this.systemUsersActionMenus = Array.from(Array(10).keys()).map((index) => new components.SystemUsersFilterMenu(page.locator(`#actionMenu-systemUsersTable-${index}`)));
40
- this.confirmModal = new components.GenericConfirmModal(page.locator('#confirmModal'));
41
- this.exportModal = new components.GenericConfirmModal(page.getByRole('dialog', { name: 'Export user data' }));
42
- this.saveChangesModal = new components.SystemUsers(page.locator('div.modal-content'));
37
+ this.systemUsersFilterPopover = new index.components.SystemUsersFilterPopover(page.locator('#systemUsersFilterPopover'));
38
+ this.systemUsersRoleMenu = new index.components.SystemUsersFilterMenu(page.locator('#DropdownInput_filterRole'));
39
+ this.systemUsersStatusMenu = new index.components.SystemUsersFilterMenu(page.locator('#DropdownInput_filterStatus'));
40
+ this.systemUsersColumnToggleMenu = new index.components.SystemUsersColumnToggleMenu(page.locator('#systemUsersColumnTogglerMenu'));
41
+ this.systemUsersDateRangeMenu = new index.components.SystemUsersFilterMenu(page.locator('#systemUsersDateRangeSelectorMenu'));
42
+ this.systemUsersActionMenus = Array.from(Array(10).keys()).map((index$1) => new index.components.SystemUsersFilterMenu(page.locator(`#actionMenu-systemUsersTable-${index$1}`)));
43
+ this.confirmModal = new index.components.GenericConfirmModal(page.locator('#confirmModal'));
44
+ this.exportModal = new index.components.GenericConfirmModal(page.getByRole('dialog', { name: 'Export user data' }));
45
+ this.saveChangesModal = new index.components.SystemUsers(page.locator('div.modal-content'));
43
46
  }
44
47
  async toBeVisible() {
45
48
  await this.page.waitForLoadState('networkidle');
@@ -56,3 +59,6 @@ export default class SystemConsolePage {
56
59
  await this.saveChangesModal.container.locator('button.btn-primary:has-text("Reset")').click();
57
60
  }
58
61
  }
62
+
63
+ module.exports = SystemConsolePage;
64
+ //# sourceMappingURL=system_console.js.map
package/dist/util.js CHANGED
@@ -1,9 +1,12 @@
1
+ 'use strict';
2
+
3
+ var uuid = require('uuid');
4
+
1
5
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
6
  // See LICENSE.txt for license information.
3
- import { v4 as uuidv4 } from 'uuid';
4
7
  const second = 1000;
5
8
  const minute = 60 * 1000;
6
- export const duration = {
9
+ const duration = {
7
10
  half_sec: second / 2,
8
11
  one_sec: second,
9
12
  two_sec: second * 2,
@@ -19,22 +22,30 @@ export const duration = {
19
22
  * @param {number} ms - duration in millisecond
20
23
  * @return {Promise} promise with timeout
21
24
  */
22
- export const wait = async (ms = 0) => {
25
+ const wait = async (ms = 0) => {
23
26
  return new Promise((resolve) => setTimeout(resolve, ms));
24
27
  };
25
28
  /**
26
29
  * @param {Number} length - length on random string to return, e.g. 7 (default)
27
30
  * @return {String} random string
28
31
  */
29
- export function getRandomId(length = 7) {
32
+ function getRandomId(length = 7) {
30
33
  const MAX_SUBSTRING_INDEX = 27;
31
- return uuidv4()
34
+ return uuid.v4()
32
35
  .replace(/-/g, '')
33
36
  .substring(MAX_SUBSTRING_INDEX - length, MAX_SUBSTRING_INDEX);
34
37
  }
35
38
  // Default team is meant for sysadmin's primary team,
36
39
  // selected for compatibility with existing local development.
37
40
  // It should not be used for testing.
38
- export const defaultTeam = { name: 'ad-1', displayName: 'eligendi', type: 'O' };
39
- export const illegalRe = /[/?<>\\:*|":&();]/g;
40
- export const simpleEmailRe = /\S+@\S+\.\S+/;
41
+ const defaultTeam = { name: 'ad-1', displayName: 'eligendi'};
42
+ const illegalRe = /[/?<>\\:*|":&();]/g;
43
+ const simpleEmailRe = /\S+@\S+\.\S+/;
44
+
45
+ exports.defaultTeam = defaultTeam;
46
+ exports.duration = duration;
47
+ exports.getRandomId = getRandomId;
48
+ exports.illegalRe = illegalRe;
49
+ exports.simpleEmailRe = simpleEmailRe;
50
+ exports.wait = wait;
51
+ //# sourceMappingURL=util.js.map
@@ -1,31 +1,37 @@
1
+ 'use strict';
2
+
3
+ var os = require('node:os');
4
+ var chalk = require('chalk');
5
+ var test = require('@playwright/test');
6
+ var percy = require('./percy.js');
7
+ var util = require('../util.js');
8
+ var test_config = require('../test_config.js');
9
+
1
10
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
11
  // See LICENSE.txt for license information.
3
- import os from 'node:os';
4
- import chalk from 'chalk';
5
- import { expect } from '@playwright/test';
6
- import snapshotWithPercy from './percy';
7
- import { duration, illegalRe, wait } from '@/util';
8
- import { testConfig } from '@/test_config';
9
- export async function matchSnapshot(testInfo, testArgs, options = {}) {
12
+ async function matchSnapshot(testInfo, testArgs, options = {}) {
10
13
  if (os.platform() !== 'linux') {
11
14
  // eslint-disable-next-line no-console
12
15
  console.log(chalk.yellow(`^ Warning: No visual test performed. Run in Linux or Playwright docker image to match snapshot.`));
13
16
  return;
14
17
  }
15
- if (testConfig.snapshotEnabled || testConfig.percyEnabled) {
18
+ if (test_config.testConfig.snapshotEnabled || test_config.testConfig.percyEnabled) {
16
19
  await testArgs.page.waitForLoadState('networkidle');
17
20
  await testArgs.page.waitForLoadState('domcontentloaded');
18
- await wait(duration.half_sec);
21
+ await util.wait(util.duration.half_sec);
19
22
  }
20
- if (testConfig.snapshotEnabled) {
23
+ if (test_config.testConfig.snapshotEnabled) {
21
24
  // Visual test with built-in snapshot
22
- const filename = testInfo.title.trim().replace(illegalRe, '').replace(/\s/g, '-').trim().toLowerCase();
23
- await expect(testArgs.page).toHaveScreenshot(`${filename}.png`, { fullPage: true, ...options });
25
+ const filename = testInfo.title.trim().replace(util.illegalRe, '').replace(/\s/g, '-').trim().toLowerCase();
26
+ await test.expect(testArgs.page).toHaveScreenshot(`${filename}.png`, { fullPage: true, ...options });
24
27
  }
25
- if (testConfig.percyEnabled) {
28
+ if (test_config.testConfig.percyEnabled) {
26
29
  // Used to easily identify the screenshot when viewing from third-party service provider.
27
30
  const name = `[${testInfo.project.name}, ${testArgs?.viewport?.width}px] > ${testInfo.file} > ${testInfo.title}`;
28
31
  // Visual test with Percy
29
- await snapshotWithPercy(name, testArgs);
32
+ await percy(name, testArgs);
30
33
  }
31
34
  }
35
+
36
+ exports.matchSnapshot = matchSnapshot;
37
+ //# sourceMappingURL=index.js.map
@@ -1,9 +1,12 @@
1
+ 'use strict';
2
+
3
+ var percySnapshot = require('@percy/playwright');
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 percySnapshot from '@percy/playwright';
4
- import { testConfig } from '@/test_config';
5
- export default async function snapshotWithPercy(name, testArgs) {
6
- if (testArgs.browserName === 'chromium' && testConfig.percyEnabled && testArgs.viewport) {
8
+ async function snapshotWithPercy(name, testArgs) {
9
+ if (testArgs.browserName === 'chromium' && test_config.testConfig.percyEnabled && testArgs.viewport) {
7
10
  const { page, viewport } = testArgs;
8
11
  try {
9
12
  await percySnapshot(page, name, { widths: [viewport.width], minHeight: viewport.height });
@@ -15,3 +18,6 @@ export default async function snapshotWithPercy(name, testArgs) {
15
18
  }
16
19
  }
17
20
  }
21
+
22
+ module.exports = snapshotWithPercy;
23
+ //# sourceMappingURL=percy.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mattermost/playwright-lib",
3
- "version": "10.6.0",
3
+ "version": "10.6.1",
4
4
  "description": "A comprehensive end-to-end testing library for Mattermost web, desktop and plugin applications using Playwright",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,9 +0,0 @@
1
- // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
- // See LICENSE.txt for license information.
3
- export { makeClient } from './client';
4
- export { createRandomChannel } from './channel';
5
- export { getOnPremServerConfig } from './default_config';
6
- export { initSetup, getAdminClient } from './init';
7
- export { createRandomPost } from './post';
8
- export { createRandomTeam } from './team';
9
- export { createRandomUser, getDefaultAdminUser } from './user';
@@ -1 +0,0 @@
1
- {"root":["../src/browser_context.ts","../src/constant.ts","../src/file.ts","../src/flag.ts","../src/global_setup.ts","../src/index.ts","../src/mock_browser_api.ts","../src/test_action.ts","../src/test_config.ts","../src/test_fixture.ts","../src/types.ts","../src/util.ts","../src/server/channel.ts","../src/server/client.ts","../src/server/default_config.ts","../src/server/index.ts","../src/server/init.ts","../src/server/post.ts","../src/server/team.ts","../src/server/user.ts","../src/ui/components/footer.ts","../src/ui/components/global_header.ts","../src/ui/components/index.ts","../src/ui/components/main_header.ts","../src/ui/components/channels/app_bar.ts","../src/ui/components/channels/center_view.ts","../src/ui/components/channels/delete_post_confirmation_dialog.ts","../src/ui/components/channels/delete_post_modal.ts","../src/ui/components/channels/emoji_gif_picker.ts","../src/ui/components/channels/find_channels_modal.ts","../src/ui/components/channels/generic_confirm_modal.ts","../src/ui/components/channels/header.ts","../src/ui/components/channels/message_priority.ts","../src/ui/components/channels/post.ts","../src/ui/components/channels/post_create.ts","../src/ui/components/channels/post_dot_menu.ts","../src/ui/components/channels/post_edit.ts","../src/ui/components/channels/post_menu.ts","../src/ui/components/channels/post_reminder_menu.ts","../src/ui/components/channels/restore_post_confirmation_dialog.ts","../src/ui/components/channels/scheduled_draft_menu.ts","../src/ui/components/channels/scheduled_draft_modal.ts","../src/ui/components/channels/search_popover.ts","../src/ui/components/channels/sidebar_left.ts","../src/ui/components/channels/sidebar_right.ts","../src/ui/components/channels/thread_footer.ts","../src/ui/components/channels/user_profile_popover.ts","../src/ui/components/channels/settings/notification_settings.ts","../src/ui/components/channels/settings/settings_modal.ts","../src/ui/components/system_console/navbar.ts","../src/ui/components/system_console/sidebar.ts","../src/ui/components/system_console/sections/system_users/column_toggle_menu.ts","../src/ui/components/system_console/sections/system_users/feature_discovery.ts","../src/ui/components/system_console/sections/system_users/filter_menu.ts","../src/ui/components/system_console/sections/system_users/filter_popover.ts","../src/ui/components/system_console/sections/system_users/mobile_security.ts","../src/ui/components/system_console/sections/system_users/system_users.ts","../src/ui/pages/channels.ts","../src/ui/pages/drafts.ts","../src/ui/pages/index.ts","../src/ui/pages/landing_login.ts","../src/ui/pages/login.ts","../src/ui/pages/reset_password.ts","../src/ui/pages/scheduled_draft.ts","../src/ui/pages/signup.ts","../src/ui/pages/system_console.ts","../src/visual/index.ts","../src/visual/percy.ts"],"version":"5.7.3"}
package/dist/types.js DELETED
@@ -1,3 +0,0 @@
1
- // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
2
- // See LICENSE.txt for license information.
3
- export {};