test: trigger only flow should not be publishable
This commit is contained in:
11
packages/e2e-tests/fixtures/bullmq-helper.js
Normal file
11
packages/e2e-tests/fixtures/bullmq-helper.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const { expect } = require('../fixtures/index');
|
||||
|
||||
export const expectNoDelayedJobForFlow = async (flowId, request) => {
|
||||
const token = btoa(`${process.env.BULLMQ_DASHBOARD_USERNAME}:${process.env.BULLMQ_DASHBOARD_PASSWORD}`);
|
||||
const queues = await request.get(`${process.env.BACKEND_APP_URL}/admin/queues/api/queues?activeQueue=flow&status=delayed&page=1`, {
|
||||
headers: {'Authorization': `Basic ${token}`}
|
||||
});
|
||||
const queuesJsonResponse = await queues.json();
|
||||
const flowQueue = queuesJsonResponse.queues.find(queue => queue.name === "flow");
|
||||
await expect(flowQueue.jobs.find(job => job.name === `flow-${flowId}`)).toBeUndefined();
|
||||
};
|
@@ -24,6 +24,7 @@ export class FlowEditorPage extends AuthenticatedPage {
|
||||
this.unpublishFlowButton = this.page.getByTestId('unpublish-flow-button');
|
||||
this.publishFlowButton = this.page.getByTestId('publish-flow-button');
|
||||
this.infoSnackbar = this.page.getByTestId('flow-cannot-edit-info-snackbar');
|
||||
this.errorSnackbar = this.page.getByTestId('snackbar-error');
|
||||
this.trigger = this.page.getByLabel('Trigger on weekends?');
|
||||
this.stepCircularLoader = this.page.getByTestId('step-circular-loader');
|
||||
this.flowName = this.page.getByTestId('editableTypography');
|
||||
@@ -32,16 +33,12 @@ export class FlowEditorPage extends AuthenticatedPage {
|
||||
.locator('input');
|
||||
|
||||
this.flowStep = this.page.getByTestId('flow-step');
|
||||
this.rssFeedUrl = this.page.getByTestId('parameters.feedUrl-text');
|
||||
}
|
||||
|
||||
async createWebhookTrigger(workSynchronously) {
|
||||
await this.appAutocomplete.click();
|
||||
await this.page.getByRole('option', { name: 'Webhook' }).click();
|
||||
this.chooseAppAndTrigger('Webhook', 'Catch raw webhook');
|
||||
|
||||
await expect(this.eventAutocomplete).toBeVisible();
|
||||
await this.eventAutocomplete.click();
|
||||
await this.page.getByRole('option', { name: 'Catch raw webhook' }).click();
|
||||
await this.continueButton.click();
|
||||
await this.page
|
||||
.getByTestId('parameters.workSynchronously-autocomplete')
|
||||
.click();
|
||||
@@ -69,6 +66,19 @@ export class FlowEditorPage extends AuthenticatedPage {
|
||||
return await webhookUrl.inputValue();
|
||||
}
|
||||
|
||||
async chooseAppAndTrigger(appName, triggerEvent) {
|
||||
await expect(this.appAutocomplete).toHaveCount(1);
|
||||
await this.appAutocomplete.click();
|
||||
await this.page.getByRole('option', { name: appName }).click();
|
||||
await expect(this.eventAutocomplete).toBeVisible();
|
||||
await this.eventAutocomplete.click();
|
||||
await Promise.all([
|
||||
this.page.waitForResponse(resp => /(apps\/.*\/triggers\/.*\/substeps)/.test(resp.url()) && resp.status() === 200),
|
||||
this.page.getByRole('option', { name: triggerEvent }).click(),
|
||||
]);
|
||||
await this.continueButton.click();
|
||||
}
|
||||
|
||||
async chooseAppAndEvent(appName, eventName) {
|
||||
await expect(this.appAutocomplete).toHaveCount(1);
|
||||
await this.appAutocomplete.click();
|
||||
@@ -88,4 +98,10 @@ export class FlowEditorPage extends AuthenticatedPage {
|
||||
await expect(this.testOutput).toBeVisible();
|
||||
await this.continueButton.click();
|
||||
}
|
||||
|
||||
async dismissErrorSnackbar() {
|
||||
await expect(this.errorSnackbar).toBeVisible();
|
||||
await this.errorSnackbar.click();
|
||||
await expect(this.errorSnackbar).toHaveCount(0);
|
||||
}
|
||||
}
|
||||
|
18
packages/e2e-tests/fixtures/postgres/postgres-helper.js
Normal file
18
packages/e2e-tests/fixtures/postgres/postgres-helper.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const { pgPool } = require('./postgres-config');
|
||||
const { expect } = require('../../fixtures/index');
|
||||
|
||||
export const flowShouldNotHavePublishedAtDateFilled = async (flowId) => {
|
||||
const queryFlow = {
|
||||
text: 'SELECT * FROM flows WHERE id = $1',
|
||||
values: [flowId]
|
||||
};
|
||||
|
||||
try {
|
||||
const queryFlowResult = await pgPool.query(queryFlow);
|
||||
expect(queryFlowResult.rowCount).toEqual(1);
|
||||
expect(queryFlowResult.rows[0].published_at).toBeNull();
|
||||
} catch (err) {
|
||||
console.error(err.message);
|
||||
throw err;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user