Skip to content

Commit 03803dc

Browse files
samhere06mohas22
andauthored
avoiding wait on API (#214)
Co-authored-by: mohas22 <[email protected]>
1 parent 84a1fa4 commit 03803dc

File tree

5 files changed

+8
-37
lines changed

5 files changed

+8
-37
lines changed

playwright.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const { devices } = require('@playwright/test');
1414
const config = {
1515
testDir: 'projects/angular-test-app/tests',
1616
/* Maximum time one test can run for. */
17-
timeout: 120 * 1000 * 2,
17+
timeout: 120 * 1000,
1818
expect: {
1919
/**
2020
* Maximum time expect() should wait for the condition to be met.
@@ -33,7 +33,7 @@ const config = {
3333
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
3434
use: {
3535
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
36-
actionTimeout: 0,
36+
actionTimeout: 50000,
3737
/* Base URL to use in actions like `await page.goto('/')`. */
3838
// baseURL: 'http://localhost:3000',
3939

projects/angular-test-app/tests/e2e/DigV2/FormFields/Email.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ test.describe('E2E test', () => {
9898
const editableEmail = page.locator('input[data-test-id="c75f8a926bb5e08fd8342f7fe45dc344"]');
9999
await editableEmail.fill('Johndoe.com');
100100
await editableEmail.blur();
101-
await page.waitForResponse('**/actions/SelectTest/refresh');
102101
const validMsg = "Invalid value specified for EmailEditable. Value doesn\\'t adhere to the Validate: ValidEmailAddress";
103102
await expect(page.locator(`mat-error:has-text("${validMsg}")`)).toBeVisible();
104103
editableEmail.fill('[email protected]');

projects/angular-test-app/tests/e2e/DigV2/FormFields/attachment.spec.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ test.beforeEach(async ({ page }) => {
1313
await page.goto(config.config.baseUrl, { waitUntil: 'networkidle' });
1414
});
1515

16-
const endpoints = require('../../../../../../sdk-config.json');
17-
1816
test.describe('E2E test', () => {
1917
let attributes;
2018

@@ -104,14 +102,6 @@ test.describe('E2E test', () => {
104102
await expect(singleAttachment.locator('button:has-text("Choose files")')).toBeVisible();
105103
await page.setInputFiles(`#AttachmentList`, [cableChatFilePath, cableInfoFilePath]);
106104

107-
await Promise.all([
108-
page.waitForResponse(
109-
`${endpoints.serverConfig.infinityRestServerUrl}${
110-
endpoints.serverConfig.appAlias ? `/app/${endpoints.serverConfig.appAlias}` : ''
111-
}/api/application/v2/attachments/upload`
112-
)
113-
]);
114-
115105
await expect(page.locator('div >> text="cableinfo.jpg"')).toBeVisible();
116106
await expect(page.locator('div >> text="cablechat.jpg"')).toBeVisible();
117107

projects/angular-test-app/tests/e2e/DigV2/LandingPages/InlineDashboard.spec.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ test.describe('E2E test', () => {
6161
const table = await page.locator('table[id="list-view"] >> nth=0');
6262
const numOfRows = await table.locator('tbody >> tr').count();
6363

64-
const responsePromise = page.waitForResponse('**/data_views/D_ComplexFieldsList');
6564
/* Testing the filters */
6665
const filters = await page.locator('div[id="filters"]');
6766
const caseIdInput = filters.getByLabel('Case ID');
6867
await caseIdInput.click();
6968
await caseIdInput.pressSequentially(caseID, { delay: 100 });
7069

71-
await responsePromise;
70+
const pagination = page.locator('mat-paginator[id="pagination"]');
71+
await expect(pagination.getByText('1 – 1 of 1')).toBeVisible();
7272

7373
await expect(table.locator(`td >> text=${caseID}`)).toBeVisible();
7474
await expect(table.locator('td >> text="Complex Fields"')).toBeVisible();
@@ -89,13 +89,8 @@ test.describe('E2E test', () => {
8989
const dateCol = await table.locator('td >> nth=2');
9090
await expect(dateCol.getByText(`${new Date().getDate()}`)).toBeVisible();
9191

92-
const pagination = page.locator('mat-paginator[id="pagination"]');
93-
await expect(pagination.getByText('1 – 1 of 1')).toBeVisible();
94-
9592
await filters.locator('button:has-text("Clear All")').click();
9693

97-
await responsePromise;
98-
9994
await expect(await caseIdInput.inputValue()).toEqual('');
10095
await expect(await dateFilterInput.inputValue()).toEqual('');
10196

projects/angular-test-app/tests/e2e/MediaCo/portal.spec.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const path = require('path');
22
const { test, expect } = require('@playwright/test');
33
const config = require('../../config');
44
const common = require('../../common');
5-
const endpoints = require('../../../../../sdk-config.json');
65

76
test.beforeEach(async ({ page }) => {
87
await page.setViewportSize({ width: 1920, height: 1080 });
@@ -106,28 +105,16 @@ test.describe('E2E test', () => {
106105
const sendToMgr = page.locator('mat-checkbox[data-test-id="C3B43E79AEC2D689F0CF97BD6AFB7DC4"]');
107106
await sendToMgr.click();
108107

109-
const currentCaseID = await page.locator('div[id="current-caseID"]').textContent();
110108
const filePath = path.join(__dirname, '../../../src/assets/cableinfo.jpg');
111109
const attachInputId = await page.locator('div[id="attachment-container"] >> input').getAttribute('id');
112110
await page.setInputFiles(`#${attachInputId}`, filePath);
113-
114-
await Promise.all([
115-
page.waitForResponse(
116-
`${endpoints.serverConfig.infinityRestServerUrl}${
117-
endpoints.serverConfig.appAlias ? `/app/${endpoints.serverConfig.appAlias}` : ''
118-
}/api/application/v2/attachments/upload`
119-
)
120-
]);
111+
await page.waitForTimeout(5000);
112+
await expect(page.locator('mat-spinner')).not.toBeVisible();
121113

122114
await page.locator('button:has-text("submit")').click();
123115

124-
await Promise.all([
125-
page.waitForResponse(
126-
`${endpoints.serverConfig.infinityRestServerUrl}${
127-
endpoints.serverConfig.appAlias ? `/app/${endpoints.serverConfig.appAlias}` : ''
128-
}/api/application/v2/cases/${currentCaseID}/attachments?includeThumbnail=false`
129-
)
130-
]);
116+
const todo = page.locator('div[id="worklist"]');
117+
await expect(todo.getByText('To do')).toBeVisible();
131118

132119
const attachmentCount = await page.locator('div[id="attachments-count"]').textContent();
133120
await expect(Number(attachmentCount)).toBeGreaterThan(0);

0 commit comments

Comments
 (0)