test: add tests for executions
This commit is contained in:
@@ -1,37 +1,138 @@
|
||||
const { request } = require('@playwright/test');
|
||||
const { test, expect } = require('../../fixtures/index');
|
||||
const {
|
||||
triggerFlow,
|
||||
publishFlow,
|
||||
addWebhookFlow,
|
||||
} = require('../../helpers/flow-api-helper');
|
||||
const {
|
||||
ExecutionStepDetails,
|
||||
} = require('../../fixtures/execution-step-details');
|
||||
const { getToken } = require('../../helpers/auth-api-helper');
|
||||
|
||||
test.describe('Executions page', () => {
|
||||
let flowId;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
const apiRequest = await request.newContext();
|
||||
const tokenJsonResponse = await getToken(apiRequest);
|
||||
|
||||
flowId = await addWebhookFlow(apiRequest, tokenJsonResponse.data.token);
|
||||
|
||||
const { data } = await publishFlow(
|
||||
apiRequest,
|
||||
tokenJsonResponse.data.token,
|
||||
flowId
|
||||
);
|
||||
|
||||
const triggerStepWebhookUrl = data.steps.find(
|
||||
(step) => step.type === 'trigger'
|
||||
).webhookUrl;
|
||||
|
||||
await triggerFlow(apiRequest, triggerStepWebhookUrl);
|
||||
});
|
||||
|
||||
// no execution data exists in an empty account
|
||||
test.describe.skip('Executions page', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.getByTestId('executions-page-drawer-link').click();
|
||||
await page.getByTestId('execution-row').first().click();
|
||||
|
||||
await expect(page).toHaveURL(/\/executions\//);
|
||||
});
|
||||
|
||||
test('displays data in by default', async ({ page, executionsPage }) => {
|
||||
await expect(page.getByTestId('execution-step').last()).toBeVisible();
|
||||
await expect(page.getByTestId('execution-step')).toHaveCount(2);
|
||||
test('show correct step data for trigger and actions on test and non-test execution', async ({
|
||||
page,
|
||||
executionsPage,
|
||||
executionDetailsPage,
|
||||
}) => {
|
||||
await executionsPage.executionsPageLoader.waitFor({
|
||||
state: 'detached',
|
||||
});
|
||||
const flowExecutions = await executionsPage.executionRow.filter({
|
||||
hasText: flowId,
|
||||
});
|
||||
await test.step('show only trigger step on test execution', async () => {
|
||||
await expect(flowExecutions.last()).toContainText('Test run');
|
||||
await flowExecutions.last().click();
|
||||
|
||||
await executionsPage.screenshot({
|
||||
path: 'Execution - data in.png',
|
||||
await executionDetailsPage.verifyExecutionData(flowId);
|
||||
await expect(executionDetailsPage.executionStep).toHaveCount(1);
|
||||
|
||||
const executionStepDetails = new ExecutionStepDetails(
|
||||
page,
|
||||
executionDetailsPage.executionStep.last()
|
||||
);
|
||||
await executionStepDetails.verifyTriggerExecutionStep({
|
||||
stepPositionAndName: '1. Webhook',
|
||||
stepDataInKey: 'workSynchronously',
|
||||
stepDataInValue: 'workSynchronously',
|
||||
stepDataOutKey: 'host',
|
||||
stepDataOutValue: 'localhost',
|
||||
});
|
||||
|
||||
await page.goBack();
|
||||
});
|
||||
|
||||
await test.step('show trigger and action step on action test execution', async () => {
|
||||
await expect(flowExecutions.nth(1)).toContainText('Test run');
|
||||
await flowExecutions.nth(1).click();
|
||||
|
||||
await expect(executionDetailsPage.executionStep).toHaveCount(2);
|
||||
await executionDetailsPage.verifyExecutionData(flowId);
|
||||
|
||||
const firstExecutionStepDetails = new ExecutionStepDetails(
|
||||
page,
|
||||
executionDetailsPage.executionStep.first()
|
||||
);
|
||||
await firstExecutionStepDetails.verifyTriggerExecutionStep({
|
||||
stepPositionAndName: '1. Webhook',
|
||||
stepDataInKey: 'workSynchronously',
|
||||
stepDataInValue: 'workSynchronously',
|
||||
stepDataOutKey: 'host',
|
||||
stepDataOutValue: 'localhost',
|
||||
});
|
||||
|
||||
const lastExecutionStepDetails = new ExecutionStepDetails(
|
||||
page,
|
||||
executionDetailsPage.executionStep.last()
|
||||
);
|
||||
await lastExecutionStepDetails.verifyActionExecutionStep({
|
||||
stepPositionAndName: '2. Webhook',
|
||||
stepDataInKey: 'body',
|
||||
stepDataInValue: 'body:"ok"',
|
||||
stepDataOutKey: 'body',
|
||||
stepDataOutValue: 'body:"ok"',
|
||||
});
|
||||
|
||||
await page.goBack();
|
||||
});
|
||||
|
||||
await test.step('show trigger and action step on flow execution', async () => {
|
||||
await expect(flowExecutions.first()).not.toContainText('Test run');
|
||||
await flowExecutions.first().click();
|
||||
|
||||
await expect(executionDetailsPage.executionStep).toHaveCount(2);
|
||||
await executionDetailsPage.verifyExecutionData(flowId);
|
||||
|
||||
const firstExecutionStepDetails = new ExecutionStepDetails(
|
||||
page,
|
||||
executionDetailsPage.executionStep.first()
|
||||
);
|
||||
await firstExecutionStepDetails.verifyTriggerExecutionStep({
|
||||
stepPositionAndName: '1. Webhook',
|
||||
stepDataInKey: 'workSynchronously',
|
||||
stepDataInValue: 'workSynchronously',
|
||||
stepDataOutKey: 'host',
|
||||
stepDataOutValue: 'localhost',
|
||||
});
|
||||
|
||||
const lastExecutionStepDetails = new ExecutionStepDetails(
|
||||
page,
|
||||
executionDetailsPage.executionStep.last()
|
||||
);
|
||||
await lastExecutionStepDetails.verifyActionExecutionStep({
|
||||
stepPositionAndName: '2. Webhook',
|
||||
stepDataInKey: 'body',
|
||||
stepDataInValue: 'body:"ok"',
|
||||
stepDataOutKey: 'body',
|
||||
stepDataOutValue: 'body:"ok"',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('displays data out', async ({ page, executionsPage }) => {
|
||||
const executionStepCount = await page.getByTestId('execution-step').count();
|
||||
for (let i = 0; i < executionStepCount; i++) {
|
||||
await page.getByTestId('data-out-tab').nth(i).click();
|
||||
await expect(page.getByTestId('data-out-panel').nth(i)).toBeVisible();
|
||||
|
||||
await executionsPage.screenshot({
|
||||
path: `Execution - data out - ${i}.png`,
|
||||
animations: 'disabled',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test('does not display error', async ({ page }) => {
|
||||
await expect(page.getByTestId('error-tab')).toBeHidden();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user