samaro-uitest 1.0.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/LICENSE +21 -0
- package/README.md +336 -0
- package/bin/samaro-allure.js +172 -0
- package/bin/samaro-init.js +278 -0
- package/bin/samaro-test.js +36 -0
- package/config/index.d.ts +4 -0
- package/config/index.d.ts.map +1 -0
- package/config/index.js +11 -0
- package/config/index.js.map +1 -0
- package/config/index.ts +3 -0
- package/config/playwright.component.config.d.ts +12 -0
- package/config/playwright.component.config.d.ts.map +1 -0
- package/config/playwright.component.config.js +42 -0
- package/config/playwright.component.config.js.map +1 -0
- package/config/playwright.component.config.ts +60 -0
- package/config/playwright.config.d.ts +14 -0
- package/config/playwright.config.d.ts.map +1 -0
- package/config/playwright.config.js +53 -0
- package/config/playwright.config.js.map +1 -0
- package/config/playwright.config.ts +76 -0
- package/config/test-setup.ts +17 -0
- package/config/vitest.config.d.ts +13 -0
- package/config/vitest.config.d.ts.map +1 -0
- package/config/vitest.config.js +53 -0
- package/config/vitest.config.js.map +1 -0
- package/config/vitest.config.ts +64 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/playwright.component.config.d.ts +12 -0
- package/dist/config/playwright.component.config.d.ts.map +1 -0
- package/dist/config/playwright.component.config.js +39 -0
- package/dist/config/playwright.component.config.js.map +1 -0
- package/dist/config/playwright.config.d.ts +14 -0
- package/dist/config/playwright.config.d.ts.map +1 -0
- package/dist/config/playwright.config.js +50 -0
- package/dist/config/playwright.config.js.map +1 -0
- package/dist/config/test-setup.d.ts +3 -0
- package/dist/config/test-setup.d.ts.map +1 -0
- package/dist/config/test-setup.js +17 -0
- package/dist/config/test-setup.js.map +1 -0
- package/dist/config/vitest.config.d.ts +13 -0
- package/dist/config/vitest.config.d.ts.map +1 -0
- package/dist/config/vitest.config.js +46 -0
- package/dist/config/vitest.config.js.map +1 -0
- package/dist/helpers/api.d.ts +69 -0
- package/dist/helpers/api.d.ts.map +1 -0
- package/dist/helpers/api.js +154 -0
- package/dist/helpers/api.js.map +1 -0
- package/dist/helpers/auth.d.ts +35 -0
- package/dist/helpers/auth.d.ts.map +1 -0
- package/dist/helpers/auth.js +96 -0
- package/dist/helpers/auth.js.map +1 -0
- package/dist/helpers/config.d.ts +34 -0
- package/dist/helpers/config.d.ts.map +1 -0
- package/dist/helpers/config.js +63 -0
- package/dist/helpers/config.js.map +1 -0
- package/dist/helpers/debug.d.ts +48 -0
- package/dist/helpers/debug.d.ts.map +1 -0
- package/dist/helpers/debug.js +76 -0
- package/dist/helpers/debug.js.map +1 -0
- package/dist/helpers/index.d.ts +6 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +11 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/setup.d.ts +50 -0
- package/dist/helpers/setup.d.ts.map +1 -0
- package/dist/helpers/setup.js +95 -0
- package/dist/helpers/setup.js.map +1 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +38 -0
- package/dist/src/index.js.map +1 -0
- package/helpers/api.d.ts +69 -0
- package/helpers/api.d.ts.map +1 -0
- package/helpers/api.js +163 -0
- package/helpers/api.js.map +1 -0
- package/helpers/api.ts +224 -0
- package/helpers/auth.d.ts +35 -0
- package/helpers/auth.d.ts.map +1 -0
- package/helpers/auth.js +104 -0
- package/helpers/auth.js.map +1 -0
- package/helpers/auth.ts +125 -0
- package/helpers/config.d.ts +34 -0
- package/helpers/config.d.ts.map +1 -0
- package/helpers/config.js +70 -0
- package/helpers/config.js.map +1 -0
- package/helpers/config.ts +80 -0
- package/helpers/debug.d.ts +48 -0
- package/helpers/debug.d.ts.map +1 -0
- package/helpers/debug.js +86 -0
- package/helpers/debug.js.map +1 -0
- package/helpers/debug.ts +111 -0
- package/helpers/index.d.ts +6 -0
- package/helpers/index.d.ts.map +1 -0
- package/helpers/index.js +47 -0
- package/helpers/index.js.map +1 -0
- package/helpers/index.ts +62 -0
- package/helpers/setup.d.ts +50 -0
- package/helpers/setup.d.ts.map +1 -0
- package/helpers/setup.js +137 -0
- package/helpers/setup.js.map +1 -0
- package/helpers/setup.ts +144 -0
- package/package.json +94 -0
- package/schematics/collection.json +11 -0
- package/schematics/ng-add/index.js +121 -0
- package/schematics/ng-add/schema.json +26 -0
- package/scripts/check-allure-results.js +269 -0
- package/types/allure.d.ts +76 -0
- package/types/global.d.ts +49 -0
package/helpers/auth.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Page } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
export interface UserCredentials {
|
|
4
|
+
username: string;
|
|
5
|
+
email: string;
|
|
6
|
+
password: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface AuthResult {
|
|
10
|
+
success: boolean;
|
|
11
|
+
error?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Register a new user via UI
|
|
16
|
+
*/
|
|
17
|
+
export async function register(
|
|
18
|
+
page: Page,
|
|
19
|
+
username: string,
|
|
20
|
+
email: string,
|
|
21
|
+
password: string
|
|
22
|
+
): Promise<AuthResult> {
|
|
23
|
+
await page.goto('/register', { waitUntil: 'networkidle' });
|
|
24
|
+
await page.fill('input[name="username"]', username);
|
|
25
|
+
await page.fill('input[name="email"]', email);
|
|
26
|
+
await page.fill('input[name="password"]', password);
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
await Promise.all([
|
|
30
|
+
page.waitForURL('/', { timeout: 10000 }),
|
|
31
|
+
page.click('button[type="submit"]')
|
|
32
|
+
]);
|
|
33
|
+
return { success: true };
|
|
34
|
+
} catch (error) {
|
|
35
|
+
const errorMsg = await page.locator('.error-messages, [data-testid="error-message"]').textContent().catch(() => '');
|
|
36
|
+
if (errorMsg) {
|
|
37
|
+
return { success: false, error: `Registration failed: ${errorMsg.trim()}` };
|
|
38
|
+
}
|
|
39
|
+
return { success: false, error: `Registration failed: ${error}` };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Login a user via UI
|
|
45
|
+
*/
|
|
46
|
+
export async function login(
|
|
47
|
+
page: Page,
|
|
48
|
+
email: string,
|
|
49
|
+
password: string
|
|
50
|
+
): Promise<AuthResult> {
|
|
51
|
+
await page.goto('/login', { waitUntil: 'networkidle' });
|
|
52
|
+
await page.fill('input[name="email"]', email);
|
|
53
|
+
await page.fill('input[name="password"]', password);
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
await Promise.all([
|
|
57
|
+
page.waitForURL('/', { timeout: 10000 }),
|
|
58
|
+
page.click('button[type="submit"]')
|
|
59
|
+
]);
|
|
60
|
+
return { success: true };
|
|
61
|
+
} catch (error) {
|
|
62
|
+
const errorMsg = await page.locator('.error-messages, [data-testid="error-message"]').textContent().catch(() => '');
|
|
63
|
+
if (errorMsg) {
|
|
64
|
+
return { success: false, error: `Login failed: ${errorMsg.trim()}` };
|
|
65
|
+
}
|
|
66
|
+
return { success: false, error: `Login failed: ${error}` };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Logout a user via UI
|
|
72
|
+
*/
|
|
73
|
+
export async function logout(page: Page): Promise<void> {
|
|
74
|
+
// Try different logout patterns
|
|
75
|
+
const settingsLink = page.locator('a[href="/settings"], a:has-text("Settings"), [data-testid="settings-link"]').first();
|
|
76
|
+
|
|
77
|
+
if (await settingsLink.isVisible().catch(() => false)) {
|
|
78
|
+
await settingsLink.click();
|
|
79
|
+
await page.waitForURL('/settings', { timeout: 5000 });
|
|
80
|
+
} else {
|
|
81
|
+
await page.goto('/settings');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const logoutButton = page.locator('button:has-text("logout"), button:has-text("Logout"), [data-testid="logout-button"]').first();
|
|
85
|
+
|
|
86
|
+
await Promise.all([
|
|
87
|
+
page.waitForURL('/', { timeout: 10000 }),
|
|
88
|
+
logoutButton.click()
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Generate unique user credentials to avoid conflicts
|
|
94
|
+
*/
|
|
95
|
+
export function generateUniqueUser(): UserCredentials {
|
|
96
|
+
const timestamp = Date.now();
|
|
97
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
98
|
+
return {
|
|
99
|
+
username: `testuser_${timestamp}_${random}`,
|
|
100
|
+
email: `test_${timestamp}_${random}@example.com`,
|
|
101
|
+
password: 'TestPassword123!',
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Check if user is logged in
|
|
107
|
+
*/
|
|
108
|
+
export async function isLoggedIn(page: Page): Promise<boolean> {
|
|
109
|
+
// Check for logout button or user-specific elements
|
|
110
|
+
const logoutVisible = await page.locator('a[href="/settings"], [data-testid="logout-button"]').isVisible().catch(() => false);
|
|
111
|
+
const loginVisible = await page.locator('a[href="/login"]').isVisible().catch(() => false);
|
|
112
|
+
|
|
113
|
+
return logoutVisible && !loginVisible;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Get current username if logged in
|
|
118
|
+
*/
|
|
119
|
+
export async function getCurrentUsername(page: Page): Promise<string | null> {
|
|
120
|
+
const usernameElement = page.locator('[data-testid="username"], .user-name, .username').first();
|
|
121
|
+
if (await usernameElement.isVisible().catch(() => false)) {
|
|
122
|
+
return usernameElement.textContent();
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration helpers for SamaroUItest
|
|
3
|
+
*/
|
|
4
|
+
export interface SamaroConfig {
|
|
5
|
+
apiMode: boolean;
|
|
6
|
+
apiBase: string;
|
|
7
|
+
debugInterfaceName: string;
|
|
8
|
+
timeouts: {
|
|
9
|
+
navigation: number;
|
|
10
|
+
action: number;
|
|
11
|
+
expectation: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get SamaroUItest configuration from environment variables
|
|
16
|
+
*/
|
|
17
|
+
export declare function getConfig(): SamaroConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Check if running in CI environment
|
|
20
|
+
*/
|
|
21
|
+
export declare function isCI(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Check if running in debug mode
|
|
24
|
+
*/
|
|
25
|
+
export declare function isDebug(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Get browser launch options based on environment
|
|
28
|
+
*/
|
|
29
|
+
export declare function getBrowserLaunchOptions(): Record<string, any>;
|
|
30
|
+
/**
|
|
31
|
+
* Set environment variables for test configuration
|
|
32
|
+
*/
|
|
33
|
+
export declare function setTestEnv(vars: Partial<SamaroConfig>): void;
|
|
34
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE;QACR,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAWxC;AAED;;GAEG;AACH,wBAAgB,IAAI,IAAI,OAAO,CAE9B;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,wBAgBtC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAU5D"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration helpers for SamaroUItest
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getConfig = getConfig;
|
|
7
|
+
exports.isCI = isCI;
|
|
8
|
+
exports.isDebug = isDebug;
|
|
9
|
+
exports.getBrowserLaunchOptions = getBrowserLaunchOptions;
|
|
10
|
+
exports.setTestEnv = setTestEnv;
|
|
11
|
+
/**
|
|
12
|
+
* Get SamaroUItest configuration from environment variables
|
|
13
|
+
*/
|
|
14
|
+
function getConfig() {
|
|
15
|
+
return {
|
|
16
|
+
apiMode: process.env.API_MODE?.toLowerCase() !== 'false',
|
|
17
|
+
apiBase: process.env.API_BASE || process.env.NG_API_URL || 'http://localhost:4200/api',
|
|
18
|
+
debugInterfaceName: process.env.DEBUG_INTERFACE_NAME || '__app_debug__',
|
|
19
|
+
timeouts: {
|
|
20
|
+
navigation: parseInt(process.env.TIMEOUT_NAVIGATION || '10000', 10),
|
|
21
|
+
action: parseInt(process.env.TIMEOUT_ACTION || '5000', 10),
|
|
22
|
+
expectation: parseInt(process.env.TIMEOUT_EXPECTATION || '5000', 10),
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check if running in CI environment
|
|
28
|
+
*/
|
|
29
|
+
function isCI() {
|
|
30
|
+
return !!process.env.CI;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if running in debug mode
|
|
34
|
+
*/
|
|
35
|
+
function isDebug() {
|
|
36
|
+
return process.env.DEBUG === 'true' || process.env.PWDEBUG === '1';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get browser launch options based on environment
|
|
40
|
+
*/
|
|
41
|
+
function getBrowserLaunchOptions() {
|
|
42
|
+
const options = {
|
|
43
|
+
headless: !isDebug(),
|
|
44
|
+
};
|
|
45
|
+
if (isCI()) {
|
|
46
|
+
options.args = [
|
|
47
|
+
'--no-sandbox',
|
|
48
|
+
'--disable-setuid-sandbox',
|
|
49
|
+
'--disable-dev-shm-usage',
|
|
50
|
+
'--disable-accelerated-2d-canvas',
|
|
51
|
+
'--disable-gpu',
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
return options;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Set environment variables for test configuration
|
|
58
|
+
*/
|
|
59
|
+
function setTestEnv(vars) {
|
|
60
|
+
if (vars.apiMode !== undefined) {
|
|
61
|
+
process.env.API_MODE = vars.apiMode.toString();
|
|
62
|
+
}
|
|
63
|
+
if (vars.apiBase) {
|
|
64
|
+
process.env.API_BASE = vars.apiBase;
|
|
65
|
+
}
|
|
66
|
+
if (vars.debugInterfaceName) {
|
|
67
|
+
process.env.DEBUG_INTERFACE_NAME = vars.debugInterfaceName;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["config.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAgBH,8BAWC;AAKD,oBAEC;AAKD,0BAEC;AAKD,0DAgBC;AAKD,gCAUC;AAhED;;GAEG;AACH,SAAgB,SAAS;IACvB,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,OAAO;QACxD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,2BAA2B;QACtF,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,eAAe;QACvE,QAAQ,EAAE;YACR,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,OAAO,EAAE,EAAE,CAAC;YACnE,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0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration helpers for SamaroUItest
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface SamaroConfig {
|
|
6
|
+
apiMode: boolean;
|
|
7
|
+
apiBase: string;
|
|
8
|
+
debugInterfaceName: string;
|
|
9
|
+
timeouts: {
|
|
10
|
+
navigation: number;
|
|
11
|
+
action: number;
|
|
12
|
+
expectation: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get SamaroUItest configuration from environment variables
|
|
18
|
+
*/
|
|
19
|
+
export function getConfig(): SamaroConfig {
|
|
20
|
+
return {
|
|
21
|
+
apiMode: process.env.API_MODE?.toLowerCase() !== 'false',
|
|
22
|
+
apiBase: process.env.API_BASE || process.env.NG_API_URL || 'http://localhost:4200/api',
|
|
23
|
+
debugInterfaceName: process.env.DEBUG_INTERFACE_NAME || '__app_debug__',
|
|
24
|
+
timeouts: {
|
|
25
|
+
navigation: parseInt(process.env.TIMEOUT_NAVIGATION || '10000', 10),
|
|
26
|
+
action: parseInt(process.env.TIMEOUT_ACTION || '5000', 10),
|
|
27
|
+
expectation: parseInt(process.env.TIMEOUT_EXPECTATION || '5000', 10),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Check if running in CI environment
|
|
34
|
+
*/
|
|
35
|
+
export function isCI(): boolean {
|
|
36
|
+
return !!process.env.CI;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check if running in debug mode
|
|
41
|
+
*/
|
|
42
|
+
export function isDebug(): boolean {
|
|
43
|
+
return process.env.DEBUG === 'true' || process.env.PWDEBUG === '1';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get browser launch options based on environment
|
|
48
|
+
*/
|
|
49
|
+
export function getBrowserLaunchOptions() {
|
|
50
|
+
const options: Record<string, any> = {
|
|
51
|
+
headless: !isDebug(),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if (isCI()) {
|
|
55
|
+
options.args = [
|
|
56
|
+
'--no-sandbox',
|
|
57
|
+
'--disable-setuid-sandbox',
|
|
58
|
+
'--disable-dev-shm-usage',
|
|
59
|
+
'--disable-accelerated-2d-canvas',
|
|
60
|
+
'--disable-gpu',
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return options;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Set environment variables for test configuration
|
|
69
|
+
*/
|
|
70
|
+
export function setTestEnv(vars: Partial<SamaroConfig>): void {
|
|
71
|
+
if (vars.apiMode !== undefined) {
|
|
72
|
+
process.env.API_MODE = vars.apiMode.toString();
|
|
73
|
+
}
|
|
74
|
+
if (vars.apiBase) {
|
|
75
|
+
process.env.API_BASE = vars.apiBase;
|
|
76
|
+
}
|
|
77
|
+
if (vars.debugInterfaceName) {
|
|
78
|
+
process.env.DEBUG_INTERFACE_NAME = vars.debugInterfaceName;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Page } from '@playwright/test';
|
|
2
|
+
export type AuthState = 'authenticated' | 'unauthenticated' | 'unavailable' | 'loading';
|
|
3
|
+
export interface User {
|
|
4
|
+
username: string;
|
|
5
|
+
email: string;
|
|
6
|
+
bio: string | null;
|
|
7
|
+
image: string | null;
|
|
8
|
+
token: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function setDebugInterfaceName(name: string): void;
|
|
11
|
+
export declare function getDebugInterfaceName(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Get the current JWT token from the app's debug interface.
|
|
14
|
+
* Returns null if no token is set or debug interface is not available.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getToken(page: Page): Promise<string | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Get the current authentication state from the app's debug interface.
|
|
19
|
+
* Returns undefined if debug interface is not available.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getAuthState(page: Page): Promise<AuthState | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the current user from the app's debug interface.
|
|
24
|
+
* Returns null if not authenticated or debug interface is not available.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getCurrentUser(page: Page): Promise<User | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Wait for a specific auth state to be reached.
|
|
29
|
+
* Useful for waiting after login/logout operations.
|
|
30
|
+
*/
|
|
31
|
+
export declare function waitForAuthState(page: Page, expectedState: AuthState, options?: {
|
|
32
|
+
timeout?: number;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Check if the debug interface is available.
|
|
36
|
+
* Can be used to skip tests if implementation doesn't support it.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isDebugInterfaceAvailable(page: Page): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Get all debug data at once (token, auth state, user)
|
|
41
|
+
*/
|
|
42
|
+
export declare function getDebugData(page: Page): Promise<{
|
|
43
|
+
token: string | null;
|
|
44
|
+
authState: AuthState | undefined;
|
|
45
|
+
user: User | null;
|
|
46
|
+
available: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,iBAAiB,GAAG,aAAa,GAAG,SAAS,CAAC;AAExF,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAOD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAExD;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKjE;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAK7E;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAKrE;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,SAAS,EACxB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACjC,OAAO,CAAC,IAAI,CAAC,CAWf;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAI5E;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;IACtD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAcD"}
|
package/helpers/debug.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setDebugInterfaceName = setDebugInterfaceName;
|
|
4
|
+
exports.getDebugInterfaceName = getDebugInterfaceName;
|
|
5
|
+
exports.getToken = getToken;
|
|
6
|
+
exports.getAuthState = getAuthState;
|
|
7
|
+
exports.getCurrentUser = getCurrentUser;
|
|
8
|
+
exports.waitForAuthState = waitForAuthState;
|
|
9
|
+
exports.isDebugInterfaceAvailable = isDebugInterfaceAvailable;
|
|
10
|
+
exports.getDebugData = getDebugData;
|
|
11
|
+
/**
|
|
12
|
+
* Configure the debug interface name (defaults to __app_debug__)
|
|
13
|
+
*/
|
|
14
|
+
let DEBUG_INTERFACE_NAME = '__app_debug__';
|
|
15
|
+
function setDebugInterfaceName(name) {
|
|
16
|
+
DEBUG_INTERFACE_NAME = name;
|
|
17
|
+
}
|
|
18
|
+
function getDebugInterfaceName() {
|
|
19
|
+
return DEBUG_INTERFACE_NAME;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the current JWT token from the app's debug interface.
|
|
23
|
+
* Returns null if no token is set or debug interface is not available.
|
|
24
|
+
*/
|
|
25
|
+
async function getToken(page) {
|
|
26
|
+
return page.evaluate((name) => {
|
|
27
|
+
const debug = window[name];
|
|
28
|
+
return debug?.getToken ? debug.getToken() : null;
|
|
29
|
+
}, DEBUG_INTERFACE_NAME);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the current authentication state from the app's debug interface.
|
|
33
|
+
* Returns undefined if debug interface is not available.
|
|
34
|
+
*/
|
|
35
|
+
async function getAuthState(page) {
|
|
36
|
+
return page.evaluate((name) => {
|
|
37
|
+
const debug = window[name];
|
|
38
|
+
return debug?.getAuthState ? debug.getAuthState() : undefined;
|
|
39
|
+
}, DEBUG_INTERFACE_NAME);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the current user from the app's debug interface.
|
|
43
|
+
* Returns null if not authenticated or debug interface is not available.
|
|
44
|
+
*/
|
|
45
|
+
async function getCurrentUser(page) {
|
|
46
|
+
return page.evaluate((name) => {
|
|
47
|
+
const debug = window[name];
|
|
48
|
+
return debug?.getCurrentUser ? debug.getCurrentUser() : null;
|
|
49
|
+
}, DEBUG_INTERFACE_NAME);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Wait for a specific auth state to be reached.
|
|
53
|
+
* Useful for waiting after login/logout operations.
|
|
54
|
+
*/
|
|
55
|
+
async function waitForAuthState(page, expectedState, options = {}) {
|
|
56
|
+
const timeout = options.timeout ?? 5000;
|
|
57
|
+
await page.waitForFunction((state, name) => {
|
|
58
|
+
const debug = window[name];
|
|
59
|
+
return debug?.getAuthState ? debug.getAuthState() === state : false;
|
|
60
|
+
}, expectedState, DEBUG_INTERFACE_NAME, { timeout });
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check if the debug interface is available.
|
|
64
|
+
* Can be used to skip tests if implementation doesn't support it.
|
|
65
|
+
*/
|
|
66
|
+
async function isDebugInterfaceAvailable(page) {
|
|
67
|
+
return page.evaluate((name) => {
|
|
68
|
+
return typeof window[name] !== 'undefined';
|
|
69
|
+
}, DEBUG_INTERFACE_NAME);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get all debug data at once (token, auth state, user)
|
|
73
|
+
*/
|
|
74
|
+
async function getDebugData(page) {
|
|
75
|
+
const available = await isDebugInterfaceAvailable(page);
|
|
76
|
+
if (!available) {
|
|
77
|
+
return { token: null, authState: undefined, user: null, available: false };
|
|
78
|
+
}
|
|
79
|
+
const [token, authState, user] = await Promise.all([
|
|
80
|
+
getToken(page),
|
|
81
|
+
getAuthState(page),
|
|
82
|
+
getCurrentUser(page),
|
|
83
|
+
]);
|
|
84
|
+
return { token, authState, user, available: true };
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["debug.ts"],"names":[],"mappings":";;AAiBA,sDAEC;AAED,sDAEC;AAMD,4BAKC;AAMD,oCAKC;AAMD,wCAKC;AAMD,4CAeC;AAMD,8DAIC;AAKD,oCAmBC;AAnGD;;GAEG;AACH,IAAI,oBAAoB,GAAG,eAAe,CAAC;AAE3C,S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export type AuthState = 'authenticated' | 'unauthenticated' | 'unavailable' | 'loading';
|
|
4
|
+
|
|
5
|
+
export interface User {
|
|
6
|
+
username: string;
|
|
7
|
+
email: string;
|
|
8
|
+
bio: string | null;
|
|
9
|
+
image: string | null;
|
|
10
|
+
token: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Configure the debug interface name (defaults to __app_debug__)
|
|
15
|
+
*/
|
|
16
|
+
let DEBUG_INTERFACE_NAME = '__app_debug__';
|
|
17
|
+
|
|
18
|
+
export function setDebugInterfaceName(name: string): void {
|
|
19
|
+
DEBUG_INTERFACE_NAME = name;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getDebugInterfaceName(): string {
|
|
23
|
+
return DEBUG_INTERFACE_NAME;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get the current JWT token from the app's debug interface.
|
|
28
|
+
* Returns null if no token is set or debug interface is not available.
|
|
29
|
+
*/
|
|
30
|
+
export async function getToken(page: Page): Promise<string | null> {
|
|
31
|
+
return page.evaluate((name) => {
|
|
32
|
+
const debug = (window as any)[name];
|
|
33
|
+
return debug?.getToken ? debug.getToken() : null;
|
|
34
|
+
}, DEBUG_INTERFACE_NAME);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get the current authentication state from the app's debug interface.
|
|
39
|
+
* Returns undefined if debug interface is not available.
|
|
40
|
+
*/
|
|
41
|
+
export async function getAuthState(page: Page): Promise<AuthState | undefined> {
|
|
42
|
+
return page.evaluate((name) => {
|
|
43
|
+
const debug = (window as any)[name];
|
|
44
|
+
return debug?.getAuthState ? debug.getAuthState() : undefined;
|
|
45
|
+
}, DEBUG_INTERFACE_NAME);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the current user from the app's debug interface.
|
|
50
|
+
* Returns null if not authenticated or debug interface is not available.
|
|
51
|
+
*/
|
|
52
|
+
export async function getCurrentUser(page: Page): Promise<User | null> {
|
|
53
|
+
return page.evaluate((name) => {
|
|
54
|
+
const debug = (window as any)[name];
|
|
55
|
+
return debug?.getCurrentUser ? debug.getCurrentUser() : null;
|
|
56
|
+
}, DEBUG_INTERFACE_NAME);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Wait for a specific auth state to be reached.
|
|
61
|
+
* Useful for waiting after login/logout operations.
|
|
62
|
+
*/
|
|
63
|
+
export async function waitForAuthState(
|
|
64
|
+
page: Page,
|
|
65
|
+
expectedState: AuthState,
|
|
66
|
+
options: { timeout?: number } = {},
|
|
67
|
+
): Promise<void> {
|
|
68
|
+
const timeout = options.timeout ?? 5000;
|
|
69
|
+
await page.waitForFunction(
|
|
70
|
+
({ state, name }: { state: AuthState; name: string }) => {
|
|
71
|
+
const debug = (window as any)[name];
|
|
72
|
+
return debug?.getAuthState ? debug.getAuthState() === state : false;
|
|
73
|
+
},
|
|
74
|
+
{ state: expectedState, name: DEBUG_INTERFACE_NAME },
|
|
75
|
+
{ timeout }
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Check if the debug interface is available.
|
|
81
|
+
* Can be used to skip tests if implementation doesn't support it.
|
|
82
|
+
*/
|
|
83
|
+
export async function isDebugInterfaceAvailable(page: Page): Promise<boolean> {
|
|
84
|
+
return page.evaluate((name) => {
|
|
85
|
+
return typeof (window as any)[name] !== 'undefined';
|
|
86
|
+
}, DEBUG_INTERFACE_NAME);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get all debug data at once (token, auth state, user)
|
|
91
|
+
*/
|
|
92
|
+
export async function getDebugData(page: Page): Promise<{
|
|
93
|
+
token: string | null;
|
|
94
|
+
authState: AuthState | undefined;
|
|
95
|
+
user: User | null;
|
|
96
|
+
available: boolean;
|
|
97
|
+
}> {
|
|
98
|
+
const available = await isDebugInterfaceAvailable(page);
|
|
99
|
+
|
|
100
|
+
if (!available) {
|
|
101
|
+
return { token: null, authState: undefined, user: null, available: false };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const [token, authState, user] = await Promise.all([
|
|
105
|
+
getToken(page),
|
|
106
|
+
getAuthState(page),
|
|
107
|
+
getCurrentUser(page),
|
|
108
|
+
]);
|
|
109
|
+
|
|
110
|
+
return { token, authState, user, available: true };
|
|
111
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { setDebugInterfaceName, getDebugInterfaceName, getToken, getAuthState, getCurrentUser, waitForAuthState, isDebugInterfaceAvailable, getDebugData, type AuthState, type User, } from './debug';
|
|
2
|
+
export { register, login, logout, generateUniqueUser, isLoggedIn, getCurrentUsername, type UserCredentials, type AuthResult, } from './auth';
|
|
3
|
+
export { getAPIConfig, registerUserViaAPI, loginUserViaAPI, createArticleViaAPI, deleteArticleViaAPI, updateUserViaAPI, getCurrentUserViaAPI, type APIConfig, type APIUser, type APIAuthResponse, } from './api';
|
|
4
|
+
export { createUserInIsolation, createUserViaAPI, setupAuthenticatedPage, createManyArticles, cleanupTestData, waitForAngular, safeGoto, type TestUser, type IsolatedUserContext, } from './setup';
|
|
5
|
+
export { getConfig, isCI, isDebug, getBrowserLaunchOptions, setTestEnv, type SamaroConfig, } from './config';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,IAAI,GACV,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACN,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,eAAe,GACrB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,mBAAmB,GACzB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,SAAS,EACT,IAAI,EACJ,OAAO,EACP,uBAAuB,EACvB,UAAU,EACV,KAAK,YAAY,GAClB,MAAM,UAAU,CAAC"}
|
package/helpers/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setTestEnv = exports.getBrowserLaunchOptions = exports.isDebug = exports.isCI = exports.getConfig = exports.safeGoto = exports.waitForAngular = exports.cleanupTestData = exports.createManyArticles = exports.setupAuthenticatedPage = exports.createUserViaAPI = exports.createUserInIsolation = exports.getCurrentUserViaAPI = exports.updateUserViaAPI = exports.deleteArticleViaAPI = exports.createArticleViaAPI = exports.loginUserViaAPI = exports.registerUserViaAPI = exports.getAPIConfig = exports.getCurrentUsername = exports.isLoggedIn = exports.generateUniqueUser = exports.logout = exports.login = exports.register = exports.getDebugData = exports.isDebugInterfaceAvailable = exports.waitForAuthState = exports.getCurrentUser = exports.getAuthState = exports.getToken = exports.getDebugInterfaceName = exports.setDebugInterfaceName = void 0;
|
|
4
|
+
// Debug interface helpers
|
|
5
|
+
var debug_1 = require("./debug");
|
|
6
|
+
Object.defineProperty(exports, "setDebugInterfaceName", { enumerable: true, get: function () { return debug_1.setDebugInterfaceName; } });
|
|
7
|
+
Object.defineProperty(exports, "getDebugInterfaceName", { enumerable: true, get: function () { return debug_1.getDebugInterfaceName; } });
|
|
8
|
+
Object.defineProperty(exports, "getToken", { enumerable: true, get: function () { return debug_1.getToken; } });
|
|
9
|
+
Object.defineProperty(exports, "getAuthState", { enumerable: true, get: function () { return debug_1.getAuthState; } });
|
|
10
|
+
Object.defineProperty(exports, "getCurrentUser", { enumerable: true, get: function () { return debug_1.getCurrentUser; } });
|
|
11
|
+
Object.defineProperty(exports, "waitForAuthState", { enumerable: true, get: function () { return debug_1.waitForAuthState; } });
|
|
12
|
+
Object.defineProperty(exports, "isDebugInterfaceAvailable", { enumerable: true, get: function () { return debug_1.isDebugInterfaceAvailable; } });
|
|
13
|
+
Object.defineProperty(exports, "getDebugData", { enumerable: true, get: function () { return debug_1.getDebugData; } });
|
|
14
|
+
// Authentication helpers
|
|
15
|
+
var auth_1 = require("./auth");
|
|
16
|
+
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return auth_1.register; } });
|
|
17
|
+
Object.defineProperty(exports, "login", { enumerable: true, get: function () { return auth_1.login; } });
|
|
18
|
+
Object.defineProperty(exports, "logout", { enumerable: true, get: function () { return auth_1.logout; } });
|
|
19
|
+
Object.defineProperty(exports, "generateUniqueUser", { enumerable: true, get: function () { return auth_1.generateUniqueUser; } });
|
|
20
|
+
Object.defineProperty(exports, "isLoggedIn", { enumerable: true, get: function () { return auth_1.isLoggedIn; } });
|
|
21
|
+
Object.defineProperty(exports, "getCurrentUsername", { enumerable: true, get: function () { return auth_1.getCurrentUsername; } });
|
|
22
|
+
// API helpers
|
|
23
|
+
var api_1 = require("./api");
|
|
24
|
+
Object.defineProperty(exports, "getAPIConfig", { enumerable: true, get: function () { return api_1.getAPIConfig; } });
|
|
25
|
+
Object.defineProperty(exports, "registerUserViaAPI", { enumerable: true, get: function () { return api_1.registerUserViaAPI; } });
|
|
26
|
+
Object.defineProperty(exports, "loginUserViaAPI", { enumerable: true, get: function () { return api_1.loginUserViaAPI; } });
|
|
27
|
+
Object.defineProperty(exports, "createArticleViaAPI", { enumerable: true, get: function () { return api_1.createArticleViaAPI; } });
|
|
28
|
+
Object.defineProperty(exports, "deleteArticleViaAPI", { enumerable: true, get: function () { return api_1.deleteArticleViaAPI; } });
|
|
29
|
+
Object.defineProperty(exports, "updateUserViaAPI", { enumerable: true, get: function () { return api_1.updateUserViaAPI; } });
|
|
30
|
+
Object.defineProperty(exports, "getCurrentUserViaAPI", { enumerable: true, get: function () { return api_1.getCurrentUserViaAPI; } });
|
|
31
|
+
// Setup utilities
|
|
32
|
+
var setup_1 = require("./setup");
|
|
33
|
+
Object.defineProperty(exports, "createUserInIsolation", { enumerable: true, get: function () { return setup_1.createUserInIsolation; } });
|
|
34
|
+
Object.defineProperty(exports, "createUserViaAPI", { enumerable: true, get: function () { return setup_1.createUserViaAPI; } });
|
|
35
|
+
Object.defineProperty(exports, "setupAuthenticatedPage", { enumerable: true, get: function () { return setup_1.setupAuthenticatedPage; } });
|
|
36
|
+
Object.defineProperty(exports, "createManyArticles", { enumerable: true, get: function () { return setup_1.createManyArticles; } });
|
|
37
|
+
Object.defineProperty(exports, "cleanupTestData", { enumerable: true, get: function () { return setup_1.cleanupTestData; } });
|
|
38
|
+
Object.defineProperty(exports, "waitForAngular", { enumerable: true, get: function () { return setup_1.waitForAngular; } });
|
|
39
|
+
Object.defineProperty(exports, "safeGoto", { enumerable: true, get: function () { return setup_1.safeGoto; } });
|
|
40
|
+
// Configuration helpers
|
|
41
|
+
var config_1 = require("./config");
|
|
42
|
+
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return config_1.getConfig; } });
|
|
43
|
+
Object.defineProperty(exports, "isCI", { enumerable: true, get: function () { return config_1.isCI; } });
|
|
44
|
+
Object.defineProperty(exports, "isDebug", { enumerable: true, get: function () { return config_1.isDebug; } });
|
|
45
|
+
Object.defineProperty(exports, "getBrowserLaunchOptions", { enumerable: true, get: function () { return config_1.getBrowserLaunchOptions; } });
|
|
46
|
+
Object.defineProperty(exports, "setTestEnv", { enumerable: true, get: function () { return config_1.setTestEnv; } });
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,iCAWiB;AAVf,8GAAA,qBAAqB,OAAA;AACrB,8GAAA,qBAAqB,OAAA;AACrB,iGAAA,QAAQ,OAAA;AACR,qGAAA,YAAY,OAAA;AACZ,uGAAA,cAAc,OAAA;AACd,yGAAA,gBAAgB,OAAA;AAChB,kHAAA,yBAAyB,OAAA;AACzB,qGAAA,YAAY,OAAA;AAKd,yBAAyB;AACzB,+BASgB;AARd,gGAAA,QAAQ,OAAA;AACR,6FAAA,KAAK,OAAA;AACL,8FAAA,MAAM,OAAA;AACN,0GAAA,kBAAkB,OAAA;AAClB,kGAAA,UAAU,OAAA;AACV,0GAAA,kBAAkB,OAAA;AAKpB,cAAc;AACd,6BAWe;AAVb,mGAAA,YAAY,OAAA;AACZ,yGAAA,kBAAkB,OAAA;AAClB,sGAAA,eAAe,OAAA;AACf,0GAAA,mBAAmB,OAAA;AACnB,0GAAA,mBAAmB,OAAA;AACnB,uGAAA,gBAAgB,OAAA;AAChB,2GAAA,oBAAoB,OAAA;AAMtB,kBAAkB;AAClB,iCAUiB;AATf,8GAAA,qBAAqB,OAAA;AACrB,yGAAA,gBAAgB,OAAA;AAChB,+GAAA,sBAAsB,OAAA;AACtB,2GAAA,kBAAkB,OAAA;AAClB,wGAAA,eAAe,OAAA;AACf,uGAAA,cAAc,OAAA;AACd,iGAAA,QAAQ,OAAA;AAKV,wBAAwB;AACxB,mCAOkB;AANhB,mGAAA,SAAS,OAAA;AACT,8FAAA,IAAI,OAAA;AACJ,iGAAA,OAAO,OAAA;AACP,iHAAA,uBAAuB,OAAA;AACvB,oGAAA,UAAU,OAAA"}
|