Skip to content

Commit f9c020b

Browse files
renemadsenclaude
andcommitted
fix: resolve remaining Playwright test failures in jobs B and C
- Fix checkbox click: use mat-checkbox element directly instead of invisible MDC label - Fix sorting tests: remove .ng-trigger-leftPointer dependency, verify sort order directly - Fix tags test: wait for tag list refresh after API call instead of fixed timeout - Fix import test: add spinner wait and longer timeout for plannings import - Fix pairing test: increase beforeAll/afterAll timeout to 480s for 4 planning creations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6577439 commit f9c020b

5 files changed

Lines changed: 49 additions & 67 deletions

File tree

eform-client/playwright/e2e/plugins/items-planning-pn/ItemsPlanningPlanningPage.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class ItemsPlanningPlanningPage extends PageWithNavbarPage {
7878
}
7979

8080
public get selectAllPlanningsCheckboxForClick(): Locator {
81-
return this.selectAllPlanningsCheckbox.locator('label');
81+
return this.selectAllPlanningsCheckbox;
8282
}
8383

8484
public get importPlanningsBtn(): Locator {
@@ -433,9 +433,9 @@ export class PlanningRowObject {
433433
}
434434

435435
async clickOnCheckboxForMultipleDelete(valueCheckbox = true) {
436-
const currentValue = await this.checkboxDelete.inputValue().catch(() => '');
437-
if (currentValue !== valueCheckbox.toString()) {
438-
await this.checkboxDeleteForClick.click();
436+
const isChecked = await this.checkboxDelete.locator('input').isChecked().catch(() => false);
437+
if (isChecked !== valueCheckbox) {
438+
await this.checkboxDeleteForClick.click({ force: true });
439439
}
440440
}
441441

eform-client/playwright/e2e/plugins/items-planning-pn/c/items-planning.import.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ test.describe.serial('Items planning - Import', () => {
4848
timeout: 20000,
4949
});
5050
await itemsPlanningModalPage.xlsxImportPlanningsInput.setInputFiles(filePath);
51+
await page.locator('#spinner-animation').waitFor({ state: 'hidden', timeout: 90000 }).catch(() => {});
5152
await itemsPlanningPlanningPage.planningCreateBtn.waitFor({
5253
state: 'visible',
53-
timeout: 60000,
54+
timeout: 120000,
5455
});
56+
await page.waitForTimeout(2000);
5557
expect(planningsBeforeImport).not.toBe(
5658
await itemsPlanningPlanningPage.rowNum()
5759
);

eform-client/playwright/e2e/plugins/items-planning-pn/c/items-planning.pairing.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const countDeviceUsers = 4;
2121
const countPlanning = 4;
2222

2323
test.describe.serial('Items planning plugin - Pairing', () => {
24-
test.describe.configure({ timeout: 240000 });
24+
test.describe.configure({ timeout: 480000 });
2525
test.beforeAll(async ({ browser }, testInfo) => {
26-
testInfo.setTimeout(240000);
26+
testInfo.setTimeout(480000);
2727
page = await browser.newPage();
2828
const loginPage = new LoginPage(page);
2929
const myEformsPage = new MyEformsPage(page);
@@ -78,7 +78,7 @@ test.describe.serial('Items planning plugin - Pairing', () => {
7878
});
7979

8080
test.afterAll(async ({}, testInfo) => {
81-
testInfo.setTimeout(240000);
81+
testInfo.setTimeout(480000);
8282
const myEformsPage = new MyEformsPage(page);
8383
const foldersPage = new FoldersPage(page);
8484
const deviceUsersPage = new DeviceUsersPage(page);

eform-client/playwright/e2e/plugins/items-planning-pn/c/items-planning.sorting.spec.ts

Lines changed: 32 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -42,76 +42,51 @@ test.describe.serial('Items planning plannings - Sorting', () => {
4242
const itemsPlanningPlanningPage = new ItemsPlanningPlanningPage(page);
4343
await page.waitForTimeout(1000);
4444

45+
// Click once for ascending sort
46+
await itemsPlanningPlanningPage.clickIdTableHeader();
4547
let list = await page.locator('td.planningId').all();
46-
const planningBefore = await Promise.all(list.map((item) => item.textContent()));
47-
48-
for (let i = 0; i < 2; i++) {
49-
await itemsPlanningPlanningPage.clickIdTableHeader();
50-
51-
list = await page.locator('td.planningId').all();
52-
const planningAfter = await Promise.all(list.map((item) => item.textContent()));
53-
54-
const sortIcon = await page.locator('th.planningId').locator('.ng-trigger-leftPointer').getAttribute('style');
55-
let sorted;
56-
if (sortIcon === 'transform: rotate(45deg);') {
57-
sorted = [...planningBefore].sort().reverse();
58-
} else if (sortIcon === 'expand_less') {
59-
sorted = planningBefore;
60-
} else {
61-
sorted = [...planningBefore].sort();
62-
}
63-
expect(sorted).toEqual(planningAfter);
64-
}
48+
const ascValues = await Promise.all(list.map((item) => item.textContent()));
49+
const sortedAsc = [...ascValues].sort();
50+
expect(ascValues).toEqual(sortedAsc);
51+
52+
// Click again for descending sort
53+
await itemsPlanningPlanningPage.clickIdTableHeader();
54+
list = await page.locator('td.planningId').all();
55+
const descValues = await Promise.all(list.map((item) => item.textContent()));
56+
const sortedDesc = [...descValues].sort().reverse();
57+
expect(descValues).toEqual(sortedDesc);
6558
});
6659

6760
test('should be able to sort by Name', async () => {
6861
const itemsPlanningPlanningPage = new ItemsPlanningPlanningPage(page);
6962

63+
await itemsPlanningPlanningPage.clickNameTableHeader();
7064
let list = await page.locator('td.planningName').all();
71-
const planningBefore = await Promise.all(list.map((item) => item.textContent()));
72-
73-
for (let i = 0; i < 2; i++) {
74-
await itemsPlanningPlanningPage.clickNameTableHeader();
75-
76-
list = await page.locator('td.planningName').all();
77-
const planningAfter = await Promise.all(list.map((item) => item.textContent()));
78-
79-
const sortIcon = await page.locator('th.planningName').locator('.ng-trigger-leftPointer').getAttribute('style');
80-
let sorted;
81-
if (sortIcon === 'transform: rotate(45deg);') {
82-
sorted = [...planningBefore].sort().reverse();
83-
} else if (sortIcon === 'expand_less') {
84-
sorted = planningBefore;
85-
} else {
86-
sorted = [...planningBefore].sort();
87-
}
88-
expect(sorted).toEqual(planningAfter);
89-
}
65+
const ascValues = await Promise.all(list.map((item) => item.textContent()));
66+
const sortedAsc = [...ascValues].sort();
67+
expect(ascValues).toEqual(sortedAsc);
68+
69+
await itemsPlanningPlanningPage.clickNameTableHeader();
70+
list = await page.locator('td.planningName').all();
71+
const descValues = await Promise.all(list.map((item) => item.textContent()));
72+
const sortedDesc = [...descValues].sort().reverse();
73+
expect(descValues).toEqual(sortedDesc);
9074
});
9175

9276
test('should be able to sort by Description', async () => {
9377
const itemsPlanningPlanningPage = new ItemsPlanningPlanningPage(page);
9478

79+
await itemsPlanningPlanningPage.clickDescriptionTableHeader();
9580
let list = await page.locator('td.planningDescription').all();
96-
const planningBefore = await Promise.all(list.map((item) => item.textContent()));
97-
98-
for (let i = 0; i < 2; i++) {
99-
await itemsPlanningPlanningPage.clickDescriptionTableHeader();
100-
101-
list = await page.locator('td.planningDescription').all();
102-
const planningAfter = await Promise.all(list.map((item) => item.textContent()));
103-
104-
const sortIcon = await page.locator('th.planningDescription').locator('.ng-trigger-leftPointer').getAttribute('style');
105-
let sorted;
106-
if (sortIcon === 'transform: rotate(45deg);') {
107-
sorted = [...planningBefore].sort().reverse();
108-
} else if (sortIcon === 'expand_less') {
109-
sorted = planningBefore;
110-
} else {
111-
sorted = [...planningBefore].sort();
112-
}
113-
expect(sorted).toEqual(planningAfter);
114-
}
81+
const ascValues = await Promise.all(list.map((item) => item.textContent()));
82+
const sortedAsc = [...ascValues].sort();
83+
expect(ascValues).toEqual(sortedAsc);
84+
85+
await itemsPlanningPlanningPage.clickDescriptionTableHeader();
86+
list = await page.locator('td.planningDescription').all();
87+
const descValues = await Promise.all(list.map((item) => item.textContent()));
88+
const sortedDesc = [...descValues].sort().reverse();
89+
expect(descValues).toEqual(sortedDesc);
11590
});
11691

11792
test('should clear table', async () => {

eform-client/playwright/e2e/plugins/items-planning-pn/c/items-planning.tags.spec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ test.describe.serial('Items planning - Tags', () => {
2929
const tagsModalPage = new TagsModalPage(page);
3030
const tagsRowsBeforeCreate = await tagsModalPage.rowNum();
3131
await tagsModalPage.createTag(tagName);
32-
await page.waitForTimeout(2000);
32+
// Wait for the tag list to refresh after API call
33+
await page.waitForFunction(
34+
(expectedCount: number) => document.querySelectorAll('#tagName').length >= expectedCount,
35+
tagsRowsBeforeCreate + 1,
36+
{ timeout: 30000 }
37+
);
3338
const tagsRowsAfterCreate = await tagsModalPage.rowNum();
34-
const tagRowObject = new TagRowObject(page);
39+
const tagRowObject = new TagRowObject(page, tagsModalPage);
3540
const tagRowObj = await tagRowObject.getRow(tagsRowsAfterCreate);
3641
expect(tagsRowsAfterCreate).toBe(tagsRowsBeforeCreate + 1);
3742
expect(tagRowObj.name.trim()).toBe(tagName);

0 commit comments

Comments
 (0)