|
1 | 1 | import { expect } from '@playwright/test';
|
2 |
| -import type { Page } from '@playwright/test'; |
| 2 | +import type { Page, Locator } from '@playwright/test'; |
3 | 3 | import { ActionsConfig } from './ActionsConfig';
|
4 | 4 | import { PolicyConfig } from './PolicyConfig';
|
5 | 5 | import { BasePage } from '../../helpers/BasePage';
|
@@ -73,15 +73,13 @@ export class ProcessEditorPage extends BasePage {
|
73 | 73 | }
|
74 | 74 |
|
75 | 75 | public async getTaskIdFromOpenNewlyAddedTask(): Promise<string> {
|
76 |
| - const selector = 'text=ID: Activity_'; |
77 |
| - await this.page.waitForSelector(selector); |
78 |
| - return await this.getFullIdFromButtonSelector(selector); |
| 76 | + const button = this.page.getByRole('button', { name: /^Activity_/ }); |
| 77 | + await button.waitFor(); |
| 78 | + return await this.getFullIdFromButtonSelector(button); |
79 | 79 | }
|
80 | 80 |
|
81 | 81 | public async clickOnTaskIdEditButton(id: string): Promise<void> {
|
82 |
| - await this.page |
83 |
| - .getByText(`${this.textMock('process_editor.configuration_panel_id_label')} ${id}`) |
84 |
| - .click(); |
| 82 | + await this.page.getByRole('button', { name: id }).click(); |
85 | 83 | }
|
86 | 84 |
|
87 | 85 | public async waitForEditIdInputFieldToBeVisible(): Promise<void> {
|
@@ -123,9 +121,7 @@ export class ProcessEditorPage extends BasePage {
|
123 | 121 | }
|
124 | 122 |
|
125 | 123 | public async waitForNewTaskIdButtonToBeVisible(id: string): Promise<void> {
|
126 |
| - const button = this.page.getByText( |
127 |
| - `${this.textMock('process_editor.configuration_panel_id_label')} ${id}`, |
128 |
| - ); |
| 124 | + const button = this.page.getByRole('button', { name: id }); |
129 | 125 | await expect(button).toBeVisible();
|
130 | 126 | }
|
131 | 127 |
|
@@ -165,10 +161,9 @@ export class ProcessEditorPage extends BasePage {
|
165 | 161 | await this.page.mouse.up();
|
166 | 162 | }
|
167 | 163 |
|
168 |
| - private async getFullIdFromButtonSelector(selector: string): Promise<string> { |
169 |
| - const button = this.page.locator(selector); |
| 164 | + private async getFullIdFromButtonSelector(button: Locator): Promise<string> { |
170 | 165 | const fullText = await button.textContent();
|
171 |
| - const extractedText = fullText.match(/ID: (Activity_\w+)/); |
| 166 | + const extractedText = fullText.match(/(Activity_\w+)/); |
172 | 167 | return extractedText[1];
|
173 | 168 | }
|
174 | 169 | }
|
0 commit comments