Skip to content

Commit b508f78

Browse files
renemadsenclaude
andcommitted
fix: address CI test failures
- Add .trim() to all textContent() calls in getRow() (fixes whitespace mismatch in test c) - Use .filter({ hasText }) instead of WDIO-style .ng-option= selector (fixes test b) - Simplify test a to use shared PluginRowObject methods instead of manual menu interaction Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7612390 commit b508f78

File tree

2 files changed

+18
-64
lines changed

2 files changed

+18
-64
lines changed

eform-client/playwright/e2e/plugins/workflow-pn/WorkflowCases.page.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ export class WorkflowCaseRowObject {
163163
const rowIndex = rowNum - 1;
164164
const rows = this.page.locator('table tr.mat-mdc-row');
165165
if ((await rows.count()) >= rowNum) {
166-
this.id = +(await this.page.locator('tbody > tr > td.mat-column-id').nth(rowIndex).textContent() || '0');
167-
this.dateOfIncident = await this.page.locator('tbody > tr > td.mat-column-dateOfIncident').nth(rowIndex).textContent() || '';
168-
this.incidentType = await this.page.locator('tbody > tr > td.mat-column-incidentType').nth(rowIndex).textContent() || '';
169-
this.incidentPlace = await this.page.locator('tbody > tr > td.mat-column-incidentPlace').nth(rowIndex).textContent() || '';
170-
this.description = await this.page.locator('tbody > tr > td.mat-column-description').nth(rowIndex).textContent() || '';
171-
this.deadline = await this.page.locator('tbody > tr > td.mat-column-deadline').nth(rowIndex).textContent() || '';
172-
this.actionPlan = await this.page.locator('tbody > tr > td.mat-column-actionPlan').nth(rowIndex).textContent() || '';
173-
this.toBeSolvedBy = await this.page.locator('tbody > tr > td.mat-column-solvedBy').nth(rowIndex).textContent() || '';
174-
this.status = await this.page.locator('tbody > tr > td.mat-column-status').nth(rowIndex).textContent() || '';
166+
this.id = +(await this.page.locator('tbody > tr > td.mat-column-id').nth(rowIndex).textContent() || '0').trim();
167+
this.dateOfIncident = (await this.page.locator('tbody > tr > td.mat-column-dateOfIncident').nth(rowIndex).textContent() || '').trim();
168+
this.incidentType = (await this.page.locator('tbody > tr > td.mat-column-incidentType').nth(rowIndex).textContent() || '').trim();
169+
this.incidentPlace = (await this.page.locator('tbody > tr > td.mat-column-incidentPlace').nth(rowIndex).textContent() || '').trim();
170+
this.description = (await this.page.locator('tbody > tr > td.mat-column-description').nth(rowIndex).textContent() || '').trim();
171+
this.deadline = (await this.page.locator('tbody > tr > td.mat-column-deadline').nth(rowIndex).textContent() || '').trim();
172+
this.actionPlan = (await this.page.locator('tbody > tr > td.mat-column-actionPlan').nth(rowIndex).textContent() || '').trim();
173+
this.toBeSolvedBy = (await this.page.locator('tbody > tr > td.mat-column-solvedBy').nth(rowIndex).textContent() || '').trim();
174+
this.status = (await this.page.locator('tbody > tr > td.mat-column-status').nth(rowIndex).textContent() || '').trim();
175175
this.menuBtn = this.page.locator(`#actionMenu-${rowIndex}`);
176176
this.updateBtn = this.page.locator(`#editWorkflowCaseBtn-${rowIndex}`);
177177
this.deleteBtn = this.page.locator(`#deleteBtn-${rowIndex}`);
@@ -195,7 +195,7 @@ export class WorkflowCaseRowObject {
195195
if (updateModel.status) {
196196
await this.workflowCasesPage.statusEdit().locator('input').fill(updateModel.status);
197197
await this.page.waitForTimeout(1000);
198-
const option = this.page.locator('ng-dropdown-panel').locator(`.ng-option=${updateModel.status}`);
198+
const option = this.page.locator('ng-dropdown-panel').locator('.ng-option').filter({ hasText: updateModel.status }).first();
199199
await option.waitFor({ state: 'visible', timeout: 20000 });
200200
await option.click();
201201
}

eform-client/playwright/e2e/plugins/workflow-pn/a/workflow-settings.spec.ts

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -27,68 +27,22 @@ test.describe('Application settings page - site header section', () => {
2727
const plugin = await pluginPage.getFirstPluginRowObj();
2828
expect(plugin.id).toBe(1);
2929
expect(plugin.name).toBe('Microting Workflow Plugin');
30-
31-
// Open action menu to check status
32-
const actionMenuBtn = page.locator('#action-items-0').locator('#actionMenu');
33-
await actionMenuBtn.waitFor({ state: 'visible', timeout: 40000 });
34-
await actionMenuBtn.click();
35-
await page.waitForTimeout(500);
36-
37-
const statusBtn = page.locator('#plugin-status-button0');
38-
await statusBtn.waitFor({ state: 'visible', timeout: 40000 });
39-
const statusIcon = statusBtn.locator('mat-icon');
40-
const status = await statusIcon.textContent();
41-
expect(status).toBe('toggle_off');
42-
43-
// Close the menu
44-
await page.keyboard.press('Escape');
45-
await page.waitForTimeout(300);
30+
expect(plugin.status).toBe('toggle_off');
4631
});
4732

4833
test('should activate the plugin', async () => {
34+
test.setTimeout(180000);
4935
const loginPage = new LoginPage(page);
5036
const myEformsPage = new MyEformsPage(page);
5137
const pluginPage = new PluginPage(page);
5238

53-
// Open action menu
54-
const actionMenuBtn = page.locator('#action-items-0').locator('#actionMenu');
55-
await actionMenuBtn.waitFor({ state: 'visible', timeout: 40000 });
56-
await actionMenuBtn.click();
57-
await page.waitForTimeout(500);
58-
59-
// Click on the status button inside the menu
60-
const statusBtn = page.locator('#plugin-status-button0');
61-
await statusBtn.waitFor({ state: 'visible', timeout: 40000 });
62-
await statusBtn.click();
63-
await page.waitForTimeout(500);
64-
65-
// Confirm activation in the modal
66-
const pluginOKBtn = page.locator('#pluginOKBtn');
67-
await pluginOKBtn.waitFor({ state: 'visible', timeout: 40000 });
68-
await pluginOKBtn.click();
69-
await page.waitForTimeout(100000); // Wait for plugin to create db etc.
70-
71-
// Re-login and navigate back to plugins page
72-
await loginPage.open('/');
73-
await loginPage.login();
74-
await myEformsPage.Navbar.goToPluginsPage();
75-
await page.waitForTimeout(500);
76-
77-
// Verify the plugin is now activated
7839
const plugin = await pluginPage.getFirstPluginRowObj();
79-
expect(plugin.id).toBe(1);
80-
expect(plugin.name).toBe('Microting Workflow Plugin');
81-
82-
// Open action menu to check new status
83-
const actionMenuBtn2 = page.locator('#action-items-0').locator('#actionMenu');
84-
await actionMenuBtn2.waitFor({ state: 'visible', timeout: 40000 });
85-
await actionMenuBtn2.click();
86-
await page.waitForTimeout(500);
40+
await plugin.enableOrDisablePlugin();
8741

88-
const statusBtn2 = page.locator('#plugin-status-button0');
89-
await statusBtn2.waitFor({ state: 'visible', timeout: 40000 });
90-
const statusIcon2 = statusBtn2.locator('mat-icon');
91-
const status = await statusIcon2.textContent();
92-
expect(status).toBe('toggle_on');
42+
// After enableOrDisablePlugin: re-logged in and on plugins page
43+
const pluginAfter = await pluginPage.getFirstPluginRowObj();
44+
expect(pluginAfter.id).toBe(1);
45+
expect(pluginAfter.name).toBe('Microting Workflow Plugin');
46+
expect(pluginAfter.status).toBe('toggle_on');
9347
});
9448
});

0 commit comments

Comments
 (0)