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:
committed by
GitHub
parent
fb42046033
commit
ade13826c2
@ -17,7 +17,7 @@ export class WorkflowVisualizerPage {
|
|||||||
readonly deactivateWorkflowButton: Locator;
|
readonly deactivateWorkflowButton: Locator;
|
||||||
readonly addTriggerButton: Locator;
|
readonly addTriggerButton: Locator;
|
||||||
readonly commandMenu: Locator;
|
readonly commandMenu: Locator;
|
||||||
readonly workflowNameButton: Locator;
|
readonly workflowNameLabel: Locator;
|
||||||
readonly triggerNode: Locator;
|
readonly triggerNode: Locator;
|
||||||
readonly background: Locator;
|
readonly background: Locator;
|
||||||
readonly useAsDraftButton: Locator;
|
readonly useAsDraftButton: Locator;
|
||||||
@ -68,9 +68,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.workflowNameButton = page.getByRole('button', {
|
this.workflowNameLabel = page
|
||||||
name: this.workflowName,
|
.getByTestId('top-bar-title')
|
||||||
});
|
.getByText(this.workflowName);
|
||||||
this.triggerNode = this.#page.getByTestId('rf__node-trigger');
|
this.triggerNode = this.#page.getByTestId('rf__node-trigger');
|
||||||
this.background = page.locator('.react-flow__pane');
|
this.background = page.locator('.react-flow__pane');
|
||||||
this.useAsDraftButton = page.getByRole('button', { name: 'Use as draft' });
|
this.useAsDraftButton = page.getByRole('button', { name: 'Use as draft' });
|
||||||
@ -100,7 +100,7 @@ export class WorkflowVisualizerPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForWorkflowVisualizerLoad() {
|
async waitForWorkflowVisualizerLoad() {
|
||||||
await expect(this.workflowNameButton).toBeVisible();
|
await expect(this.workflowNameLabel).toBeVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
async goToWorkflowVisualizerPage() {
|
async goToWorkflowVisualizerPage() {
|
||||||
@ -132,8 +132,10 @@ export class WorkflowVisualizerPage {
|
|||||||
|
|
||||||
const actionToCreateOption = this.commandMenu.getByText(actionName);
|
const actionToCreateOption = this.commandMenu.getByText(actionName);
|
||||||
|
|
||||||
const [createWorkflowStepResponse] = await Promise.all([
|
await actionToCreateOption.click();
|
||||||
this.#page.waitForResponse((response) => {
|
|
||||||
|
const createWorkflowStepResponse = await this.#page.waitForResponse(
|
||||||
|
(response) => {
|
||||||
if (!response.url().endsWith('/graphql')) {
|
if (!response.url().endsWith('/graphql')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -141,19 +143,14 @@ export class WorkflowVisualizerPage {
|
|||||||
const requestBody = response.request().postDataJSON();
|
const requestBody = response.request().postDataJSON();
|
||||||
|
|
||||||
return requestBody.operationName === 'CreateWorkflowVersionStep';
|
return requestBody.operationName === 'CreateWorkflowVersionStep';
|
||||||
}),
|
},
|
||||||
|
);
|
||||||
|
|
||||||
actionToCreateOption.click(),
|
|
||||||
]);
|
|
||||||
const createWorkflowStepResponseBody =
|
const createWorkflowStepResponseBody =
|
||||||
await createWorkflowStepResponse.json();
|
await createWorkflowStepResponse.json();
|
||||||
const createdStepId =
|
const createdStepId =
|
||||||
createWorkflowStepResponseBody.data.createWorkflowVersionStep.id;
|
createWorkflowStepResponseBody.data.createWorkflowVersionStep.id;
|
||||||
|
|
||||||
await expect(
|
|
||||||
this.#page.getByTestId('command-menu').getByRole('textbox').first(),
|
|
||||||
).toHaveValue(createdActionName);
|
|
||||||
|
|
||||||
const createdActionNode = this.#page
|
const createdActionNode = this.#page
|
||||||
.locator('.react-flow__node.selected')
|
.locator('.react-flow__node.selected')
|
||||||
.getByText(createdActionName);
|
.getByText(createdActionName);
|
||||||
@ -231,6 +228,14 @@ export class WorkflowVisualizerPage {
|
|||||||
this.getDeleteNodeButton(this.triggerNode).click(),
|
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 }>(
|
export const test = base.extend<{ workflowVisualizer: WorkflowVisualizerPage }>(
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
import { expect, test } from '@playwright/test';
|
|
||||||
|
|
||||||
test.fixme(
|
|
||||||
'Check if demo account is working properly @demo-only',
|
|
||||||
async ({ page }) => {
|
|
||||||
await page.goto('https://app.twenty-next.com/');
|
|
||||||
await page.getByRole('button', { name: 'Continue with Email' }).click();
|
|
||||||
await page.getByRole('button', { name: 'Continue', exact: true }).click();
|
|
||||||
await page.getByRole('button', { name: 'Sign in' }).click();
|
|
||||||
await expect(page.getByText('Welcome to Twenty')).not.toBeVisible();
|
|
||||||
await page.waitForTimeout(5000);
|
|
||||||
await expect(page.getByText('Server’s on a coffee break')).not.toBeVisible({
|
|
||||||
timeout: 5000,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
@ -23,10 +23,13 @@ test('Create workflow', async ({ page }) => {
|
|||||||
return requestBody.operationName === 'CreateOneWorkflow';
|
return requestBody.operationName === 'CreateOneWorkflow';
|
||||||
}),
|
}),
|
||||||
|
|
||||||
await createWorkflowButton.click(),
|
createWorkflowButton.click(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const nameInput = page.getByRole('textbox');
|
const recordName = page.getByTestId('top-bar-title').getByTestId('tooltip');
|
||||||
|
await recordName.click();
|
||||||
|
|
||||||
|
const nameInput = page.getByTestId('top-bar-title').getByRole('textbox');
|
||||||
await nameInput.fill(NEW_WORKFLOW_NAME);
|
await nameInput.fill(NEW_WORKFLOW_NAME);
|
||||||
|
|
||||||
const workflowDiagramContainer = page.locator('.react-flow__renderer');
|
const workflowDiagramContainer = page.locator('.react-flow__renderer');
|
||||||
@ -36,7 +39,9 @@ test('Create workflow', async ({ page }) => {
|
|||||||
const newWorkflowId = body.data.createWorkflow.id;
|
const newWorkflowId = body.data.createWorkflow.id;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const workflowName = page.getByRole('button', { name: NEW_WORKFLOW_NAME });
|
const workflowName = page
|
||||||
|
.getByTestId('top-bar-title')
|
||||||
|
.getByText(NEW_WORKFLOW_NAME);
|
||||||
|
|
||||||
await expect(workflowName).toBeVisible();
|
await expect(workflowName).toBeVisible();
|
||||||
|
|
||||||
|
|||||||
@ -86,90 +86,92 @@ test('Use an old version as draft', async ({ workflowVisualizer, page }) => {
|
|||||||
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.fixme(
|
test('Use an old version as draft while having a pending draft version', async ({
|
||||||
'Use an old version as draft while having a pending draft version',
|
workflowVisualizer,
|
||||||
async ({ workflowVisualizer, page }) => {
|
page,
|
||||||
await workflowVisualizer.createInitialTrigger('record-created');
|
}) => {
|
||||||
|
await workflowVisualizer.createInitialTrigger('record-created');
|
||||||
|
|
||||||
await workflowVisualizer.createStep('create-record');
|
await workflowVisualizer.createStep('create-record');
|
||||||
|
|
||||||
await workflowVisualizer.background.click();
|
await workflowVisualizer.background.click();
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
expect(workflowVisualizer.workflowStatus).toHaveText('Active'),
|
expect(workflowVisualizer.workflowStatus).toHaveText('Active'),
|
||||||
|
|
||||||
workflowVisualizer.activateWorkflowButton.click(),
|
workflowVisualizer.activateWorkflowButton.click(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
expect(workflowVisualizer.workflowStatus).toHaveText('Draft'),
|
expect(workflowVisualizer.workflowStatus).toHaveText('Draft'),
|
||||||
|
|
||||||
workflowVisualizer.createStep('delete-record'),
|
workflowVisualizer.createStep('delete-record'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await expect(workflowVisualizer.triggerNode).toContainText(
|
await expect(workflowVisualizer.triggerNode).toContainText(
|
||||||
'Record is Created',
|
'Record is Created',
|
||||||
);
|
);
|
||||||
await expect(workflowVisualizer.getAllStepNodes()).toContainText([
|
await expect(workflowVisualizer.getAllStepNodes()).toContainText([
|
||||||
'Create Record',
|
'Create Record',
|
||||||
'Delete Record',
|
'Delete Record',
|
||||||
]);
|
]);
|
||||||
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(2);
|
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(2);
|
||||||
await expect(workflowVisualizer.useAsDraftButton).not.toBeVisible();
|
await expect(workflowVisualizer.useAsDraftButton).not.toBeVisible();
|
||||||
|
|
||||||
const workflowsLink = page.getByRole('link', { name: 'Workflows' });
|
await workflowVisualizer.closeSidePanel();
|
||||||
await workflowsLink.click();
|
|
||||||
|
|
||||||
const recordTableRowForWorkflow = page.getByRole('row', {
|
const workflowsLink = page.getByRole('link', { name: 'Workflows' });
|
||||||
name: workflowVisualizer.workflowName,
|
await workflowsLink.click();
|
||||||
});
|
|
||||||
|
|
||||||
const linkToWorkflow = recordTableRowForWorkflow.getByRole('link', {
|
const recordTableRowForWorkflow = page.getByRole('row', {
|
||||||
name: workflowVisualizer.workflowName,
|
name: workflowVisualizer.workflowName,
|
||||||
});
|
});
|
||||||
expect(linkToWorkflow).toBeVisible();
|
|
||||||
|
|
||||||
const linkToFirstWorkflowVersion = recordTableRowForWorkflow.getByRole(
|
const linkToWorkflow = recordTableRowForWorkflow.getByRole('link', {
|
||||||
'link',
|
name: workflowVisualizer.workflowName,
|
||||||
{
|
});
|
||||||
name: 'v1',
|
expect(linkToWorkflow).toBeVisible();
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
await linkToFirstWorkflowVersion.click();
|
const linkToFirstWorkflowVersion = recordTableRowForWorkflow.getByRole(
|
||||||
|
'link',
|
||||||
|
{
|
||||||
|
name: 'v1',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await expect(workflowVisualizer.workflowStatus).toHaveText('Active');
|
await linkToFirstWorkflowVersion.click();
|
||||||
await expect(workflowVisualizer.useAsDraftButton).toBeVisible();
|
|
||||||
await expect(workflowVisualizer.triggerNode).toContainText(
|
|
||||||
'Record is Created',
|
|
||||||
);
|
|
||||||
await expect(workflowVisualizer.getAllStepNodes()).toContainText([
|
|
||||||
'Create Record',
|
|
||||||
]);
|
|
||||||
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
|
||||||
|
|
||||||
await Promise.all([
|
await expect(workflowVisualizer.workflowStatus).toHaveText('Active');
|
||||||
expect(workflowVisualizer.overrideDraftButton).toBeVisible(),
|
await expect(workflowVisualizer.useAsDraftButton).toBeVisible();
|
||||||
|
await expect(workflowVisualizer.triggerNode).toContainText(
|
||||||
|
'Record is Created',
|
||||||
|
);
|
||||||
|
await expect(workflowVisualizer.getAllStepNodes()).toContainText([
|
||||||
|
'Create Record',
|
||||||
|
]);
|
||||||
|
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
||||||
|
|
||||||
workflowVisualizer.useAsDraftButton.click(),
|
await Promise.all([
|
||||||
]);
|
expect(workflowVisualizer.overrideDraftButton).toBeVisible(),
|
||||||
|
|
||||||
await Promise.all([
|
workflowVisualizer.useAsDraftButton.click(),
|
||||||
page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`),
|
]);
|
||||||
|
|
||||||
workflowVisualizer.overrideDraftButton.click(),
|
await Promise.all([
|
||||||
]);
|
page.waitForURL(`/object/workflow/${workflowVisualizer.workflowId}`),
|
||||||
|
|
||||||
await expect(workflowVisualizer.workflowStatus).toHaveText('Draft');
|
workflowVisualizer.overrideDraftButton.click(),
|
||||||
await expect(workflowVisualizer.useAsDraftButton).not.toBeVisible();
|
]);
|
||||||
await expect(workflowVisualizer.triggerNode).toContainText(
|
|
||||||
'Record is Created',
|
await expect(workflowVisualizer.workflowStatus).toHaveText('Draft');
|
||||||
);
|
await expect(workflowVisualizer.useAsDraftButton).not.toBeVisible();
|
||||||
await expect(workflowVisualizer.getAllStepNodes()).toContainText([
|
await expect(workflowVisualizer.triggerNode).toContainText(
|
||||||
'Create Record',
|
'Record is Created',
|
||||||
]);
|
);
|
||||||
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
await expect(workflowVisualizer.getAllStepNodes()).toContainText([
|
||||||
await expect(workflowVisualizer.activateWorkflowButton).toBeVisible();
|
'Create Record',
|
||||||
await expect(workflowVisualizer.discardDraftButton).toBeVisible();
|
]);
|
||||||
},
|
await expect(workflowVisualizer.getAllStepNodes()).toHaveCount(1);
|
||||||
);
|
await expect(workflowVisualizer.activateWorkflowButton).toBeVisible();
|
||||||
|
await expect(workflowVisualizer.discardDraftButton).toBeVisible();
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user