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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../helpers/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,CAAC,CAmBrB;AAED;;GAEG;AACH,wBAAsB,KAAK,CACzB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,CAAC,CAkBrB;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBtD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAQpD;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAM7D;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAM3E"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register a new user via UI
|
|
3
|
+
*/
|
|
4
|
+
export async function register(page, username, email, password) {
|
|
5
|
+
await page.goto('/register', { waitUntil: 'networkidle' });
|
|
6
|
+
await page.fill('input[name="username"]', username);
|
|
7
|
+
await page.fill('input[name="email"]', email);
|
|
8
|
+
await page.fill('input[name="password"]', password);
|
|
9
|
+
try {
|
|
10
|
+
await Promise.all([
|
|
11
|
+
page.waitForURL('/', { timeout: 10000 }),
|
|
12
|
+
page.click('button[type="submit"]')
|
|
13
|
+
]);
|
|
14
|
+
return { success: true };
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
const errorMsg = await page.locator('.error-messages, [data-testid="error-message"]').textContent().catch(() => '');
|
|
18
|
+
if (errorMsg) {
|
|
19
|
+
return { success: false, error: `Registration failed: ${errorMsg.trim()}` };
|
|
20
|
+
}
|
|
21
|
+
return { success: false, error: `Registration failed: ${error}` };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Login a user via UI
|
|
26
|
+
*/
|
|
27
|
+
export async function login(page, email, password) {
|
|
28
|
+
await page.goto('/login', { waitUntil: 'networkidle' });
|
|
29
|
+
await page.fill('input[name="email"]', email);
|
|
30
|
+
await page.fill('input[name="password"]', password);
|
|
31
|
+
try {
|
|
32
|
+
await Promise.all([
|
|
33
|
+
page.waitForURL('/', { timeout: 10000 }),
|
|
34
|
+
page.click('button[type="submit"]')
|
|
35
|
+
]);
|
|
36
|
+
return { success: true };
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const errorMsg = await page.locator('.error-messages, [data-testid="error-message"]').textContent().catch(() => '');
|
|
40
|
+
if (errorMsg) {
|
|
41
|
+
return { success: false, error: `Login failed: ${errorMsg.trim()}` };
|
|
42
|
+
}
|
|
43
|
+
return { success: false, error: `Login failed: ${error}` };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Logout a user via UI
|
|
48
|
+
*/
|
|
49
|
+
export async function logout(page) {
|
|
50
|
+
// Try different logout patterns
|
|
51
|
+
const settingsLink = page.locator('a[href="/settings"], a:has-text("Settings"), [data-testid="settings-link"]').first();
|
|
52
|
+
if (await settingsLink.isVisible().catch(() => false)) {
|
|
53
|
+
await settingsLink.click();
|
|
54
|
+
await page.waitForURL('/settings', { timeout: 5000 });
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
await page.goto('/settings');
|
|
58
|
+
}
|
|
59
|
+
const logoutButton = page.locator('button:has-text("logout"), button:has-text("Logout"), [data-testid="logout-button"]').first();
|
|
60
|
+
await Promise.all([
|
|
61
|
+
page.waitForURL('/', { timeout: 10000 }),
|
|
62
|
+
logoutButton.click()
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Generate unique user credentials to avoid conflicts
|
|
67
|
+
*/
|
|
68
|
+
export function generateUniqueUser() {
|
|
69
|
+
const timestamp = Date.now();
|
|
70
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
71
|
+
return {
|
|
72
|
+
username: `testuser_${timestamp}_${random}`,
|
|
73
|
+
email: `test_${timestamp}_${random}@example.com`,
|
|
74
|
+
password: 'TestPassword123!',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Check if user is logged in
|
|
79
|
+
*/
|
|
80
|
+
export async function isLoggedIn(page) {
|
|
81
|
+
// Check for logout button or user-specific elements
|
|
82
|
+
const logoutVisible = await page.locator('a[href="/settings"], [data-testid="logout-button"]').isVisible().catch(() => false);
|
|
83
|
+
const loginVisible = await page.locator('a[href="/login"]').isVisible().catch(() => false);
|
|
84
|
+
return logoutVisible && !loginVisible;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get current username if logged in
|
|
88
|
+
*/
|
|
89
|
+
export async function getCurrentUsername(page) {
|
|
90
|
+
const usernameElement = page.locator('[data-testid="username"], .user-name, .username').first();
|
|
91
|
+
if (await usernameElement.isVisible().catch(() => false)) {
|
|
92
|
+
return usernameElement.textContent();
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../helpers/auth.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,IAAU,EACV,QAAgB,EAChB,KAAa,EACb,QAAgB;IAEhB,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;IAC3D,MAAM,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;IACpD,MAAM,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IAC9C,MAAM,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;IAEpD,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC;YAChB,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YACxC,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC;SACpC,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gDAAgD,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QACp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AM,aAAa,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,oDAAoD,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9H,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAE3F,OAAO,aAAa,IAAI,CAAC,YAAY,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAU;IACjD,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,iDAAiD,CAAC,CAAC,KAAK,EAAE,CAAC;IAChG,IAAI,MAAM,eAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -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":["../../helpers/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,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration helpers for SamaroUItest
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Get SamaroUItest configuration from environment variables
|
|
6
|
+
*/
|
|
7
|
+
export function getConfig() {
|
|
8
|
+
return {
|
|
9
|
+
apiMode: process.env.API_MODE?.toLowerCase() !== 'false',
|
|
10
|
+
apiBase: process.env.API_BASE || process.env.NG_API_URL || 'http://localhost:4200/api',
|
|
11
|
+
debugInterfaceName: process.env.DEBUG_INTERFACE_NAME || '__app_debug__',
|
|
12
|
+
timeouts: {
|
|
13
|
+
navigation: parseInt(process.env.TIMEOUT_NAVIGATION || '10000', 10),
|
|
14
|
+
action: parseInt(process.env.TIMEOUT_ACTION || '5000', 10),
|
|
15
|
+
expectation: parseInt(process.env.TIMEOUT_EXPECTATION || '5000', 10),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Check if running in CI environment
|
|
21
|
+
*/
|
|
22
|
+
export function isCI() {
|
|
23
|
+
return !!process.env.CI;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if running in debug mode
|
|
27
|
+
*/
|
|
28
|
+
export function isDebug() {
|
|
29
|
+
return process.env.DEBUG === 'true' || process.env.PWDEBUG === '1';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get browser launch options based on environment
|
|
33
|
+
*/
|
|
34
|
+
export function getBrowserLaunchOptions() {
|
|
35
|
+
const options = {
|
|
36
|
+
headless: !isDebug(),
|
|
37
|
+
};
|
|
38
|
+
if (isCI()) {
|
|
39
|
+
options.args = [
|
|
40
|
+
'--no-sandbox',
|
|
41
|
+
'--disable-setuid-sandbox',
|
|
42
|
+
'--disable-dev-shm-usage',
|
|
43
|
+
'--disable-accelerated-2d-canvas',
|
|
44
|
+
'--disable-gpu',
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
return options;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Set environment variables for test configuration
|
|
51
|
+
*/
|
|
52
|
+
export function setTestEnv(vars) {
|
|
53
|
+
if (vars.apiMode !== undefined) {
|
|
54
|
+
process.env.API_MODE = vars.apiMode.toString();
|
|
55
|
+
}
|
|
56
|
+
if (vars.apiBase) {
|
|
57
|
+
process.env.API_BASE = vars.apiBase;
|
|
58
|
+
}
|
|
59
|
+
if (vars.debugInterfaceName) {
|
|
60
|
+
process.env.DEBUG_INTERFACE_NAME = vars.debugInterfaceName;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../helpers/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH;;GAEG;AACH,MAAM,UAAU,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,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,MAAM,EAAE,EAAE,CAAC;YAC1D,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,MAAM,EAAE,EAAE,CAAC;SACrE;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,OAAO,GAAwB;QACnC,QAAQ,EAAE,CAAC,OAAO,EAAE;KACrB,CAAC;IAEF,IAAI,IAAI,EAAE,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,GAAG;YACb,cAAc;YACd,0BAA0B;YAC1B,yBAAyB;YACzB,iCAAiC;YACjC,eAAe;SAChB,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAA2B;IACpD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjD,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;IACtC,CAAC;IACD,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,IAAI,CAAC,kBAAkB,CAAC;IAC7D,CAAC;AACH,CAAC"}
|
|
@@ -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":["../../helpers/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,CAUf;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"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configure the debug interface name (defaults to __app_debug__)
|
|
3
|
+
*/
|
|
4
|
+
let DEBUG_INTERFACE_NAME = '__app_debug__';
|
|
5
|
+
export function setDebugInterfaceName(name) {
|
|
6
|
+
DEBUG_INTERFACE_NAME = name;
|
|
7
|
+
}
|
|
8
|
+
export function getDebugInterfaceName() {
|
|
9
|
+
return DEBUG_INTERFACE_NAME;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get the current JWT token from the app's debug interface.
|
|
13
|
+
* Returns null if no token is set or debug interface is not available.
|
|
14
|
+
*/
|
|
15
|
+
export async function getToken(page) {
|
|
16
|
+
return page.evaluate((name) => {
|
|
17
|
+
const debug = window[name];
|
|
18
|
+
return debug?.getToken ? debug.getToken() : null;
|
|
19
|
+
}, DEBUG_INTERFACE_NAME);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the current authentication state from the app's debug interface.
|
|
23
|
+
* Returns undefined if debug interface is not available.
|
|
24
|
+
*/
|
|
25
|
+
export async function getAuthState(page) {
|
|
26
|
+
return page.evaluate((name) => {
|
|
27
|
+
const debug = window[name];
|
|
28
|
+
return debug?.getAuthState ? debug.getAuthState() : undefined;
|
|
29
|
+
}, DEBUG_INTERFACE_NAME);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the current user from the app's debug interface.
|
|
33
|
+
* Returns null if not authenticated or debug interface is not available.
|
|
34
|
+
*/
|
|
35
|
+
export async function getCurrentUser(page) {
|
|
36
|
+
return page.evaluate((name) => {
|
|
37
|
+
const debug = window[name];
|
|
38
|
+
return debug?.getCurrentUser ? debug.getCurrentUser() : null;
|
|
39
|
+
}, DEBUG_INTERFACE_NAME);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Wait for a specific auth state to be reached.
|
|
43
|
+
* Useful for waiting after login/logout operations.
|
|
44
|
+
*/
|
|
45
|
+
export async function waitForAuthState(page, expectedState, options = {}) {
|
|
46
|
+
const timeout = options.timeout ?? 5000;
|
|
47
|
+
await page.waitForFunction(({ state, name }) => {
|
|
48
|
+
const debug = window[name];
|
|
49
|
+
return debug?.getAuthState ? debug.getAuthState() === state : false;
|
|
50
|
+
}, { state: expectedState, name: DEBUG_INTERFACE_NAME }, { timeout });
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if the debug interface is available.
|
|
54
|
+
* Can be used to skip tests if implementation doesn't support it.
|
|
55
|
+
*/
|
|
56
|
+
export async function isDebugInterfaceAvailable(page) {
|
|
57
|
+
return page.evaluate((name) => {
|
|
58
|
+
return typeof window[name] !== 'undefined';
|
|
59
|
+
}, DEBUG_INTERFACE_NAME);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get all debug data at once (token, auth state, user)
|
|
63
|
+
*/
|
|
64
|
+
export async function getDebugData(page) {
|
|
65
|
+
const available = await isDebugInterfaceAvailable(page);
|
|
66
|
+
if (!available) {
|
|
67
|
+
return { token: null, authState: undefined, user: null, available: false };
|
|
68
|
+
}
|
|
69
|
+
const [token, authState, user] = await Promise.all([
|
|
70
|
+
getToken(page),
|
|
71
|
+
getAuthState(page),
|
|
72
|
+
getCurrentUser(page),
|
|
73
|
+
]);
|
|
74
|
+
return { token, authState, user, available: true };
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../helpers/debug.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,IAAI,oBAAoB,GAAG,eAAe,CAAC;AAE3C,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,oBAAoB,GAAG,IAAI,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAU;IACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5B,MAAM,KAAK,GAAI,MAAc,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC,EAAE,oBAAoB,CAAC,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAU;IAC3C,OAAO,IAAI,CAAC,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;QAC5B,OAAO,OAAQ,MAAc,CAAC,IAAI,CAAC,KAAK,WAAW,CAAC;IACtD,CAAC,EAAE,oBAAoB,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAU;IAM3C,MAAM,SAAS,GAAG,MAAM,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAExD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC7E,CAAC;IAED,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACjD,QAAQ,CAAC,IAAI,CAAC;QACd,YAAY,CAAC,IAAI,CAAC;QAClB,cAAc,CAAC,IAAI,CAAC;KACrB,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -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":["../../helpers/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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Debug interface helpers
|
|
2
|
+
export { setDebugInterfaceName, getDebugInterfaceName, getToken, getAuthState, getCurrentUser, waitForAuthState, isDebugInterfaceAvailable, getDebugData, } from './debug';
|
|
3
|
+
// Authentication helpers
|
|
4
|
+
export { register, login, logout, generateUniqueUser, isLoggedIn, getCurrentUsername, } from './auth';
|
|
5
|
+
// API helpers
|
|
6
|
+
export { getAPIConfig, registerUserViaAPI, loginUserViaAPI, createArticleViaAPI, deleteArticleViaAPI, updateUserViaAPI, getCurrentUserViaAPI, } from './api';
|
|
7
|
+
// Setup utilities
|
|
8
|
+
export { createUserInIsolation, createUserViaAPI, setupAuthenticatedPage, createManyArticles, cleanupTestData, waitForAngular, safeGoto, } from './setup';
|
|
9
|
+
// Configuration helpers
|
|
10
|
+
export { getConfig, isCI, isDebug, getBrowserLaunchOptions, setTestEnv, } from './config';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,YAAY,GAGb,MAAM,SAAS,CAAC;AAEjB,yBAAyB;AACzB,OAAO,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACN,kBAAkB,EAClB,UAAU,EACV,kBAAkB,GAGnB,MAAM,QAAQ,CAAC;AAEhB,cAAc;AACd,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,GAIrB,MAAM,OAAO,CAAC;AAEf,kBAAkB;AAClB,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,QAAQ,GAGT,MAAM,SAAS,CAAC;AAEjB,wBAAwB;AACxB,OAAO,EACL,SAAS,EACT,IAAI,EACJ,OAAO,EACP,uBAAuB,EACvB,UAAU,GAEX,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Browser, BrowserContext, Page, APIRequestContext } from '@playwright/test';
|
|
2
|
+
import { APIUser } from './api';
|
|
3
|
+
export interface TestUser extends APIUser {
|
|
4
|
+
token?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IsolatedUserContext {
|
|
7
|
+
context: BrowserContext;
|
|
8
|
+
page: Page;
|
|
9
|
+
user: TestUser;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create a user in an isolated browser context
|
|
13
|
+
* This provides full isolation for tests
|
|
14
|
+
*/
|
|
15
|
+
export declare function createUserInIsolation(browser: Browser, user?: Partial<TestUser>): Promise<IsolatedUserContext>;
|
|
16
|
+
/**
|
|
17
|
+
* Create a user via API (faster, no browser context needed)
|
|
18
|
+
*/
|
|
19
|
+
export declare function createUserViaAPI(request: APIRequestContext, user?: Partial<TestUser>): Promise<TestUser & {
|
|
20
|
+
token: string;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Setup authenticated page with token
|
|
24
|
+
*/
|
|
25
|
+
export declare function setupAuthenticatedPage(page: Page, token: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Create multiple articles via API
|
|
28
|
+
*/
|
|
29
|
+
export declare function createManyArticles(request: APIRequestContext, token: string, count: number, baseTitle?: string): Promise<Array<{
|
|
30
|
+
slug: string;
|
|
31
|
+
title: string;
|
|
32
|
+
}>>;
|
|
33
|
+
/**
|
|
34
|
+
* Cleanup helper for test data
|
|
35
|
+
*/
|
|
36
|
+
export declare function cleanupTestData(request: APIRequestContext, token: string, articles: Array<{
|
|
37
|
+
slug: string;
|
|
38
|
+
}>): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Wait for Angular to be stable
|
|
41
|
+
*/
|
|
42
|
+
export declare function waitForAngular(page: Page): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Safe navigation with retry
|
|
45
|
+
*/
|
|
46
|
+
export declare function safeGoto(page: Page, url: string, options?: {
|
|
47
|
+
timeout?: number;
|
|
48
|
+
retries?: number;
|
|
49
|
+
}): Promise<void>;
|
|
50
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAK9D;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { generateUniqueUser, register } from './auth';
|
|
2
|
+
import { registerUserViaAPI } from './api';
|
|
3
|
+
/**
|
|
4
|
+
* Create a user in an isolated browser context
|
|
5
|
+
* This provides full isolation for tests
|
|
6
|
+
*/
|
|
7
|
+
export async function createUserInIsolation(browser, user) {
|
|
8
|
+
const context = await browser.newContext();
|
|
9
|
+
const page = await context.newPage();
|
|
10
|
+
const uniqueUser = { ...generateUniqueUser(), ...user };
|
|
11
|
+
const result = await register(page, uniqueUser.username, uniqueUser.email, uniqueUser.password);
|
|
12
|
+
if (!result.success) {
|
|
13
|
+
await context.close();
|
|
14
|
+
throw new Error(result.error || 'Failed to create user in isolation');
|
|
15
|
+
}
|
|
16
|
+
return { context, page, user: uniqueUser };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a user via API (faster, no browser context needed)
|
|
20
|
+
*/
|
|
21
|
+
export async function createUserViaAPI(request, user) {
|
|
22
|
+
const uniqueUser = { ...generateUniqueUser(), ...user };
|
|
23
|
+
const { token, username, email } = await registerUserViaAPI(request, uniqueUser);
|
|
24
|
+
return {
|
|
25
|
+
username,
|
|
26
|
+
email,
|
|
27
|
+
password: uniqueUser.password,
|
|
28
|
+
token
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Setup authenticated page with token
|
|
33
|
+
*/
|
|
34
|
+
export async function setupAuthenticatedPage(page, token) {
|
|
35
|
+
// Set token in localStorage
|
|
36
|
+
await page.goto('/');
|
|
37
|
+
await page.evaluate((t) => {
|
|
38
|
+
localStorage.setItem('token', t);
|
|
39
|
+
}, token);
|
|
40
|
+
// Reload to apply token
|
|
41
|
+
await page.reload();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create multiple articles via API
|
|
45
|
+
*/
|
|
46
|
+
export async function createManyArticles(request, token, count, baseTitle = 'Test Article') {
|
|
47
|
+
const { createArticleViaAPI } = await import('./api');
|
|
48
|
+
const articles = [];
|
|
49
|
+
for (let i = 0; i < count; i++) {
|
|
50
|
+
const article = await createArticleViaAPI(request, token, {
|
|
51
|
+
title: `${baseTitle} ${i + 1}`,
|
|
52
|
+
description: `Description for article ${i + 1}`,
|
|
53
|
+
body: `Body content for article ${i + 1}`,
|
|
54
|
+
tagList: ['test', `tag-${i}`],
|
|
55
|
+
});
|
|
56
|
+
articles.push(article);
|
|
57
|
+
}
|
|
58
|
+
return articles;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Cleanup helper for test data
|
|
62
|
+
*/
|
|
63
|
+
export async function cleanupTestData(request, token, articles) {
|
|
64
|
+
const { deleteArticleViaAPI } = await import('./api');
|
|
65
|
+
await Promise.all(articles.map(article => deleteArticleViaAPI(request, token, article.slug).catch(() => {
|
|
66
|
+
// Ignore cleanup errors
|
|
67
|
+
})));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Wait for Angular to be stable
|
|
71
|
+
*/
|
|
72
|
+
export async function waitForAngular(page) {
|
|
73
|
+
await page.waitForFunction(() => {
|
|
74
|
+
return window.getAngularTestability ?
|
|
75
|
+
window.getAngularTestability().isStable() : true;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Safe navigation with retry
|
|
80
|
+
*/
|
|
81
|
+
export async function safeGoto(page, url, options = {}) {
|
|
82
|
+
const { timeout = 10000, retries = 3 } = options;
|
|
83
|
+
for (let i = 0; i < retries; i++) {
|
|
84
|
+
try {
|
|
85
|
+
await page.goto(url, { waitUntil: 'networkidle', timeout });
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (i === retries - 1)
|
|
90
|
+
throw error;
|
|
91
|
+
await page.waitForTimeout(1000);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../helpers/setup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAW,MAAM,OAAO,CAAC;AAYpD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAgB,EAChB,IAAwB;IAExB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;IAC3C,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,UAAU,GAAG,EAAE,GAAG,kBAAkB,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC;IAExD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAEhG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,oCAAoC,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC7C,CAAC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AAG,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;YAC5D,OAAO;QACT,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,OAAO,GAAG,CAAC;gBAAE,MAAM,KAAK,CAAC;YACnC,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SamaroUItest - Comprehensive Testing Framework for Angular
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { createVitestConfig, createPlaywrightConfig, createComponentConfig, mergeConfig, type SamaroVitestOptions, type SamaroPlaywrightOptions, type SamaroComponentOptions, } from '../config';
|
|
7
|
+
export { setDebugInterfaceName, getDebugInterfaceName, getToken, getAuthState, getCurrentUser, waitForAuthState, isDebugInterfaceAvailable, getDebugData, type AuthState, type User, register, login, logout, generateUniqueUser, isLoggedIn, getCurrentUsername, type UserCredentials, type AuthResult, getAPIConfig, registerUserViaAPI, loginUserViaAPI, createArticleViaAPI, deleteArticleViaAPI, updateUserViaAPI, getCurrentUserViaAPI, type APIConfig, type APIUser, type APIAuthResponse, createUserInIsolation, createUserViaAPI, setupAuthenticatedPage, createManyArticles, cleanupTestData, waitForAngular, safeGoto, type TestUser, type IsolatedUserContext, getConfig, isCI, isDebug, getBrowserLaunchOptions, setTestEnv, type SamaroConfig, } from '../helpers';
|
|
8
|
+
/**
|
|
9
|
+
* Version of SamaroUItest
|
|
10
|
+
*/
|
|
11
|
+
export declare const VERSION = "1.0.0";
|
|
12
|
+
/**
|
|
13
|
+
* Check if the package is properly installed
|
|
14
|
+
*/
|
|
15
|
+
export declare function checkInstallation(): boolean;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,EACX,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,WAAW,CAAC;AAGnB,OAAO,EAEL,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,IAAI,EAGT,QAAQ,EACR,KAAK,EACL,MAAM,EACN,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,UAAU,EAGf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,eAAe,EAGpB,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,mBAAmB,EAGxB,SAAS,EACT,IAAI,EACJ,OAAO,EACP,uBAAuB,EACvB,UAAU,EACV,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAS3C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SamaroUItest - Comprehensive Testing Framework for Angular
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
// Configuration exports
|
|
7
|
+
export { createVitestConfig, createPlaywrightConfig, createComponentConfig, mergeConfig, } from '../config';
|
|
8
|
+
// Helper exports
|
|
9
|
+
export {
|
|
10
|
+
// Debug
|
|
11
|
+
setDebugInterfaceName, getDebugInterfaceName, getToken, getAuthState, getCurrentUser, waitForAuthState, isDebugInterfaceAvailable, getDebugData,
|
|
12
|
+
// Auth
|
|
13
|
+
register, login, logout, generateUniqueUser, isLoggedIn, getCurrentUsername,
|
|
14
|
+
// API
|
|
15
|
+
getAPIConfig, registerUserViaAPI, loginUserViaAPI, createArticleViaAPI, deleteArticleViaAPI, updateUserViaAPI, getCurrentUserViaAPI,
|
|
16
|
+
// Setup
|
|
17
|
+
createUserInIsolation, createUserViaAPI, setupAuthenticatedPage, createManyArticles, cleanupTestData, waitForAngular, safeGoto,
|
|
18
|
+
// Config
|
|
19
|
+
getConfig, isCI, isDebug, getBrowserLaunchOptions, setTestEnv, } from '../helpers';
|
|
20
|
+
/**
|
|
21
|
+
* Version of SamaroUItest
|
|
22
|
+
*/
|
|
23
|
+
export const VERSION = '1.0.0';
|
|
24
|
+
/**
|
|
25
|
+
* Check if the package is properly installed
|
|
26
|
+
*/
|
|
27
|
+
export function checkInstallation() {
|
|
28
|
+
try {
|
|
29
|
+
// Try to import required dependencies
|
|
30
|
+
require('@playwright/test');
|
|
31
|
+
require('vitest');
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAwB;AACxB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,GAIZ,MAAM,WAAW,CAAC;AAEnB,iBAAiB;AACjB,OAAO;AACL,QAAQ;AACR,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,YAAY;AAIZ,OAAO;AACP,QAAQ,EACR,KAAK,EACL,MAAM,EACN,kBAAkB,EAClB,UAAU,EACV,kBAAkB;AAIlB,MAAM;AACN,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB;AAKpB,QAAQ;AACR,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,QAAQ;AAIR,SAAS;AACT,SAAS,EACT,IAAI,EACJ,OAAO,EACP,uBAAuB,EACvB,UAAU,GAEX,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC;QACH,sCAAsC;QACtC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC5B,OAAO,CAAC,QAAQ,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|