Fix e2e tests (#11565)

Fixing the e2e tests
This commit is contained in:
Baptiste Devessier
2025-04-14 17:47:57 +02:00
committed by GitHub
parent 8a3f8ef324
commit 0be700f376
5 changed files with 49 additions and 41 deletions

View File

@ -17,6 +17,7 @@ export class WorkflowVisualizerPage {
readonly deactivateWorkflowButton: Locator; readonly deactivateWorkflowButton: Locator;
readonly addTriggerButton: Locator; readonly addTriggerButton: Locator;
readonly commandMenu: Locator; readonly commandMenu: Locator;
readonly stepHeaderInCommandMenu: Locator;
readonly workflowNameLabel: Locator; readonly workflowNameLabel: Locator;
readonly triggerNode: Locator; readonly triggerNode: Locator;
readonly background: Locator; readonly background: Locator;
@ -68,6 +69,9 @@ export class WorkflowVisualizerPage {
}); });
this.addTriggerButton = page.getByText('Add a Trigger'); this.addTriggerButton = page.getByText('Add a Trigger');
this.commandMenu = page.getByTestId('command-menu'); this.commandMenu = page.getByTestId('command-menu');
this.stepHeaderInCommandMenu = this.commandMenu.getByTestId(
'workflow-step-header',
);
this.workflowNameLabel = page this.workflowNameLabel = page
.getByTestId('top-bar-title') .getByTestId('top-bar-title')
.getByText(this.workflowName); .getByText(this.workflowName);

View File

@ -110,6 +110,10 @@ export class SettingsPage {
await this.releasesLink.click(); await this.releasesLink.click();
} }
async logout() {
await this.page.getByText('Logout').click();
}
async toggleAdvancedSettings() { async toggleAdvancedSettings() {
await this.advancedToggle.click(); await this.advancedToggle.click();
} }

View File

@ -10,7 +10,9 @@ test('Create workflow', async ({ page }) => {
const workflowsLink = page.getByRole('link', { name: 'Workflows' }); const workflowsLink = page.getByRole('link', { name: 'Workflows' });
await workflowsLink.click(); await workflowsLink.click();
const createWorkflowButton = page.getByRole('button', { name: 'New record' }); const createWorkflowButton = page.getByRole('button', {
name: 'Create new workflow',
});
const [createWorkflowResponse] = await Promise.all([ const [createWorkflowResponse] = await Promise.all([
page.waitForResponse(async (response) => { page.waitForResponse(async (response) => {

View File

@ -1,60 +1,58 @@
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { test } from '../lib/fixtures/blank-workflow'; import { test } from '../lib/fixtures/blank-workflow';
test.fixme( test('The workflow run visualizer shows the executed draft version without the last draft changes', async ({
'The workflow run visualizer shows the executed draft version without the last draft changes', workflowVisualizer,
async ({ workflowVisualizer, page }) => { page,
await workflowVisualizer.createInitialTrigger('manual'); }) => {
await workflowVisualizer.createInitialTrigger('manual');
const manualTriggerAvailabilitySelect = page.getByRole('button', { const manualTriggerAvailabilitySelect = page.getByRole('button', {
name: 'When record(s) are selected', name: 'When record(s) are selected',
}); });
await manualTriggerAvailabilitySelect.click(); await manualTriggerAvailabilitySelect.click();
const alwaysAvailableOption = page.getByText( const alwaysAvailableOption = page.getByText(
'When no record(s) are selected', 'When no record(s) are selected',
); );
await alwaysAvailableOption.click(); await alwaysAvailableOption.click();
await workflowVisualizer.closeSidePanel(); await workflowVisualizer.closeSidePanel();
const { createdStepId: firstStepId } = const { createdStepId: firstStepId } =
await workflowVisualizer.createStep('create-record'); await workflowVisualizer.createStep('create-record');
await workflowVisualizer.closeSidePanel(); await workflowVisualizer.closeSidePanel();
const launchTestButton = page.getByLabel('Test Workflow'); const launchTestButton = page.getByLabel(workflowVisualizer.workflowName);
await launchTestButton.click(); await launchTestButton.click();
const goToExecutionPageLink = page.getByRole('link', { const goToExecutionPageLink = page.getByRole('link', {
name: 'View execution details', name: 'View execution details',
}); });
const executionPageUrl = await goToExecutionPageLink.getAttribute('href'); const executionPageUrl = await goToExecutionPageLink.getAttribute('href');
expect(executionPageUrl).not.toBeNull(); expect(executionPageUrl).not.toBeNull();
await workflowVisualizer.deleteStep(firstStepId); await workflowVisualizer.deleteStep(firstStepId);
await page.goto(executionPageUrl!); await page.goto(executionPageUrl!);
const workflowRunName = page.getByText('Execution of v1'); const workflowRunName = page.getByText(
`#1 - ${workflowVisualizer.workflowName}`,
);
await expect(workflowRunName).toBeVisible(); await expect(workflowRunName).toBeVisible();
const flowTab = page.getByText('Flow', { exact: true }); const executedFirstStepNode = workflowVisualizer.getStepNode(firstStepId);
await flowTab.click(); await expect(executedFirstStepNode).toBeVisible();
const executedFirstStepNode = workflowVisualizer.getStepNode(firstStepId); await executedFirstStepNode.click();
await expect(executedFirstStepNode).toBeVisible(); await expect(workflowVisualizer.stepHeaderInCommandMenu).toContainText(
'Create Record',
await executedFirstStepNode.click(); );
});
await expect(
workflowVisualizer.commandMenu.getByRole('textbox').first(),
).toHaveValue('Create Record');
},
);

View File

@ -90,7 +90,7 @@ export const WorkflowStepHeader = ({
}; };
return ( return (
<StyledHeader> <StyledHeader data-testid="workflow-step-header">
<StyledHeaderIconContainer> <StyledHeaderIconContainer>
<Icon <Icon
color={iconColor} color={iconColor}