@mattermost/loadtest-browser-lib 1.31.0-2 → 1.31.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.
- package/README.md +12 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -6
- package/dist/simulation_helpers/landing_page.d.ts +2 -2
- package/dist/simulation_helpers/landing_page.d.ts.map +1 -1
- package/dist/simulation_helpers/login_page.d.ts +2 -2
- package/dist/simulation_helpers/login_page.d.ts.map +1 -1
- package/dist/simulation_helpers/select_team_page.d.ts +2 -2
- package/dist/simulation_helpers/select_team_page.d.ts.map +1 -1
- package/dist/types/simulation.d.ts +2 -2
- package/dist/types/simulation.d.ts.map +1 -1
- package/package.json +15 -15
- package/dist/simulation_helpers/landing_page.js +0 -23
- package/dist/simulation_helpers/login_page.js +0 -19
- package/dist/simulation_helpers/select_team_page.js +0 -30
- package/dist/types/log.js +0 -3
- package/dist/types/simulation.js +0 -13
package/README.md
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
# Mattermost Load Test NG
|
|
1
|
+
# Mattermost Load Test NG Browser Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This library provides shared types, utilities, and helper functions for browser-based load testing of Mattermost using Playwright.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
+
To build and install the library, run:
|
|
8
|
+
|
|
7
9
|
```bash
|
|
8
|
-
|
|
10
|
+
make build
|
|
9
11
|
```
|
|
12
|
+
|
|
13
|
+
This command compiles the code, generates type declarations, and packages the library. The resulting package will be located in the `browser/packs` directory.
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
|
|
17
|
+
After making changes to the library, run the build command again to update the package in the `browser/packs` directory.
|
|
18
|
+
To publish a new version of the library, please contact the Mattermost team to have the package published to the npm registry.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type { BrowserInstance, SimulationRegistryItem } from
|
|
2
|
-
export type { Logger } from
|
|
3
|
-
export { SessionState } from
|
|
4
|
-
export { performLogin } from
|
|
5
|
-
export { handleLandingPage } from
|
|
6
|
-
export { performTeamSelection } from
|
|
1
|
+
export type { BrowserInstance, SimulationRegistryItem, } from "./types/simulation.js";
|
|
2
|
+
export type { Logger } from "./types/log.js";
|
|
3
|
+
export { SessionState } from "./types/simulation.js";
|
|
4
|
+
export { performLogin } from "./simulation_helpers/login_page.js";
|
|
5
|
+
export { handleLandingPage } from "./simulation_helpers/landing_page.js";
|
|
6
|
+
export { performTeamSelection } from "./simulation_helpers/select_team_page.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,eAAe,EACf,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,79 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// src/types/simulation.ts
|
|
2
|
+
var SessionState = /* @__PURE__ */ ((SessionState2) => {
|
|
3
|
+
SessionState2["CREATING"] = "creating";
|
|
4
|
+
SessionState2["CREATION_FAILED"] = "creation_failed";
|
|
5
|
+
SessionState2["CREATED"] = "created";
|
|
6
|
+
SessionState2["STARTED"] = "started";
|
|
7
|
+
SessionState2["STOPPING"] = "stopping";
|
|
8
|
+
SessionState2["COMPLETED"] = "completed";
|
|
9
|
+
SessionState2["FAILED"] = "failed";
|
|
10
|
+
SessionState2["CLEANUP_FAILED"] = "cleanup_failed";
|
|
11
|
+
return SessionState2;
|
|
12
|
+
})(SessionState || {});
|
|
13
|
+
|
|
14
|
+
// src/simulation_helpers/login_page.ts
|
|
15
|
+
import { LoginPage } from "@mattermost/playwright-lib";
|
|
16
|
+
async function performLogin(page, log, { userId, password }) {
|
|
17
|
+
log.info("run--performLogin");
|
|
18
|
+
try {
|
|
19
|
+
const loginPage = new LoginPage(page);
|
|
20
|
+
await loginPage.toBeVisible();
|
|
21
|
+
await loginPage.loginInput.fill(userId);
|
|
22
|
+
await loginPage.passwordInput.waitFor({ state: "visible" });
|
|
23
|
+
await loginPage.passwordInput.fill(password);
|
|
24
|
+
await loginPage.signInButton.waitFor({ state: "visible" });
|
|
25
|
+
await loginPage.signInButton.click();
|
|
26
|
+
log.info("pass--performLogin");
|
|
27
|
+
} catch (error) {
|
|
28
|
+
throw { error, testId: "performLogin" };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/simulation_helpers/landing_page.ts
|
|
33
|
+
import { LandingLoginPage } from "@mattermost/playwright-lib";
|
|
34
|
+
async function handleLandingPage(page, log) {
|
|
35
|
+
log.info("run--handleLandingPage");
|
|
36
|
+
try {
|
|
37
|
+
const isLandingPage = await page.waitForURL((url) => url.pathname.includes("/landing")).then(() => true).catch(() => false);
|
|
38
|
+
if (!isLandingPage) {
|
|
39
|
+
throw new Error("Not on landing page");
|
|
40
|
+
}
|
|
41
|
+
const landingLoginPage = new LandingLoginPage(page);
|
|
42
|
+
await landingLoginPage.toBeVisible();
|
|
43
|
+
await landingLoginPage.viewInBrowserButton.click();
|
|
44
|
+
log.info("pass--handleLandingPage");
|
|
45
|
+
} catch {
|
|
46
|
+
log.info("skip--handleLandingPage");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/simulation_helpers/select_team_page.ts
|
|
51
|
+
async function performTeamSelection(page, log, { teamName }) {
|
|
52
|
+
log.info("run--performTeamSelection");
|
|
53
|
+
try {
|
|
54
|
+
const isTeamSelectionPage = await page.waitForURL((url) => url.pathname.includes("/select_team")).then(() => true).catch(() => false);
|
|
55
|
+
if (!isTeamSelectionPage) {
|
|
56
|
+
throw new Error("Not on team selection page");
|
|
57
|
+
}
|
|
58
|
+
await page.waitForSelector(".signup-team-dir a");
|
|
59
|
+
let teamIconElement;
|
|
60
|
+
if (teamName) {
|
|
61
|
+
teamIconElement = page.locator(".signup-team-dir a").filter({
|
|
62
|
+
has: page.locator(".signup-team-dir__name", { hasText: teamName })
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
teamIconElement = page.locator(".signup-team-dir a").first();
|
|
66
|
+
}
|
|
67
|
+
await teamIconElement.click();
|
|
68
|
+
await page.waitForURL((url) => !url.pathname.includes("/select_team"));
|
|
69
|
+
log.info("pass--performTeamSelection");
|
|
70
|
+
} catch {
|
|
71
|
+
log.info("skip--performTeamSelection");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
SessionState,
|
|
76
|
+
handleLandingPage,
|
|
77
|
+
performLogin,
|
|
78
|
+
performTeamSelection
|
|
79
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Page } from
|
|
2
|
-
import type { Logger } from
|
|
1
|
+
import type { Page } from "@playwright/test";
|
|
2
|
+
import type { Logger } from "../types/log.js";
|
|
3
3
|
export declare function handleLandingPage(page: Page, log: Logger): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=landing_page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landing_page.d.ts","sourceRoot":"","sources":["../../src/simulation_helpers/landing_page.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"landing_page.d.ts","sourceRoot":"","sources":["../../src/simulation_helpers/landing_page.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAsBf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login_page.d.ts","sourceRoot":"","sources":["../../src/simulation_helpers/login_page.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"login_page.d.ts","sourceRoot":"","sources":["../../src/simulation_helpers/login_page.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAsB,YAAY,CAChC,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,SAAS,GAC9B,OAAO,CAAC,IAAI,CAAC,CAmBf"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Page } from
|
|
2
|
-
import type { Logger } from
|
|
1
|
+
import type { Page } from "@playwright/test";
|
|
2
|
+
import type { Logger } from "../types/log.js";
|
|
3
3
|
type ExtraArgs = {
|
|
4
4
|
/**
|
|
5
5
|
* If left empty, the first team in the list will be selected.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select_team_page.d.ts","sourceRoot":"","sources":["../../src/simulation_helpers/select_team_page.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"select_team_page.d.ts","sourceRoot":"","sources":["../../src/simulation_helpers/select_team_page.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,KAAK,SAAS,GAAG;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,EAAE,QAAQ,EAAE,EAAE,SAAS,GACtB,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Browser, BrowserContext, Page } from
|
|
2
|
-
import type { Logger } from
|
|
1
|
+
import type { Browser, BrowserContext, Page } from "@playwright/test";
|
|
2
|
+
import type { Logger } from "./log.js";
|
|
3
3
|
export declare enum SessionState {
|
|
4
4
|
CREATING = "creating",// The browser and other instances are being created
|
|
5
5
|
CREATION_FAILED = "creation_failed",// The browser or any other instances failed to be created
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulation.d.ts","sourceRoot":"","sources":["../../src/types/simulation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"simulation.d.ts","sourceRoot":"","sources":["../../src/types/simulation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,oBAAY,YAAY;IACtB,QAAQ,aAAa,CAAE,oDAAoD;IAC3E,eAAe,oBAAoB,CAAE,0DAA0D;IAC/F,OAAO,YAAY,CAAE,4DAA4D;IACjF,OAAO,YAAY,CAAE,uBAAuB;IAC5C,QAAQ,aAAa,CAAE,mCAAmC;IAC1D,SAAS,cAAc,CAAE,sCAAsC;IAC/D,MAAM,WAAW,CAAE,+BAA+B;IAClD,cAAc,mBAAmB;CAClC;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,QAAQ,EAAE,CACR,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,OAAO,KAChB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mattermost/loadtest-browser-lib",
|
|
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.1",
|
|
4
4
|
"description": "Shared types, helpers and utilities for Mattermost browser-based load testing simulations using Playwright",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/mattermost/mattermost-load-test-ng.git"
|
|
8
|
-
},
|
|
9
|
-
"bugs": {
|
|
10
|
-
"url": "https://github.com/mattermost/mattermost-load-test-ng/issues"
|
|
11
|
-
},
|
|
12
|
-
"homepage": "https://github.com/mattermost/mattermost-load-test-ng/tree/master/browser/src/lib#readme",
|
|
13
5
|
"type": "module",
|
|
14
6
|
"main": "dist/index.js",
|
|
15
7
|
"types": "dist/index.d.ts",
|
|
@@ -30,13 +22,21 @@
|
|
|
30
22
|
"npm": ">=10 || >=11"
|
|
31
23
|
},
|
|
32
24
|
"scripts": {
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"@mattermost/playwright-lib": ">=11.4.0-0",
|
|
37
|
-
"@playwright/test": ">=1.57.0"
|
|
25
|
+
"lint:check": "prettier --check 'src/**/*.ts' && eslint 'src/**/*.ts'",
|
|
26
|
+
"lint:fix": "prettier --write 'src/**/*.ts' && eslint 'src/**/*.ts' --fix",
|
|
27
|
+
"types:check": "tsc --noEmit"
|
|
38
28
|
},
|
|
39
29
|
"devDependencies": {
|
|
40
|
-
"
|
|
30
|
+
"@eslint/js": "^9.19.0",
|
|
31
|
+
"@types/node": "^25.1.0",
|
|
32
|
+
"esbuild": "^0.27.2",
|
|
33
|
+
"eslint": "^9.19.0",
|
|
34
|
+
"prettier": "^3.8.1",
|
|
35
|
+
"typescript": "^5.9.3",
|
|
36
|
+
"typescript-eslint": "^8.22.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@mattermost/playwright-lib": "^11.4.0",
|
|
40
|
+
"@playwright/test": "^1.58.2"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
import { LandingLoginPage } from '@mattermost/playwright-lib';
|
|
4
|
-
export async function handleLandingPage(page, log) {
|
|
5
|
-
log.info('run--handleLandingPage');
|
|
6
|
-
try {
|
|
7
|
-
const isLandingPage = await page
|
|
8
|
-
.waitForURL((url) => url.pathname.includes('/landing'))
|
|
9
|
-
.then(() => true)
|
|
10
|
-
.catch(() => false);
|
|
11
|
-
if (!isLandingPage) {
|
|
12
|
-
throw new Error('Not on landing page');
|
|
13
|
-
}
|
|
14
|
-
const landingLoginPage = new LandingLoginPage(page);
|
|
15
|
-
await landingLoginPage.toBeVisible();
|
|
16
|
-
await landingLoginPage.viewInBrowserButton.click();
|
|
17
|
-
log.info('pass--handleLandingPage');
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
// If checkbox not found, log and skip
|
|
21
|
-
log.info('skip--handleLandingPage');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
import { LoginPage } from '@mattermost/playwright-lib';
|
|
4
|
-
export async function performLogin(page, log, { userId, password }) {
|
|
5
|
-
log.info('run--performLogin');
|
|
6
|
-
try {
|
|
7
|
-
const loginPage = new LoginPage(page);
|
|
8
|
-
await loginPage.toBeVisible();
|
|
9
|
-
await loginPage.loginInput.fill(userId);
|
|
10
|
-
await loginPage.passwordInput.waitFor({ state: 'visible' });
|
|
11
|
-
await loginPage.passwordInput.fill(password);
|
|
12
|
-
await loginPage.signInButton.waitFor({ state: 'visible' });
|
|
13
|
-
await loginPage.signInButton.click();
|
|
14
|
-
log.info('pass--performLogin');
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
throw { error, testId: 'performLogin' };
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
export async function performTeamSelection(page, log, { teamName }) {
|
|
4
|
-
log.info('run--performTeamSelection');
|
|
5
|
-
try {
|
|
6
|
-
const isTeamSelectionPage = await page
|
|
7
|
-
.waitForURL((url) => url.pathname.includes('/select_team'))
|
|
8
|
-
.then(() => true)
|
|
9
|
-
.catch(() => false);
|
|
10
|
-
if (!isTeamSelectionPage) {
|
|
11
|
-
throw new Error('Not on team selection page');
|
|
12
|
-
}
|
|
13
|
-
await page.waitForSelector('.signup-team-dir a');
|
|
14
|
-
let teamIconElement;
|
|
15
|
-
if (teamName) {
|
|
16
|
-
teamIconElement = page.locator('.signup-team-dir a').filter({
|
|
17
|
-
has: page.locator('.signup-team-dir__name', { hasText: teamName }),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
teamIconElement = page.locator('.signup-team-dir a').first();
|
|
22
|
-
}
|
|
23
|
-
await teamIconElement.click();
|
|
24
|
-
await page.waitForURL((url) => !url.pathname.includes('/select_team'));
|
|
25
|
-
log.info('pass--performTeamSelection');
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
log.info('skip--performTeamSelection');
|
|
29
|
-
}
|
|
30
|
-
}
|
package/dist/types/log.js
DELETED
package/dist/types/simulation.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
export var SessionState;
|
|
4
|
-
(function (SessionState) {
|
|
5
|
-
SessionState["CREATING"] = "creating";
|
|
6
|
-
SessionState["CREATION_FAILED"] = "creation_failed";
|
|
7
|
-
SessionState["CREATED"] = "created";
|
|
8
|
-
SessionState["STARTED"] = "started";
|
|
9
|
-
SessionState["STOPPING"] = "stopping";
|
|
10
|
-
SessionState["COMPLETED"] = "completed";
|
|
11
|
-
SessionState["FAILED"] = "failed";
|
|
12
|
-
SessionState["CLEANUP_FAILED"] = "cleanup_failed";
|
|
13
|
-
})(SessionState || (SessionState = {}));
|