-
Notifications
You must be signed in to change notification settings - Fork 1
/
microservice.bar.play.js
52 lines (48 loc) · 2.89 KB
/
microservice.bar.play.js
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
const {test, expect} = require('ut-portal/test');
const randomName = require('uuid').v4();
test('test', async({ portal: page }, testInfo) => {
await page.locator('[data-testid="portal-menu_test"]').click();
await Promise.all([
page.waitForNavigation(),
page.locator('[data-testid="portal-menu_microservice-bar-browse"]').click()
]);
// Add item
await page.locator('[data-testid="microservice-bar-addButton"]').click();
await page.locator('input[name="bar.barName"]').click();
expect.soft(await page.screenshot({animations: 'disabled'})).toMatchSnapshot('microservice-bar-new.png');
await testInfo.attach('Bar new', {path: testInfo.snapshotPath('microservice-bar-new.png')});
await page.locator('textarea[name="bar.barDescription"]').fill('description 1');
await page.locator('input[name="bar.barName"]').fill(randomName);
await page.locator('[data-testid="microserviceBar-saveButton"]').click();
await expect(page.getByTestId('microserviceBar-saveButton').locator('.pi-check')).toBeVisible();
expect.soft(await page.screenshot({
animations: 'disabled',
mask: [page.locator('input[name="bar.barName"]')]
})).toMatchSnapshot('microservice.bar.new-filled.png');
// Fetch item and select for edit
// close tab
await page.locator('#pr_id_1_header_1 i').click();
await page.locator('input[name="bar.barNameFilter"]').fill(randomName);
await page.locator(`td >> text=${randomName}`).click(); // this locator also ensures the fetch completed
await expect(page.locator('textarea[name="bar.barDescription"]')).toHaveValue('description 1'); // wait for data load
await page.locator('textarea[name="bar.barDescription"]').fill('description 2');
await page.locator('[data-testid="microserviceBar-saveButton"]').click();
await expect(page.getByTestId('microserviceBar-saveButton').locator('.pi-check')).toBeVisible();
await page.locator('textarea[name="bar.barDescription"]').click();
expect.soft(await page.screenshot({
animations: 'disabled',
mask: [page.locator('input[name="bar.barName"]')]
})).toMatchSnapshot('microservice-bar-save.png');
await testInfo.attach('Bar edit', {path: testInfo.snapshotPath('microservice-bar-save.png')});
// Fetch item and select for edit
// close tab
await page.locator('#pr_id_1_header_1 i').click();
await page.locator('input[name="bar.barNameFilter"]').fill(randomName);
await page.locator(`td >> text=${randomName}`).click(); // this locator also ensures the fetch completed
await expect(page.locator('textarea[name="bar.barDescription"]')).toHaveValue('description 2'); // wait for data load
await page.locator('textarea[name="bar.barDescription"]').click();
expect.soft(await page.screenshot({
animations: 'disabled',
mask: [page.locator('input[name="bar.barName"]')]
})).toMatchSnapshot('microservice-bar-edit.png');
});