-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-1.spec.ts
More file actions
68 lines (54 loc) · 2.59 KB
/
test-1.spec.ts
File metadata and controls
68 lines (54 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { test, expect, type Page } from '@playwright/test';
const toNumber = (value: string | undefined, fallback: number) => {
const parsedValue = Number(value);
return Number.isFinite(parsedValue) ? parsedValue : fallback;
};
const timeoutMs = toNumber(process.env.PLAYWRIGHT_TIMEOUT_MS, 15000);
const longTimeoutMs = timeoutMs * 2;
const settleDelayMs = Math.max(250, Math.round(timeoutMs / 30));
async function waitForAppReady(page: Page) {
await page.waitForLoadState('domcontentloaded');
const ionApp = page.locator('ion-app').first();
if (await ionApp.count()) {
await expect(ionApp).toHaveClass(/hydrated/, { timeout: timeoutMs });
}
await expect(
page.locator('ion-loading:not(.overlay-hidden), ion-spinner').first(),
).toBeHidden({ timeout: timeoutMs });
}
test('NO CODE STUDIO', async ({ page, context }) => {
const form_name = 'QA - GV - HLOAD';
const grid_value = 'Human Resources';
// LOGIN
await page.goto("index.html");
await expect(page.locator('ion-button[type=submit].class1645091280806')).toBeVisible({ timeout: timeoutMs });
await page.locator('#ion-input-1').fill(process.env.LOGIN || 'login');
await page.waitForTimeout(settleDelayMs);
//await page.locator('ion-button[type=submit].class1645091280824').click();
//await page.waitForTimeout(settleDelayMs);
await page.locator('#ion-input-0').fill(process.env.PASSWORD || 'password');
await page.waitForTimeout(settleDelayMs);
await page.locator('ion-button[type=submit].class1645091280806').click();
// RESULTS DASHBOARD
await expect(page.locator('ion-label.class1645887457900')).toBeAttached({ timeout: timeoutMs });
// DASHBOARD: CLICK PUBLISHED APPS
await expect(page.locator('div.class1645545973630.TabNotSelected')).toBeAttached({ timeout: timeoutMs });
await page.locator('div.class1645545973630.TabNotSelected').click();
await expect(page.locator('div.class1645545973630.TabSelected')).toBeAttached({ timeout: timeoutMs });
// CLICK APP
const [newPage] = await Promise.all([
context.waitForEvent('page'),
page.getByText(form_name).locator('..').click()
]);
await waitForAppReady(newPage);
// GRID
await expect(
newPage.locator('div.ion-text-wrap.class1584610404188').filter({ hasText: form_name }),
).toBeVisible({ timeout: longTimeoutMs });
await expect(newPage.getByText(grid_value).nth(0)).toBeAttached({ timeout: timeoutMs });
await expect(newPage.getByText(grid_value).nth(1)).toBeAttached({ timeout: timeoutMs });
// CHART
await expect(newPage.locator('g[seriesName="t_avg_c"]')).toBeAttached({ timeout: timeoutMs });
//newPage.close();
//page.close();
});