Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0012c9fb59 |
@@ -1,52 +0,0 @@
|
|||||||
name: release-tag
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'main'
|
|
||||||
jobs:
|
|
||||||
release-image:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
DOCKER_ORG: groot
|
|
||||||
DOCKER_LATEST: latest
|
|
||||||
RUNNER_TOOL_CACHE: /toolcache
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
- name: Set up Docker BuildX
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with: # replace it with your local IP
|
|
||||||
config-inline: |
|
|
||||||
[registry."git.send.nrw"]
|
|
||||||
http = true
|
|
||||||
insecure = true
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: git.send.nrw # replace it with your local IP
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Get Meta
|
|
||||||
id: meta
|
|
||||||
run: |
|
|
||||||
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
|
||||||
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: ./docker
|
|
||||||
file: ./docker/Dockerfile.compose
|
|
||||||
entrypoint: ./docker/compose-entrypoint.sh
|
|
||||||
platforms: |
|
|
||||||
linux/amd64
|
|
||||||
push: true
|
|
||||||
tags: | # replace it with your local IP and tags
|
|
||||||
git.send.nrw/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
|
|
||||||
git.send.nrw/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
|
|
1
.github/workflows/playwright.yml
vendored
1
.github/workflows/playwright.yml
vendored
@@ -114,6 +114,7 @@ jobs:
|
|||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
working-directory: ./packages/e2e-tests
|
working-directory: ./packages/e2e-tests
|
||||||
env:
|
env:
|
||||||
|
PORT: 3000
|
||||||
LOGIN_EMAIL: user@automatisch.io
|
LOGIN_EMAIL: user@automatisch.io
|
||||||
LOGIN_PASSWORD: sample
|
LOGIN_PASSWORD: sample
|
||||||
BASE_URL: http://localhost:3000
|
BASE_URL: http://localhost:3000
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
version: '3.9'
|
version: '3.9'
|
||||||
services:
|
services:
|
||||||
main:
|
main:
|
||||||
image: git.send.nrw/groot/automatisch:latest
|
build:
|
||||||
|
context: ./docker
|
||||||
|
dockerfile: Dockerfile.compose
|
||||||
|
entrypoint: /compose-entrypoint.sh
|
||||||
ports:
|
ports:
|
||||||
- '3000:3000'
|
- '3000:3000'
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -25,7 +28,10 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- automatisch_storage:/automatisch/storage
|
- automatisch_storage:/automatisch/storage
|
||||||
worker:
|
worker:
|
||||||
image: git.send.nrw/groot/automatisch:latest
|
build:
|
||||||
|
context: ./docker
|
||||||
|
dockerfile: Dockerfile.compose
|
||||||
|
entrypoint: /compose-entrypoint.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- main
|
- main
|
||||||
environment:
|
environment:
|
||||||
|
@@ -87,14 +87,14 @@ describe('GET /api/v1/apps/:appKey/connections', () => {
|
|||||||
|
|
||||||
it('should return not found response for invalid connection UUID', async () => {
|
it('should return not found response for invalid connection UUID', async () => {
|
||||||
await createPermission({
|
await createPermission({
|
||||||
action: 'read',
|
action: 'update',
|
||||||
subject: 'Connection',
|
subject: 'Connection',
|
||||||
roleId: currentUserRole.id,
|
roleId: currentUserRole.id,
|
||||||
conditions: ['isCreator'],
|
conditions: ['isCreator'],
|
||||||
});
|
});
|
||||||
|
|
||||||
await request(app)
|
await request(app)
|
||||||
.get('/api/v1/apps/invalid-connection-id/connections')
|
.get('/api/v1/connections/invalid-connection-id/connections')
|
||||||
.set('Authorization', token)
|
.set('Authorization', token)
|
||||||
.expect(404);
|
.expect(404);
|
||||||
});
|
});
|
||||||
|
@@ -193,7 +193,7 @@ describe('POST /api/v1/steps/:stepId/dynamic-data', () => {
|
|||||||
const notExistingStepUUID = Crypto.randomUUID();
|
const notExistingStepUUID = Crypto.randomUUID();
|
||||||
|
|
||||||
await request(app)
|
await request(app)
|
||||||
.post(`/api/v1/steps/${notExistingStepUUID}/dynamic-data`)
|
.get(`/api/v1/steps/${notExistingStepUUID}/dynamic-data`)
|
||||||
.set('Authorization', token)
|
.set('Authorization', token)
|
||||||
.expect(404);
|
.expect(404);
|
||||||
});
|
});
|
||||||
@@ -216,7 +216,7 @@ describe('POST /api/v1/steps/:stepId/dynamic-data', () => {
|
|||||||
const step = await createStep({ appKey: null });
|
const step = await createStep({ appKey: null });
|
||||||
|
|
||||||
await request(app)
|
await request(app)
|
||||||
.post(`/api/v1/steps/${step.id}/dynamic-data`)
|
.get(`/api/v1/steps/${step.id}/dynamic-data`)
|
||||||
.set('Authorization', token)
|
.set('Authorization', token)
|
||||||
.expect(404);
|
.expect(404);
|
||||||
});
|
});
|
||||||
|
@@ -118,7 +118,7 @@ describe('POST /api/v1/steps/:stepId/dynamic-fields', () => {
|
|||||||
const notExistingStepUUID = Crypto.randomUUID();
|
const notExistingStepUUID = Crypto.randomUUID();
|
||||||
|
|
||||||
await request(app)
|
await request(app)
|
||||||
.post(`/api/v1/steps/${notExistingStepUUID}/dynamic-fields`)
|
.get(`/api/v1/steps/${notExistingStepUUID}/dynamic-fields`)
|
||||||
.set('Authorization', token)
|
.set('Authorization', token)
|
||||||
.expect(404);
|
.expect(404);
|
||||||
});
|
});
|
||||||
@@ -138,11 +138,10 @@ describe('POST /api/v1/steps/:stepId/dynamic-fields', () => {
|
|||||||
conditions: [],
|
conditions: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const step = await createStep();
|
const step = await createStep({ appKey: null });
|
||||||
await step.$query().patch({ appKey: null });
|
|
||||||
|
|
||||||
await request(app)
|
await request(app)
|
||||||
.post(`/api/v1/steps/${step.id}/dynamic-fields`)
|
.get(`/api/v1/steps/${step.id}/dynamic-fields`)
|
||||||
.set('Authorization', token)
|
.set('Authorization', token)
|
||||||
.expect(404);
|
.expect(404);
|
||||||
});
|
});
|
||||||
|
@@ -996,9 +996,21 @@ describe('User model', () => {
|
|||||||
|
|
||||||
const user = await createUser();
|
const user = await createUser();
|
||||||
|
|
||||||
|
const presentDate = DateTime.fromObject(
|
||||||
|
{ year: 2024, month: 11, day: 17, hour: 11, minute: 30 },
|
||||||
|
{ zone: 'UTC+0' }
|
||||||
|
);
|
||||||
|
|
||||||
|
vi.setSystemTime(presentDate);
|
||||||
|
|
||||||
await user.startTrialPeriod();
|
await user.startTrialPeriod();
|
||||||
|
|
||||||
vi.setSystemTime(DateTime.now().plus({ month: 1 }));
|
const futureDate = DateTime.fromObject(
|
||||||
|
{ year: 2025, month: 1, day: 1 },
|
||||||
|
{ zone: 'UTC+0' }
|
||||||
|
);
|
||||||
|
|
||||||
|
vi.setSystemTime(futureDate);
|
||||||
|
|
||||||
const refetchedUser = await user.$query();
|
const refetchedUser = await user.$query();
|
||||||
|
|
||||||
@@ -1106,9 +1118,7 @@ describe('User model', () => {
|
|||||||
|
|
||||||
const user = await createUser();
|
const user = await createUser();
|
||||||
|
|
||||||
await expect(() => user.getPlanAndUsage()).rejects.toThrow(
|
expect(() => user.getPlanAndUsage()).rejects.toThrow('NotFoundError');
|
||||||
'NotFoundError'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1179,7 +1189,7 @@ describe('User model', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw not found error when user role does not exist', async () => {
|
it('should throw not found error when user role does not exist', async () => {
|
||||||
await expect(() =>
|
expect(() =>
|
||||||
User.registerUser({
|
User.registerUser({
|
||||||
fullName: 'Sample user',
|
fullName: 'Sample user',
|
||||||
email: 'user@automatisch.io',
|
email: 'user@automatisch.io',
|
||||||
@@ -1247,8 +1257,6 @@ describe('User model', () => {
|
|||||||
|
|
||||||
describe('createUsageData', () => {
|
describe('createUsageData', () => {
|
||||||
it('should create usage data if Automatisch is a cloud installation', async () => {
|
it('should create usage data if Automatisch is a cloud installation', async () => {
|
||||||
vi.useFakeTimers();
|
|
||||||
|
|
||||||
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true);
|
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true);
|
||||||
|
|
||||||
const user = await createUser({
|
const user = await createUser({
|
||||||
@@ -1256,14 +1264,10 @@ describe('User model', () => {
|
|||||||
email: 'user@automatisch.io',
|
email: 'user@automatisch.io',
|
||||||
});
|
});
|
||||||
|
|
||||||
vi.setSystemTime(DateTime.now().plus({ month: 1 }));
|
|
||||||
|
|
||||||
const usageData = await user.createUsageData();
|
const usageData = await user.createUsageData();
|
||||||
const currentUsageData = await user.$relatedQuery('currentUsageData');
|
const currentUsageData = await user.$relatedQuery('currentUsageData');
|
||||||
|
|
||||||
expect(usageData).toStrictEqual(currentUsageData);
|
expect(usageData).toStrictEqual(currentUsageData);
|
||||||
|
|
||||||
vi.useRealTimers();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not create usage data if Automatisch is not a cloud installation', async () => {
|
it('should not create usage data if Automatisch is not a cloud installation', async () => {
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
import { generateQueue } from './queue.js';
|
import process from 'process';
|
||||||
|
import { Queue } from 'bullmq';
|
||||||
|
import redisConfig from '../config/redis.js';
|
||||||
|
import logger from '../helpers/logger.js';
|
||||||
|
|
||||||
|
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
||||||
|
|
||||||
|
const redisConnection = {
|
||||||
|
connection: redisConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
const actionQueue = new Queue('action', redisConnection);
|
||||||
|
|
||||||
|
process.on('SIGTERM', async () => {
|
||||||
|
await actionQueue.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
actionQueue.on('error', (error) => {
|
||||||
|
if (error.code === CONNECTION_REFUSED) {
|
||||||
|
logger.error(
|
||||||
|
'Make sure you have installed Redis and it is running.',
|
||||||
|
error
|
||||||
|
);
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.error('Error happened in action queue!', error);
|
||||||
|
});
|
||||||
|
|
||||||
const actionQueue = generateQueue('action');
|
|
||||||
export default actionQueue;
|
export default actionQueue;
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
import { generateQueue } from './queue.js';
|
import process from 'process';
|
||||||
|
import { Queue } from 'bullmq';
|
||||||
|
import redisConfig from '../config/redis.js';
|
||||||
|
import logger from '../helpers/logger.js';
|
||||||
|
|
||||||
|
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
||||||
|
|
||||||
|
const redisConnection = {
|
||||||
|
connection: redisConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteUserQueue = new Queue('delete-user', redisConnection);
|
||||||
|
|
||||||
|
process.on('SIGTERM', async () => {
|
||||||
|
await deleteUserQueue.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteUserQueue.on('error', (error) => {
|
||||||
|
if (error.code === CONNECTION_REFUSED) {
|
||||||
|
logger.error(
|
||||||
|
'Make sure you have installed Redis and it is running.',
|
||||||
|
error
|
||||||
|
);
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.error('Error happened in delete user queue!', error);
|
||||||
|
});
|
||||||
|
|
||||||
const deleteUserQueue = generateQueue('delete-user');
|
|
||||||
export default deleteUserQueue;
|
export default deleteUserQueue;
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
import { generateQueue } from './queue.js';
|
import process from 'process';
|
||||||
|
import { Queue } from 'bullmq';
|
||||||
|
import redisConfig from '../config/redis.js';
|
||||||
|
import logger from '../helpers/logger.js';
|
||||||
|
|
||||||
|
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
||||||
|
|
||||||
|
const redisConnection = {
|
||||||
|
connection: redisConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
const emailQueue = new Queue('email', redisConnection);
|
||||||
|
|
||||||
|
process.on('SIGTERM', async () => {
|
||||||
|
await emailQueue.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
emailQueue.on('error', (error) => {
|
||||||
|
if (error.code === CONNECTION_REFUSED) {
|
||||||
|
logger.error(
|
||||||
|
'Make sure you have installed Redis and it is running.',
|
||||||
|
error
|
||||||
|
);
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.error('Error happened in email queue!', error);
|
||||||
|
});
|
||||||
|
|
||||||
const emailQueue = generateQueue('email');
|
|
||||||
export default emailQueue;
|
export default emailQueue;
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
import { generateQueue } from './queue.js';
|
import process from 'process';
|
||||||
|
import { Queue } from 'bullmq';
|
||||||
|
import redisConfig from '../config/redis.js';
|
||||||
|
import logger from '../helpers/logger.js';
|
||||||
|
|
||||||
|
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
||||||
|
|
||||||
|
const redisConnection = {
|
||||||
|
connection: redisConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
const flowQueue = new Queue('flow', redisConnection);
|
||||||
|
|
||||||
|
process.on('SIGTERM', async () => {
|
||||||
|
await flowQueue.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
flowQueue.on('error', (error) => {
|
||||||
|
if (error.code === CONNECTION_REFUSED) {
|
||||||
|
logger.error(
|
||||||
|
'Make sure you have installed Redis and it is running.',
|
||||||
|
error
|
||||||
|
);
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.error('Error happened in flow queue!', error);
|
||||||
|
});
|
||||||
|
|
||||||
const flowQueue = generateQueue('flow');
|
|
||||||
export default flowQueue;
|
export default flowQueue;
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
import appConfig from '../config/app.js';
|
|
||||||
import actionQueue from './action.js';
|
|
||||||
import emailQueue from './email.js';
|
|
||||||
import flowQueue from './flow.js';
|
|
||||||
import triggerQueue from './trigger.js';
|
|
||||||
import deleteUserQueue from './delete-user.ee.js';
|
|
||||||
import removeCancelledSubscriptionsQueue from './remove-cancelled-subscriptions.ee.js';
|
|
||||||
|
|
||||||
const queues = [
|
|
||||||
actionQueue,
|
|
||||||
emailQueue,
|
|
||||||
flowQueue,
|
|
||||||
triggerQueue,
|
|
||||||
deleteUserQueue,
|
|
||||||
];
|
|
||||||
|
|
||||||
if (appConfig.isCloud) {
|
|
||||||
queues.push(removeCancelledSubscriptionsQueue);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default queues;
|
|
@@ -1,44 +0,0 @@
|
|||||||
import process from 'process';
|
|
||||||
import { Queue } from 'bullmq';
|
|
||||||
import redisConfig from '../config/redis.js';
|
|
||||||
import logger from '../helpers/logger.js';
|
|
||||||
|
|
||||||
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
|
||||||
|
|
||||||
const redisConnection = {
|
|
||||||
connection: redisConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const generateQueue = (queueName, options) => {
|
|
||||||
const queue = new Queue(queueName, redisConnection);
|
|
||||||
|
|
||||||
queue.on('error', (error) => queueOnError(error, queueName));
|
|
||||||
|
|
||||||
if (options?.runDaily) addScheduler(queueName, queue);
|
|
||||||
|
|
||||||
return queue;
|
|
||||||
};
|
|
||||||
|
|
||||||
const queueOnError = (error, queueName) => {
|
|
||||||
if (error.code === CONNECTION_REFUSED) {
|
|
||||||
const errorMessage =
|
|
||||||
'Make sure you have installed Redis and it is running.';
|
|
||||||
|
|
||||||
logger.error(errorMessage, error);
|
|
||||||
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error(`Error happened in ${queueName} queue!`, error);
|
|
||||||
};
|
|
||||||
|
|
||||||
const addScheduler = (queueName, queue) => {
|
|
||||||
const everydayAtOneOclock = '0 1 * * *';
|
|
||||||
|
|
||||||
queue.add(queueName, null, {
|
|
||||||
jobId: queueName,
|
|
||||||
repeat: {
|
|
||||||
pattern: everydayAtOneOclock,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
@@ -1,8 +1,44 @@
|
|||||||
import { generateQueue } from './queue.js';
|
import process from 'process';
|
||||||
|
import { Queue } from 'bullmq';
|
||||||
|
import redisConfig from '../config/redis.js';
|
||||||
|
import logger from '../helpers/logger.js';
|
||||||
|
|
||||||
const removeCancelledSubscriptionsQueue = generateQueue(
|
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
||||||
|
|
||||||
|
const redisConnection = {
|
||||||
|
connection: redisConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeCancelledSubscriptionsQueue = new Queue(
|
||||||
'remove-cancelled-subscriptions',
|
'remove-cancelled-subscriptions',
|
||||||
{ runDaily: true }
|
redisConnection
|
||||||
);
|
);
|
||||||
|
|
||||||
|
process.on('SIGTERM', async () => {
|
||||||
|
await removeCancelledSubscriptionsQueue.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
removeCancelledSubscriptionsQueue.on('error', (error) => {
|
||||||
|
if (error.code === CONNECTION_REFUSED) {
|
||||||
|
logger.error(
|
||||||
|
'Make sure you have installed Redis and it is running.',
|
||||||
|
error
|
||||||
|
);
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.error(
|
||||||
|
'Error happened in remove cancelled subscriptions queue!',
|
||||||
|
error
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
removeCancelledSubscriptionsQueue.add('remove-cancelled-subscriptions', null, {
|
||||||
|
jobId: 'remove-cancelled-subscriptions',
|
||||||
|
repeat: {
|
||||||
|
pattern: '0 1 * * *',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export default removeCancelledSubscriptionsQueue;
|
export default removeCancelledSubscriptionsQueue;
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
import { generateQueue } from './queue.js';
|
import process from 'process';
|
||||||
|
import { Queue } from 'bullmq';
|
||||||
|
import redisConfig from '../config/redis.js';
|
||||||
|
import logger from '../helpers/logger.js';
|
||||||
|
|
||||||
|
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
||||||
|
|
||||||
|
const redisConnection = {
|
||||||
|
connection: redisConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
const triggerQueue = new Queue('trigger', redisConnection);
|
||||||
|
|
||||||
|
process.on('SIGTERM', async () => {
|
||||||
|
await triggerQueue.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
triggerQueue.on('error', (error) => {
|
||||||
|
if (error.code === CONNECTION_REFUSED) {
|
||||||
|
logger.error(
|
||||||
|
'Make sure you have installed Redis and it is running.',
|
||||||
|
error
|
||||||
|
);
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.error('Error happened in trigger queue!', error);
|
||||||
|
});
|
||||||
|
|
||||||
const triggerQueue = generateQueue('trigger');
|
|
||||||
export default triggerQueue;
|
export default triggerQueue;
|
||||||
|
@@ -1,22 +1,20 @@
|
|||||||
import * as Sentry from './helpers/sentry.ee.js';
|
import * as Sentry from './helpers/sentry.ee.js';
|
||||||
import process from 'node:process';
|
import appConfig from './config/app.js';
|
||||||
|
|
||||||
Sentry.init();
|
Sentry.init();
|
||||||
|
|
||||||
import './config/orm.js';
|
import './config/orm.js';
|
||||||
import './helpers/check-worker-readiness.js';
|
import './helpers/check-worker-readiness.js';
|
||||||
import queues from './queues/index.js';
|
import './workers/flow.js';
|
||||||
import workers from './workers/index.js';
|
import './workers/trigger.js';
|
||||||
|
import './workers/action.js';
|
||||||
|
import './workers/email.js';
|
||||||
|
import './workers/delete-user.ee.js';
|
||||||
|
|
||||||
process.on('SIGTERM', async () => {
|
if (appConfig.isCloud) {
|
||||||
for (const queue of queues) {
|
import('./workers/remove-cancelled-subscriptions.ee.js');
|
||||||
await queue.close();
|
import('./queues/remove-cancelled-subscriptions.ee.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const worker of workers) {
|
|
||||||
await worker.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
import telemetry from './helpers/telemetry/index.js';
|
import telemetry from './helpers/telemetry/index.js';
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { Worker } from 'bullmq';
|
import { Worker } from 'bullmq';
|
||||||
|
import process from 'node:process';
|
||||||
|
|
||||||
import * as Sentry from '../helpers/sentry.ee.js';
|
import * as Sentry from '../helpers/sentry.ee.js';
|
||||||
import redisConfig from '../config/redis.js';
|
import redisConfig from '../config/redis.js';
|
||||||
@@ -14,7 +15,7 @@ import delayAsMilliseconds from '../helpers/delay-as-milliseconds.js';
|
|||||||
|
|
||||||
const DEFAULT_DELAY_DURATION = 0;
|
const DEFAULT_DELAY_DURATION = 0;
|
||||||
|
|
||||||
const actionWorker = new Worker(
|
export const worker = new Worker(
|
||||||
'action',
|
'action',
|
||||||
async (job) => {
|
async (job) => {
|
||||||
const { stepId, flowId, executionId, computedParameters, executionStep } =
|
const { stepId, flowId, executionId, computedParameters, executionStep } =
|
||||||
@@ -54,11 +55,11 @@ const actionWorker = new Worker(
|
|||||||
{ connection: redisConfig }
|
{ connection: redisConfig }
|
||||||
);
|
);
|
||||||
|
|
||||||
actionWorker.on('completed', (job) => {
|
worker.on('completed', (job) => {
|
||||||
logger.info(`JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has started!`);
|
logger.info(`JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has started!`);
|
||||||
});
|
});
|
||||||
|
|
||||||
actionWorker.on('failed', (job, err) => {
|
worker.on('failed', (job, err) => {
|
||||||
const errorMessage = `
|
const errorMessage = `
|
||||||
JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has failed to start with ${err.message}
|
JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has failed to start with ${err.message}
|
||||||
\n ${err.stack}
|
\n ${err.stack}
|
||||||
@@ -73,4 +74,6 @@ actionWorker.on('failed', (job, err) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export default actionWorker;
|
process.on('SIGTERM', async () => {
|
||||||
|
await worker.close();
|
||||||
|
});
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { Worker } from 'bullmq';
|
import { Worker } from 'bullmq';
|
||||||
|
import process from 'node:process';
|
||||||
|
|
||||||
import * as Sentry from '../helpers/sentry.ee.js';
|
import * as Sentry from '../helpers/sentry.ee.js';
|
||||||
import redisConfig from '../config/redis.js';
|
import redisConfig from '../config/redis.js';
|
||||||
@@ -7,7 +8,7 @@ import appConfig from '../config/app.js';
|
|||||||
import User from '../models/user.js';
|
import User from '../models/user.js';
|
||||||
import ExecutionStep from '../models/execution-step.js';
|
import ExecutionStep from '../models/execution-step.js';
|
||||||
|
|
||||||
const deleteUserWorker = new Worker(
|
export const worker = new Worker(
|
||||||
'delete-user',
|
'delete-user',
|
||||||
async (job) => {
|
async (job) => {
|
||||||
const { id } = job.data;
|
const { id } = job.data;
|
||||||
@@ -45,13 +46,13 @@ const deleteUserWorker = new Worker(
|
|||||||
{ connection: redisConfig }
|
{ connection: redisConfig }
|
||||||
);
|
);
|
||||||
|
|
||||||
deleteUserWorker.on('completed', (job) => {
|
worker.on('completed', (job) => {
|
||||||
logger.info(
|
logger.info(
|
||||||
`JOB ID: ${job.id} - The user with the ID of '${job.data.id}' has been deleted!`
|
`JOB ID: ${job.id} - The user with the ID of '${job.data.id}' has been deleted!`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
deleteUserWorker.on('failed', (job, err) => {
|
worker.on('failed', (job, err) => {
|
||||||
const errorMessage = `
|
const errorMessage = `
|
||||||
JOB ID: ${job.id} - The user with the ID of '${job.data.id}' has failed to be deleted! ${err.message}
|
JOB ID: ${job.id} - The user with the ID of '${job.data.id}' has failed to be deleted! ${err.message}
|
||||||
\n ${err.stack}
|
\n ${err.stack}
|
||||||
@@ -66,4 +67,6 @@ deleteUserWorker.on('failed', (job, err) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export default deleteUserWorker;
|
process.on('SIGTERM', async () => {
|
||||||
|
await worker.close();
|
||||||
|
});
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { Worker } from 'bullmq';
|
import { Worker } from 'bullmq';
|
||||||
|
import process from 'node:process';
|
||||||
|
|
||||||
import * as Sentry from '../helpers/sentry.ee.js';
|
import * as Sentry from '../helpers/sentry.ee.js';
|
||||||
import redisConfig from '../config/redis.js';
|
import redisConfig from '../config/redis.js';
|
||||||
@@ -15,7 +16,7 @@ const isAutomatischEmail = (email) => {
|
|||||||
return email.endsWith('@automatisch.io');
|
return email.endsWith('@automatisch.io');
|
||||||
};
|
};
|
||||||
|
|
||||||
const emailWorker = new Worker(
|
export const worker = new Worker(
|
||||||
'email',
|
'email',
|
||||||
async (job) => {
|
async (job) => {
|
||||||
const { email, subject, template, params } = job.data;
|
const { email, subject, template, params } = job.data;
|
||||||
@@ -38,13 +39,13 @@ const emailWorker = new Worker(
|
|||||||
{ connection: redisConfig }
|
{ connection: redisConfig }
|
||||||
);
|
);
|
||||||
|
|
||||||
emailWorker.on('completed', (job) => {
|
worker.on('completed', (job) => {
|
||||||
logger.info(
|
logger.info(
|
||||||
`JOB ID: ${job.id} - ${job.data.subject} email sent to ${job.data.email}!`
|
`JOB ID: ${job.id} - ${job.data.subject} email sent to ${job.data.email}!`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
emailWorker.on('failed', (job, err) => {
|
worker.on('failed', (job, err) => {
|
||||||
const errorMessage = `
|
const errorMessage = `
|
||||||
JOB ID: ${job.id} - ${job.data.subject} email to ${job.data.email} has failed to send with ${err.message}
|
JOB ID: ${job.id} - ${job.data.subject} email to ${job.data.email} has failed to send with ${err.message}
|
||||||
\n ${err.stack}
|
\n ${err.stack}
|
||||||
@@ -59,4 +60,6 @@ emailWorker.on('failed', (job, err) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export default emailWorker;
|
process.on('SIGTERM', async () => {
|
||||||
|
await worker.close();
|
||||||
|
});
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { Worker } from 'bullmq';
|
import { Worker } from 'bullmq';
|
||||||
|
import process from 'node:process';
|
||||||
|
|
||||||
import * as Sentry from '../helpers/sentry.ee.js';
|
import * as Sentry from '../helpers/sentry.ee.js';
|
||||||
import redisConfig from '../config/redis.js';
|
import redisConfig from '../config/redis.js';
|
||||||
@@ -12,7 +13,7 @@ import {
|
|||||||
REMOVE_AFTER_7_DAYS_OR_50_JOBS,
|
REMOVE_AFTER_7_DAYS_OR_50_JOBS,
|
||||||
} from '../helpers/remove-job-configuration.js';
|
} from '../helpers/remove-job-configuration.js';
|
||||||
|
|
||||||
const flowWorker = new Worker(
|
export const worker = new Worker(
|
||||||
'flow',
|
'flow',
|
||||||
async (job) => {
|
async (job) => {
|
||||||
const { flowId } = job.data;
|
const { flowId } = job.data;
|
||||||
@@ -63,11 +64,11 @@ const flowWorker = new Worker(
|
|||||||
{ connection: redisConfig }
|
{ connection: redisConfig }
|
||||||
);
|
);
|
||||||
|
|
||||||
flowWorker.on('completed', (job) => {
|
worker.on('completed', (job) => {
|
||||||
logger.info(`JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has started!`);
|
logger.info(`JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has started!`);
|
||||||
});
|
});
|
||||||
|
|
||||||
flowWorker.on('failed', async (job, err) => {
|
worker.on('failed', async (job, err) => {
|
||||||
const errorMessage = `
|
const errorMessage = `
|
||||||
JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has failed to start with ${err.message}
|
JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has failed to start with ${err.message}
|
||||||
\n ${err.stack}
|
\n ${err.stack}
|
||||||
@@ -94,4 +95,6 @@ flowWorker.on('failed', async (job, err) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export default flowWorker;
|
process.on('SIGTERM', async () => {
|
||||||
|
await worker.close();
|
||||||
|
});
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
import appConfig from '../config/app.js';
|
|
||||||
import actionWorker from './action.js';
|
|
||||||
import emailWorker from './email.js';
|
|
||||||
import flowWorker from './flow.js';
|
|
||||||
import triggerWorker from './trigger.js';
|
|
||||||
import deleteUserWorker from './delete-user.ee.js';
|
|
||||||
import removeCancelledSubscriptionsWorker from './remove-cancelled-subscriptions.ee.js';
|
|
||||||
|
|
||||||
const workers = [
|
|
||||||
actionWorker,
|
|
||||||
emailWorker,
|
|
||||||
flowWorker,
|
|
||||||
triggerWorker,
|
|
||||||
deleteUserWorker,
|
|
||||||
];
|
|
||||||
|
|
||||||
if (appConfig.isCloud) {
|
|
||||||
workers.push(removeCancelledSubscriptionsWorker);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default workers;
|
|
@@ -1,11 +1,12 @@
|
|||||||
import { Worker } from 'bullmq';
|
import { Worker } from 'bullmq';
|
||||||
|
import process from 'node:process';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import * as Sentry from '../helpers/sentry.ee.js';
|
import * as Sentry from '../helpers/sentry.ee.js';
|
||||||
import redisConfig from '../config/redis.js';
|
import redisConfig from '../config/redis.js';
|
||||||
import logger from '../helpers/logger.js';
|
import logger from '../helpers/logger.js';
|
||||||
import Subscription from '../models/subscription.ee.js';
|
import Subscription from '../models/subscription.ee.js';
|
||||||
|
|
||||||
const removeCancelledSubscriptionsWorker = new Worker(
|
export const worker = new Worker(
|
||||||
'remove-cancelled-subscriptions',
|
'remove-cancelled-subscriptions',
|
||||||
async () => {
|
async () => {
|
||||||
await Subscription.query()
|
await Subscription.query()
|
||||||
@@ -22,13 +23,13 @@ const removeCancelledSubscriptionsWorker = new Worker(
|
|||||||
{ connection: redisConfig }
|
{ connection: redisConfig }
|
||||||
);
|
);
|
||||||
|
|
||||||
removeCancelledSubscriptionsWorker.on('completed', (job) => {
|
worker.on('completed', (job) => {
|
||||||
logger.info(
|
logger.info(
|
||||||
`JOB ID: ${job.id} - The cancelled subscriptions have been removed!`
|
`JOB ID: ${job.id} - The cancelled subscriptions have been removed!`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
removeCancelledSubscriptionsWorker.on('failed', (job, err) => {
|
worker.on('failed', (job, err) => {
|
||||||
const errorMessage = `
|
const errorMessage = `
|
||||||
JOB ID: ${job.id} - ERROR: The cancelled subscriptions can not be removed! ${err.message}
|
JOB ID: ${job.id} - ERROR: The cancelled subscriptions can not be removed! ${err.message}
|
||||||
\n ${err.stack}
|
\n ${err.stack}
|
||||||
@@ -41,4 +42,6 @@ removeCancelledSubscriptionsWorker.on('failed', (job, err) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export default removeCancelledSubscriptionsWorker;
|
process.on('SIGTERM', async () => {
|
||||||
|
await worker.close();
|
||||||
|
});
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { Worker } from 'bullmq';
|
import { Worker } from 'bullmq';
|
||||||
|
import process from 'node:process';
|
||||||
|
|
||||||
import * as Sentry from '../helpers/sentry.ee.js';
|
import * as Sentry from '../helpers/sentry.ee.js';
|
||||||
import redisConfig from '../config/redis.js';
|
import redisConfig from '../config/redis.js';
|
||||||
@@ -11,7 +12,7 @@ import {
|
|||||||
REMOVE_AFTER_7_DAYS_OR_50_JOBS,
|
REMOVE_AFTER_7_DAYS_OR_50_JOBS,
|
||||||
} from '../helpers/remove-job-configuration.js';
|
} from '../helpers/remove-job-configuration.js';
|
||||||
|
|
||||||
const triggerWorker = new Worker(
|
export const worker = new Worker(
|
||||||
'trigger',
|
'trigger',
|
||||||
async (job) => {
|
async (job) => {
|
||||||
const { flowId, executionId, stepId, executionStep } = await processTrigger(
|
const { flowId, executionId, stepId, executionStep } = await processTrigger(
|
||||||
@@ -40,11 +41,11 @@ const triggerWorker = new Worker(
|
|||||||
{ connection: redisConfig }
|
{ connection: redisConfig }
|
||||||
);
|
);
|
||||||
|
|
||||||
triggerWorker.on('completed', (job) => {
|
worker.on('completed', (job) => {
|
||||||
logger.info(`JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has started!`);
|
logger.info(`JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has started!`);
|
||||||
});
|
});
|
||||||
|
|
||||||
triggerWorker.on('failed', (job, err) => {
|
worker.on('failed', (job, err) => {
|
||||||
const errorMessage = `
|
const errorMessage = `
|
||||||
JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has failed to start with ${err.message}
|
JOB ID: ${job.id} - FLOW ID: ${job.data.flowId} has failed to start with ${err.message}
|
||||||
\n ${err.stack}
|
\n ${err.stack}
|
||||||
@@ -59,4 +60,6 @@ triggerWorker.on('failed', (job, err) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export default triggerWorker;
|
process.on('SIGTERM', async () => {
|
||||||
|
await worker.close();
|
||||||
|
});
|
||||||
|
21
packages/e2e-tests/fixtures/execution-details-page.js
Normal file
21
packages/e2e-tests/fixtures/execution-details-page.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
const { AuthenticatedPage } = require('./authenticated-page');
|
||||||
|
const { expect } = require('@playwright/test');
|
||||||
|
|
||||||
|
export class ExecutionDetailsPage extends AuthenticatedPage {
|
||||||
|
constructor(page) {
|
||||||
|
super(page);
|
||||||
|
|
||||||
|
this.executionCreatedAt = page.getByTestId('execution-created-at');
|
||||||
|
this.executionId = page.getByTestId('execution-id');
|
||||||
|
this.executionName = page.getByTestId('execution-name');
|
||||||
|
this.executionStep = page.getByTestId('execution-step');
|
||||||
|
}
|
||||||
|
|
||||||
|
async verifyExecutionData(flowId) {
|
||||||
|
await expect(this.executionCreatedAt).toContainText(/\d+ seconds? ago/);
|
||||||
|
await expect(this.executionId).toHaveText(
|
||||||
|
/Execution ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
||||||
|
);
|
||||||
|
await expect(this.executionName).toHaveText(flowId);
|
||||||
|
}
|
||||||
|
}
|
93
packages/e2e-tests/fixtures/execution-step-details.js
Normal file
93
packages/e2e-tests/fixtures/execution-step-details.js
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
const { ExecutionDetailsPage } = require('./execution-details-page');
|
||||||
|
const { expect } = require('@playwright/test');
|
||||||
|
|
||||||
|
export class ExecutionStepDetails extends ExecutionDetailsPage {
|
||||||
|
constructor(page, executionStep) {
|
||||||
|
super(page);
|
||||||
|
|
||||||
|
this.executionStep = executionStep;
|
||||||
|
this.stepType = executionStep.getByTestId('step-type');
|
||||||
|
this.stepPositionAndName = executionStep.getByTestId(
|
||||||
|
'step-position-and-name'
|
||||||
|
);
|
||||||
|
this.executionStepId = executionStep.getByTestId('execution-step-id');
|
||||||
|
this.executionStepExecutedAt = executionStep.getByTestId(
|
||||||
|
'execution-step-executed-at'
|
||||||
|
);
|
||||||
|
this.dataInTab = executionStep.getByTestId('data-in-tab');
|
||||||
|
this.dataInPanel = executionStep.getByTestId('data-in-panel');
|
||||||
|
this.dataOutTab = executionStep.getByTestId('data-out-tab');
|
||||||
|
this.dataOutPanel = executionStep.getByTestId('data-out-panel');
|
||||||
|
}
|
||||||
|
|
||||||
|
async expectDataInTabToBeSelectedByDefault() {
|
||||||
|
await expect(this.dataInTab).toHaveClass(/Mui-selected/);
|
||||||
|
}
|
||||||
|
|
||||||
|
async expectDataInToContainText(searchText, desiredText) {
|
||||||
|
await expect(this.dataInPanel).toContainText(desiredText);
|
||||||
|
await this.dataInPanel.locator('#search-input').fill(searchText);
|
||||||
|
await expect(this.dataInPanel).toContainText(desiredText);
|
||||||
|
}
|
||||||
|
|
||||||
|
async expectDataOutToContainText(searchText, desiredText) {
|
||||||
|
await expect(this.dataOutPanel).toContainText(desiredText);
|
||||||
|
await this.dataOutPanel.locator('#search-input').fill(searchText);
|
||||||
|
await expect(this.dataOutPanel).toContainText(desiredText);
|
||||||
|
}
|
||||||
|
|
||||||
|
async verifyTriggerExecutionStep({
|
||||||
|
stepPositionAndName,
|
||||||
|
stepDataInKey,
|
||||||
|
stepDataInValue,
|
||||||
|
stepDataOutKey,
|
||||||
|
stepDataOutValue,
|
||||||
|
}) {
|
||||||
|
await expect(this.stepType).toHaveText('Trigger');
|
||||||
|
await this.verifyExecutionStep({
|
||||||
|
stepPositionAndName,
|
||||||
|
stepDataInKey,
|
||||||
|
stepDataInValue,
|
||||||
|
stepDataOutKey,
|
||||||
|
stepDataOutValue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async verifyActionExecutionStep({
|
||||||
|
stepPositionAndName,
|
||||||
|
stepDataInKey,
|
||||||
|
stepDataInValue,
|
||||||
|
stepDataOutKey,
|
||||||
|
stepDataOutValue,
|
||||||
|
}) {
|
||||||
|
await expect(this.stepType).toHaveText('Action');
|
||||||
|
await this.verifyExecutionStep({
|
||||||
|
stepPositionAndName,
|
||||||
|
stepDataInKey,
|
||||||
|
stepDataInValue,
|
||||||
|
stepDataOutKey,
|
||||||
|
stepDataOutValue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async verifyExecutionStep({
|
||||||
|
stepPositionAndName,
|
||||||
|
stepDataInKey,
|
||||||
|
stepDataInValue,
|
||||||
|
stepDataOutKey,
|
||||||
|
stepDataOutValue,
|
||||||
|
}) {
|
||||||
|
await expect(this.stepPositionAndName).toHaveText(stepPositionAndName);
|
||||||
|
await expect(this.executionStepId).toHaveText(
|
||||||
|
/ID: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
||||||
|
);
|
||||||
|
await expect(this.executionStepExecutedAt).toContainText(
|
||||||
|
/executed \d+ seconds? ago/
|
||||||
|
);
|
||||||
|
await this.expectDataInTabToBeSelectedByDefault();
|
||||||
|
await this.expectDataInToContainText(stepDataInKey, stepDataInValue);
|
||||||
|
await this.dataOutTab.click();
|
||||||
|
await expect(this.dataOutPanel).toContainText(stepDataOutValue);
|
||||||
|
await this.expectDataOutToContainText(stepDataOutKey, stepDataOutValue);
|
||||||
|
}
|
||||||
|
}
|
@@ -2,4 +2,11 @@ const { AuthenticatedPage } = require('./authenticated-page');
|
|||||||
|
|
||||||
export class ExecutionsPage extends AuthenticatedPage {
|
export class ExecutionsPage extends AuthenticatedPage {
|
||||||
screenshotPath = '/executions';
|
screenshotPath = '/executions';
|
||||||
|
|
||||||
|
constructor(page) {
|
||||||
|
super(page);
|
||||||
|
|
||||||
|
this.executionRow = this.page.getByTestId('execution-row');
|
||||||
|
this.executionsPageLoader = this.page.getByTestId('executions-loader');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@ const { test, expect } = require('@playwright/test');
|
|||||||
const { ApplicationsPage } = require('./applications-page');
|
const { ApplicationsPage } = require('./applications-page');
|
||||||
const { ConnectionsPage } = require('./connections-page');
|
const { ConnectionsPage } = require('./connections-page');
|
||||||
const { ExecutionsPage } = require('./executions-page');
|
const { ExecutionsPage } = require('./executions-page');
|
||||||
|
const { ExecutionDetailsPage } = require('./execution-details-page');
|
||||||
const { FlowEditorPage } = require('./flow-editor-page');
|
const { FlowEditorPage } = require('./flow-editor-page');
|
||||||
const { UserInterfacePage } = require('./user-interface-page');
|
const { UserInterfacePage } = require('./user-interface-page');
|
||||||
const { LoginPage } = require('./login-page');
|
const { LoginPage } = require('./login-page');
|
||||||
@@ -29,6 +30,9 @@ exports.test = test.extend({
|
|||||||
executionsPage: async ({ page }, use) => {
|
executionsPage: async ({ page }, use) => {
|
||||||
await use(new ExecutionsPage(page));
|
await use(new ExecutionsPage(page));
|
||||||
},
|
},
|
||||||
|
executionDetailsPage: async ({ page }, use) => {
|
||||||
|
await use(new ExecutionDetailsPage(page));
|
||||||
|
},
|
||||||
flowEditorPage: async ({ page }, use) => {
|
flowEditorPage: async ({ page }, use) => {
|
||||||
await use(new FlowEditorPage(page));
|
await use(new FlowEditorPage(page));
|
||||||
},
|
},
|
||||||
|
15
packages/e2e-tests/helpers/auth-api-helper.js
Normal file
15
packages/e2e-tests/helpers/auth-api-helper.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
const { expect } = require('../fixtures/index');
|
||||||
|
|
||||||
|
export const getToken = async (apiRequest) => {
|
||||||
|
const tokenResponse = await apiRequest.post(
|
||||||
|
`http://localhost:${process.env.PORT}/api/v1/access-tokens`,
|
||||||
|
{
|
||||||
|
data: {
|
||||||
|
email: process.env.LOGIN_EMAIL,
|
||||||
|
password: process.env.LOGIN_PASSWORD,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await expect(tokenResponse.status()).toBe(200);
|
||||||
|
return await tokenResponse.json();
|
||||||
|
};
|
108
packages/e2e-tests/helpers/flow-api-helper.js
Normal file
108
packages/e2e-tests/helpers/flow-api-helper.js
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
const { expect } = require('../fixtures/index');
|
||||||
|
|
||||||
|
export const createFlow = async (request, token) => {
|
||||||
|
const response = await request.post(
|
||||||
|
`http://localhost:${process.env.PORT}/api/v1/flows`,
|
||||||
|
{ headers: { Authorization: token } }
|
||||||
|
);
|
||||||
|
await expect(response.status()).toBe(201);
|
||||||
|
return await response.json();
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getFlow = async (request, token, flowId) => {
|
||||||
|
const response = await request.get(
|
||||||
|
`http://localhost:${process.env.PORT}/api/v1/flows/${flowId}`,
|
||||||
|
{ headers: { Authorization: token } }
|
||||||
|
);
|
||||||
|
await expect(response.status()).toBe(200);
|
||||||
|
return await response.json();
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateFlowName = async (request, token, flowId) => {
|
||||||
|
const updateFlowNameResponse = await request.patch(
|
||||||
|
`http://localhost:${process.env.PORT}/api/v1/flows/${flowId}`,
|
||||||
|
{
|
||||||
|
headers: { Authorization: token },
|
||||||
|
data: { name: flowId },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await expect(updateFlowNameResponse.status()).toBe(200);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateFlowStep = async (request, token, stepId, requestBody) => {
|
||||||
|
const updateTriggerStepResponse = await request.patch(
|
||||||
|
`http://localhost:${process.env.PORT}/api/v1/steps/${stepId}`,
|
||||||
|
{
|
||||||
|
headers: { Authorization: token },
|
||||||
|
data: requestBody,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await expect(updateTriggerStepResponse.status()).toBe(200);
|
||||||
|
return await updateTriggerStepResponse.json();
|
||||||
|
};
|
||||||
|
|
||||||
|
export const testStep = async (request, token, stepId) => {
|
||||||
|
const testTriggerStepResponse = await request.post(
|
||||||
|
`http://localhost:${process.env.PORT}/api/v1/steps/${stepId}/test`,
|
||||||
|
{
|
||||||
|
headers: { Authorization: token },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await expect(testTriggerStepResponse.status()).toBe(200);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const publishFlow = async (request, token, flowId) => {
|
||||||
|
const publishFlowResponse = await request.patch(
|
||||||
|
`http://localhost:${process.env.PORT}/api/v1/flows/${flowId}/status`,
|
||||||
|
{
|
||||||
|
headers: { Authorization: token },
|
||||||
|
data: { active: true },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await expect(publishFlowResponse.status()).toBe(200);
|
||||||
|
return publishFlowResponse.json();
|
||||||
|
};
|
||||||
|
|
||||||
|
export const triggerFlow = async (request, url) => {
|
||||||
|
const triggerFlowResponse = await request.get(url);
|
||||||
|
await expect(triggerFlowResponse.status()).toBe(204);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const addWebhookFlow = async (request, token) => {
|
||||||
|
let flow = await createFlow(request, token);
|
||||||
|
const flowId = flow.data.id;
|
||||||
|
await updateFlowName(request, token, flowId);
|
||||||
|
flow = await getFlow(request, token, flowId);
|
||||||
|
const flowSteps = flow.data.steps;
|
||||||
|
|
||||||
|
const triggerStepId = flowSteps.find((step) => step.type === 'trigger').id;
|
||||||
|
const actionStepId = flowSteps.find((step) => step.type === 'action').id;
|
||||||
|
|
||||||
|
const triggerStep = await updateFlowStep(request, token, triggerStepId, {
|
||||||
|
appKey: 'webhook',
|
||||||
|
key: 'catchRawWebhook',
|
||||||
|
parameters: {
|
||||||
|
workSynchronously: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await request.get(triggerStep.data.webhookUrl);
|
||||||
|
await testStep(request, token, triggerStepId);
|
||||||
|
|
||||||
|
await updateFlowStep(request, token, actionStepId, {
|
||||||
|
appKey: 'webhook',
|
||||||
|
key: 'respondWith',
|
||||||
|
parameters: {
|
||||||
|
statusCode: '200',
|
||||||
|
body: 'ok',
|
||||||
|
headers: [
|
||||||
|
{
|
||||||
|
key: '',
|
||||||
|
value: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await testStep(request, token, actionStepId);
|
||||||
|
|
||||||
|
return flowId;
|
||||||
|
};
|
@@ -2,11 +2,14 @@ const { publicTest: setup, expect } = require('../../fixtures/index');
|
|||||||
|
|
||||||
setup.describe.serial('Admin setup page', () => {
|
setup.describe.serial('Admin setup page', () => {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
setup('should not be able to login if admin is not created', async ({ page, adminSetupPage, loginPage }) => {
|
setup(
|
||||||
await expect(async () => {
|
'should not be able to login if admin is not created',
|
||||||
await expect(await page.url()).toContain(adminSetupPage.path);
|
async ({ page, adminSetupPage }) => {
|
||||||
}).toPass();
|
await expect(async () => {
|
||||||
});
|
await expect(await page.url()).toContain(adminSetupPage.path);
|
||||||
|
}).toPass();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
setup('should validate the inputs', async ({ adminSetupPage }) => {
|
setup('should validate the inputs', async ({ adminSetupPage }) => {
|
||||||
await adminSetupPage.open();
|
await adminSetupPage.open();
|
||||||
|
@@ -1,37 +1,138 @@
|
|||||||
|
const { request } = require('@playwright/test');
|
||||||
const { test, expect } = require('../../fixtures/index');
|
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 }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.getByTestId('executions-page-drawer-link').click();
|
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 }) => {
|
test('show correct step data for trigger and actions on test and non-test execution', async ({
|
||||||
await expect(page.getByTestId('execution-step').last()).toBeVisible();
|
page,
|
||||||
await expect(page.getByTestId('execution-step')).toHaveCount(2);
|
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({
|
await executionDetailsPage.verifyExecutionData(flowId);
|
||||||
path: 'Execution - data in.png',
|
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();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,17 +1,54 @@
|
|||||||
|
const { request } = require('@playwright/test');
|
||||||
const { test, expect } = require('../../fixtures/index');
|
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', () => {
|
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 }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.getByTestId('executions-page-drawer-link').click();
|
await page.getByTestId('executions-page-drawer-link').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
// no executions exist in an empty account
|
test('should be able to see normal and test executions', async ({
|
||||||
test.skip('displays executions', async ({ page, executionsPage }) => {
|
executionsPage,
|
||||||
await page.getByTestId('executions-loader').waitFor({
|
}) => {
|
||||||
|
await executionsPage.executionsPageLoader.waitFor({
|
||||||
state: 'detached',
|
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');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -10,7 +10,7 @@ import { ExecutionPropType } from 'propTypes/propTypes';
|
|||||||
|
|
||||||
function ExecutionName(props) {
|
function ExecutionName(props) {
|
||||||
return (
|
return (
|
||||||
<Typography variant="h3" gutterBottom>
|
<Typography data-test="execution-name" variant="h3" gutterBottom>
|
||||||
{props.name}
|
{props.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
);
|
);
|
||||||
@@ -29,7 +29,7 @@ function ExecutionId(props) {
|
|||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: 'flex' }}>
|
<Box sx={{ display: 'flex' }}>
|
||||||
<Typography variant="body2">
|
<Typography data-test="execution-id" variant="body2">
|
||||||
{formatMessage('execution.id', { id })}
|
{formatMessage('execution.id', { id })}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -47,7 +47,7 @@ function ExecutionDate(props) {
|
|||||||
<Tooltip
|
<Tooltip
|
||||||
title={createdAt.toLocaleString(DateTime.DATETIME_FULL_WITH_SECONDS)}
|
title={createdAt.toLocaleString(DateTime.DATETIME_FULL_WITH_SECONDS)}
|
||||||
>
|
>
|
||||||
<Typography variant="body1" gutterBottom>
|
<Typography data-test="execution-created-at" variant="body1" gutterBottom>
|
||||||
{relativeCreatedAt}
|
{relativeCreatedAt}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
@@ -36,7 +36,11 @@ function ExecutionStepId(props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: 'flex' }} gridArea="id">
|
<Box sx={{ display: 'flex' }} gridArea="id">
|
||||||
<Typography variant="caption" fontWeight="bold">
|
<Typography
|
||||||
|
data-test="execution-step-id"
|
||||||
|
variant="caption"
|
||||||
|
fontWeight="bold"
|
||||||
|
>
|
||||||
{formatMessage('executionStep.id', { id })}
|
{formatMessage('executionStep.id', { id })}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -56,7 +60,11 @@ function ExecutionStepDate(props) {
|
|||||||
<Tooltip
|
<Tooltip
|
||||||
title={createdAt.toLocaleString(DateTime.DATETIME_FULL_WITH_SECONDS)}
|
title={createdAt.toLocaleString(DateTime.DATETIME_FULL_WITH_SECONDS)}
|
||||||
>
|
>
|
||||||
<Typography variant="caption" gutterBottom>
|
<Typography
|
||||||
|
data-test="execution-step-executed-at"
|
||||||
|
variant="caption"
|
||||||
|
gutterBottom
|
||||||
|
>
|
||||||
{formatMessage('executionStep.executedAt', {
|
{formatMessage('executionStep.executedAt', {
|
||||||
datetime: relativeCreatedAt,
|
datetime: relativeCreatedAt,
|
||||||
})}
|
})}
|
||||||
@@ -119,12 +127,12 @@ function ExecutionStep(props) {
|
|||||||
<ExecutionStepId id={executionStep.step.id} />
|
<ExecutionStepId id={executionStep.step.id} />
|
||||||
|
|
||||||
<Box flex="1" gridArea="step">
|
<Box flex="1" gridArea="step">
|
||||||
<Typography variant="caption">
|
<Typography data-test="step-type" variant="caption">
|
||||||
{isTrigger && formatMessage('flowStep.triggerType')}
|
{isTrigger && formatMessage('flowStep.triggerType')}
|
||||||
{isAction && formatMessage('flowStep.actionType')}
|
{isAction && formatMessage('flowStep.actionType')}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Typography variant="body2">
|
<Typography data-test="step-position-and-name" variant="body2">
|
||||||
{step.position}. {app?.name}
|
{step.position}. {app?.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -152,7 +160,7 @@ function ExecutionStep(props) {
|
|||||||
</Tabs>
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<TabPanel value={activeTabIndex} index={0}>
|
<TabPanel value={activeTabIndex} index={0} data-test="data-in-panel">
|
||||||
<SearchableJSONViewer data={executionStep.dataIn} />
|
<SearchableJSONViewer data={executionStep.dataIn} />
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user