test: add tests for executions

This commit is contained in:
Jakub P.
2024-12-10 21:03:23 +01:00
parent feba2a32f9
commit 0012c9fb59
12 changed files with 443 additions and 45 deletions

View File

@@ -1,17 +1,54 @@
const { request } = require('@playwright/test');
const { test, expect } = require('../../fixtures/index');
const {
triggerFlow,
publishFlow,
addWebhookFlow,
} = require('../../helpers/flow-api-helper');
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);
});
test.beforeEach(async ({ page }) => {
await page.getByTestId('executions-page-drawer-link').click();
});
// no executions exist in an empty account
test.skip('displays executions', async ({ page, executionsPage }) => {
await page.getByTestId('executions-loader').waitFor({
test('should be able to see normal and test executions', async ({
executionsPage,
}) => {
await executionsPage.executionsPageLoader.waitFor({
state: 'detached',
});
await expect(page.getByTestId('execution-row').first()).toBeVisible();
const flowExecutions = await executionsPage.executionRow.filter({
hasText: flowId,
});
await executionsPage.screenshot({ path: 'Executions.png' });
await expect(flowExecutions).toHaveCount(4);
await expect(flowExecutions.first()).toContainText('Success');
await expect(flowExecutions.first()).not.toContainText('Test run');
for (let testFlow = 1; testFlow < 4; testFlow++) {
await expect(flowExecutions.nth(testFlow)).toContainText('Test run');
await expect(flowExecutions.nth(testFlow)).toContainText('Success');
}
});
});