Fix e2e tests (#10289)

- Remove the demo test as I don't think it provides much value
- Re-run a test that was discarded because it failed due to a bug;
modified the test so the bug doesn't make the test fail
- Fixed all workflow tests
This commit is contained in:
Baptiste Devessier
2025-02-18 14:30:40 +01:00
committed by GitHub
parent fb42046033
commit ade13826c2
4 changed files with 98 additions and 102 deletions

View File

@ -17,7 +17,7 @@ export class WorkflowVisualizerPage {
readonly deactivateWorkflowButton: Locator;
readonly addTriggerButton: Locator;
readonly commandMenu: Locator;
readonly workflowNameButton: Locator;
readonly workflowNameLabel: Locator;
readonly triggerNode: Locator;
readonly background: Locator;
readonly useAsDraftButton: Locator;
@ -68,9 +68,9 @@ export class WorkflowVisualizerPage {
});
this.addTriggerButton = page.getByText('Add a Trigger');
this.commandMenu = page.getByTestId('command-menu');
this.workflowNameButton = page.getByRole('button', {
name: this.workflowName,
});
this.workflowNameLabel = page
.getByTestId('top-bar-title')
.getByText(this.workflowName);
this.triggerNode = this.#page.getByTestId('rf__node-trigger');
this.background = page.locator('.react-flow__pane');
this.useAsDraftButton = page.getByRole('button', { name: 'Use as draft' });
@ -100,7 +100,7 @@ export class WorkflowVisualizerPage {
}
async waitForWorkflowVisualizerLoad() {
await expect(this.workflowNameButton).toBeVisible();
await expect(this.workflowNameLabel).toBeVisible();
}
async goToWorkflowVisualizerPage() {
@ -132,8 +132,10 @@ export class WorkflowVisualizerPage {
const actionToCreateOption = this.commandMenu.getByText(actionName);
const [createWorkflowStepResponse] = await Promise.all([
this.#page.waitForResponse((response) => {
await actionToCreateOption.click();
const createWorkflowStepResponse = await this.#page.waitForResponse(
(response) => {
if (!response.url().endsWith('/graphql')) {
return false;
}
@ -141,19 +143,14 @@ export class WorkflowVisualizerPage {
const requestBody = response.request().postDataJSON();
return requestBody.operationName === 'CreateWorkflowVersionStep';
}),
},
);
actionToCreateOption.click(),
]);
const createWorkflowStepResponseBody =
await createWorkflowStepResponse.json();
const createdStepId =
createWorkflowStepResponseBody.data.createWorkflowVersionStep.id;
await expect(
this.#page.getByTestId('command-menu').getByRole('textbox').first(),
).toHaveValue(createdActionName);
const createdActionNode = this.#page
.locator('.react-flow__node.selected')
.getByText(createdActionName);
@ -231,6 +228,14 @@ export class WorkflowVisualizerPage {
this.getDeleteNodeButton(this.triggerNode).click(),
]);
}
async closeSidePanel() {
const closeButton = this.#page.getByTestId(
'page-header-close-command-menu-button',
);
await closeButton.click();
}
}
export const test = base.extend<{ workflowVisualizer: WorkflowVisualizerPage }>(