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