Fix e2e tests (#11792)
This commit is contained in:
committed by
GitHub
parent
fef627b7c2
commit
19f46a0091
@ -258,29 +258,64 @@ export class WorkflowVisualizerPage {
|
|||||||
|
|
||||||
await expect(this.#page.getByTestId('command-menu')).not.toBeVisible();
|
await expect(this.#page.getByTestId('command-menu')).not.toBeVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async goToWorkflowsIndexPage() {
|
||||||
|
await this.#page.goto('/objects/workflows');
|
||||||
|
}
|
||||||
|
|
||||||
|
async setWorkflowsOpenInMode(mode: 'side-panel' | 'record-page') {
|
||||||
|
const recordTableOptionsButton = this.#page.getByText('Options');
|
||||||
|
await recordTableOptionsButton.click();
|
||||||
|
|
||||||
|
const layoutButton = this.#page.getByText('Layout');
|
||||||
|
await layoutButton.click();
|
||||||
|
|
||||||
|
const openInButton = this.#page.getByText('Open in');
|
||||||
|
await openInButton.click();
|
||||||
|
|
||||||
|
if (mode === 'side-panel') {
|
||||||
|
const openInSidePanelOption = this.#page.getByRole('option', {
|
||||||
|
name: 'Side Panel',
|
||||||
|
});
|
||||||
|
|
||||||
|
await openInSidePanelOption.click();
|
||||||
|
} else {
|
||||||
|
const openInRecordPageOption = this.#page.getByRole('option', {
|
||||||
|
name: 'Record Page',
|
||||||
|
});
|
||||||
|
|
||||||
|
await openInRecordPageOption.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the dropdown
|
||||||
|
await recordTableOptionsButton.click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const test = base.extend<{ workflowVisualizer: WorkflowVisualizerPage }>(
|
export const test = base.extend<{
|
||||||
{
|
workflowVisualizer: WorkflowVisualizerPage;
|
||||||
workflowVisualizer: async ({ page }, use) => {
|
}>({
|
||||||
const workflowVisualizer = new WorkflowVisualizerPage({
|
workflowVisualizer: async ({ page }, use) => {
|
||||||
page,
|
const workflowVisualizer = new WorkflowVisualizerPage({
|
||||||
workflowName: 'Test Workflow',
|
page,
|
||||||
});
|
workflowName: 'Test Workflow',
|
||||||
|
});
|
||||||
|
|
||||||
await workflowVisualizer.createOneWorkflow();
|
await workflowVisualizer.createOneWorkflow();
|
||||||
await workflowVisualizer.goToWorkflowVisualizerPage();
|
await workflowVisualizer.goToWorkflowVisualizerPage();
|
||||||
|
|
||||||
await use(workflowVisualizer);
|
await use(workflowVisualizer);
|
||||||
|
|
||||||
await deleteWorkflow({
|
await deleteWorkflow({
|
||||||
page,
|
page,
|
||||||
workflowId: workflowVisualizer.workflowId,
|
workflowId: workflowVisualizer.workflowId,
|
||||||
});
|
});
|
||||||
await destroyWorkflow({
|
await destroyWorkflow({
|
||||||
page,
|
page,
|
||||||
workflowId: workflowVisualizer.workflowId,
|
workflowId: workflowVisualizer.workflowId,
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
await workflowVisualizer.goToWorkflowsIndexPage();
|
||||||
|
await workflowVisualizer.setWorkflowsOpenInMode('record-page');
|
||||||
},
|
},
|
||||||
);
|
});
|
||||||
|
|||||||
@ -57,7 +57,8 @@ test('The workflow run visualizer shows the executed draft version without the l
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Workflow Runs with a pending form step can be opened in the side panel and then in full screen', async ({
|
// FIXME: Documented bug. See https://github.com/twentyhq/core-team-issues/issues/921
|
||||||
|
test.fail('Workflow Runs with a pending form step can be opened in the side panel and then in full screen', async ({
|
||||||
workflowVisualizer,
|
workflowVisualizer,
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
@ -100,23 +101,7 @@ test('Workflow Runs with a pending form step can be opened in the side panel and
|
|||||||
|
|
||||||
await expect(workflowRunNameCell).toBeVisible();
|
await expect(workflowRunNameCell).toBeVisible();
|
||||||
|
|
||||||
const recordTableOptionsButton = page.getByText('Options');
|
await workflowVisualizer.setWorkflowsOpenInMode('side-panel');
|
||||||
|
|
||||||
await recordTableOptionsButton.click();
|
|
||||||
|
|
||||||
const layoutButton = page.getByText('Layout');
|
|
||||||
|
|
||||||
await layoutButton.click();
|
|
||||||
|
|
||||||
const openInButton = page.getByText('Open in');
|
|
||||||
|
|
||||||
await openInButton.click();
|
|
||||||
|
|
||||||
const openInSidePanelOption = page.getByRole('option', {
|
|
||||||
name: 'Side panel',
|
|
||||||
});
|
|
||||||
|
|
||||||
await openInSidePanelOption.click();
|
|
||||||
|
|
||||||
// 1. Exit the dropdown
|
// 1. Exit the dropdown
|
||||||
await workflowRunNameCell.click();
|
await workflowRunNameCell.click();
|
||||||
|
|||||||
@ -8,25 +8,19 @@ test('Use an old version as draft', async ({ workflowVisualizer, page }) => {
|
|||||||
|
|
||||||
await workflowVisualizer.background.click();
|
await workflowVisualizer.background.click();
|
||||||
|
|
||||||
await Promise.all([
|
await workflowVisualizer.activateWorkflowButton.click();
|
||||||
expect(workflowVisualizer.workflowStatus).toHaveText('Active'),
|
|
||||||
|
|
||||||
workflowVisualizer.activateWorkflowButton.click(),
|
await expect(workflowVisualizer.workflowStatus).toHaveText('Active');
|
||||||
]);
|
|
||||||
|
|
||||||
await Promise.all([
|
await workflowVisualizer.createStep('delete-record');
|
||||||
expect(workflowVisualizer.workflowStatus).toHaveText('Draft'),
|
|
||||||
|
|
||||||
workflowVisualizer.createStep('delete-record'),
|
await expect(workflowVisualizer.workflowStatus).toHaveText('Draft');
|
||||||
]);
|
|
||||||
|
|
||||||
await workflowVisualizer.background.click();
|
await workflowVisualizer.closeSidePanel();
|
||||||
|
|
||||||
await Promise.all([
|
await workflowVisualizer.activateWorkflowButton.click();
|
||||||
expect(workflowVisualizer.workflowStatus).toHaveText('Active'),
|
|
||||||
|
|
||||||
workflowVisualizer.activateWorkflowButton.click(),
|
await expect(workflowVisualizer.workflowStatus).toHaveText('Active');
|
||||||
]);
|
|
||||||
|
|
||||||
await expect(workflowVisualizer.triggerNode).toContainText(
|
await expect(workflowVisualizer.triggerNode).toContainText(
|
||||||
'Record is Created',
|
'Record is Created',
|
||||||
@ -41,6 +35,8 @@ test('Use an old version as draft', async ({ workflowVisualizer, page }) => {
|
|||||||
const workflowsLink = page.getByRole('link', { name: 'Workflows' });
|
const workflowsLink = page.getByRole('link', { name: 'Workflows' });
|
||||||
await workflowsLink.click();
|
await workflowsLink.click();
|
||||||
|
|
||||||
|
await workflowVisualizer.setWorkflowsOpenInMode('record-page');
|
||||||
|
|
||||||
const recordTableRowForWorkflow = page.getByRole('row', {
|
const recordTableRowForWorkflow = page.getByRole('row', {
|
||||||
name: workflowVisualizer.workflowName,
|
name: workflowVisualizer.workflowName,
|
||||||
});
|
});
|
||||||
@ -48,7 +44,7 @@ test('Use an old version as draft', async ({ workflowVisualizer, page }) => {
|
|||||||
const linkToWorkflow = recordTableRowForWorkflow.getByRole('link', {
|
const linkToWorkflow = recordTableRowForWorkflow.getByRole('link', {
|
||||||
name: workflowVisualizer.workflowName,
|
name: workflowVisualizer.workflowName,
|
||||||
});
|
});
|
||||||
expect(linkToWorkflow).toBeVisible();
|
await expect(linkToWorkflow).toBeVisible();
|
||||||
|
|
||||||
const linkToFirstWorkflowVersion = recordTableRowForWorkflow.getByRole(
|
const linkToFirstWorkflowVersion = recordTableRowForWorkflow.getByRole(
|
||||||
'link',
|
'link',
|
||||||
@ -69,11 +65,9 @@ test('Use an old version as draft', async ({ workflowVisualizer, page }) => {
|
|||||||
]);
|
]);
|
||||||
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
||||||
|
|
||||||
await Promise.all([
|
await workflowVisualizer.useAsDraftButton.click();
|
||||||
page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`),
|
|
||||||
|
|
||||||
workflowVisualizer.useAsDraftButton.click(),
|
await page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`);
|
||||||
]);
|
|
||||||
|
|
||||||
await expect(workflowVisualizer.workflowStatus).toHaveText('Draft');
|
await expect(workflowVisualizer.workflowStatus).toHaveText('Draft');
|
||||||
await expect(workflowVisualizer.useAsDraftButton).not.toBeVisible();
|
await expect(workflowVisualizer.useAsDraftButton).not.toBeVisible();
|
||||||
@ -96,17 +90,13 @@ test('Use an old version as draft while having a pending draft version', async (
|
|||||||
|
|
||||||
await workflowVisualizer.background.click();
|
await workflowVisualizer.background.click();
|
||||||
|
|
||||||
await Promise.all([
|
await workflowVisualizer.activateWorkflowButton.click();
|
||||||
expect(workflowVisualizer.workflowStatus).toHaveText('Active'),
|
|
||||||
|
|
||||||
workflowVisualizer.activateWorkflowButton.click(),
|
await expect(workflowVisualizer.workflowStatus).toHaveText('Active');
|
||||||
]);
|
|
||||||
|
|
||||||
await Promise.all([
|
await workflowVisualizer.createStep('delete-record');
|
||||||
expect(workflowVisualizer.workflowStatus).toHaveText('Draft'),
|
|
||||||
|
|
||||||
workflowVisualizer.createStep('delete-record'),
|
await expect(workflowVisualizer.workflowStatus).toHaveText('Draft');
|
||||||
]);
|
|
||||||
|
|
||||||
await expect(workflowVisualizer.triggerNode).toContainText(
|
await expect(workflowVisualizer.triggerNode).toContainText(
|
||||||
'Record is Created',
|
'Record is Created',
|
||||||
@ -130,7 +120,7 @@ test('Use an old version as draft while having a pending draft version', async (
|
|||||||
const linkToWorkflow = recordTableRowForWorkflow.getByRole('link', {
|
const linkToWorkflow = recordTableRowForWorkflow.getByRole('link', {
|
||||||
name: workflowVisualizer.workflowName,
|
name: workflowVisualizer.workflowName,
|
||||||
});
|
});
|
||||||
expect(linkToWorkflow).toBeVisible();
|
await expect(linkToWorkflow).toBeVisible();
|
||||||
|
|
||||||
const linkToFirstWorkflowVersion = recordTableRowForWorkflow.getByRole(
|
const linkToFirstWorkflowVersion = recordTableRowForWorkflow.getByRole(
|
||||||
'link',
|
'link',
|
||||||
@ -151,17 +141,13 @@ test('Use an old version as draft while having a pending draft version', async (
|
|||||||
]);
|
]);
|
||||||
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
||||||
|
|
||||||
await Promise.all([
|
await workflowVisualizer.useAsDraftButton.click();
|
||||||
expect(workflowVisualizer.overrideDraftButton).toBeVisible(),
|
|
||||||
|
|
||||||
workflowVisualizer.useAsDraftButton.click(),
|
await expect(workflowVisualizer.overrideDraftButton).toBeVisible();
|
||||||
]);
|
|
||||||
|
|
||||||
await Promise.all([
|
await workflowVisualizer.overrideDraftButton.click();
|
||||||
page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`),
|
|
||||||
|
|
||||||
workflowVisualizer.overrideDraftButton.click(),
|
await page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`);
|
||||||
]);
|
|
||||||
|
|
||||||
await expect(workflowVisualizer.workflowStatus).toHaveText('Draft');
|
await expect(workflowVisualizer.workflowStatus).toHaveText('Draft');
|
||||||
await expect(workflowVisualizer.useAsDraftButton).not.toBeVisible();
|
await expect(workflowVisualizer.useAsDraftButton).not.toBeVisible();
|
||||||
|
|||||||
Reference in New Issue
Block a user