Skip to content

Commit c57647d

Browse files
authored
Merge pull request #525 from fractal-analytics-platform/test-ci-update
Used FRACTAL_RUNNER_BACKEND=local_experimental and postgres-psycopg in CI
2 parents bbb9d55 + 0e3e1c7 commit c57647d

File tree

8 files changed

+144
-51
lines changed

8 files changed

+144
-51
lines changed

.github/workflows/end_to_end_tests.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,13 @@ jobs:
5252
if: matrix.node-version == '18'
5353
run: echo "FRACTAL_SERVER_HOST=http://127.0.0.1:8000" >> $GITHUB_ENV
5454

55-
- name: Run Playwright tests
55+
- name: Run Playwright tests [v1]
5656
run: npx playwright test
57+
env:
58+
TEST_VERSION: v1
59+
60+
- name: Run Playwright tests [v2]
61+
run: npx playwright test
62+
env:
63+
TEST_VERSION: v2
64+
FRACTAL_RUNNER_BACKEND: local_experimental

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
*Note: Numbers like (\#123) point to closed Pull Requests on the fractal-web repository.*
22

3+
# Unreleased
4+
5+
* Used `postgres-psycopg` adapter in CI (\#525);
6+
* Used `FRACTAL_BACKEND_RUNNER=local_experimental` in CI for v2 tests (\#525);
7+
38
# 1.3.0
49

510
> Starting from this release the Sandbox pages are not included in fractal-web anymore, instead they are static pages published together with the documentation.

examples/config_3_with_domain_and_https/fractal_server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
DEPLOYMENT_TYPE=testing
55
JWT_SECRET_KEY=XXX
66
JWT_EXPIRE_SECONDS=80000
7-
DB_ENGINE=postgres
7+
DB_ENGINE=postgres-psycopg
88
POSTGRES_USER=XXX
99
POSTGRES_HOST=XXX
1010
POSTGRES_DB=XXX

examples/config_4_with_domain_and_https/fractal_server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
DEPLOYMENT_TYPE=testing
55
JWT_SECRET_KEY=XXX
66
JWT_EXPIRE_SECONDS=80000
7-
DB_ENGINE=postgres
7+
DB_ENGINE=postgres-psycopg
88
POSTGRES_USER=XXX
99
POSTGRES_HOST=XXX
1010
POSTGRES_DB=XXX

playwright.config.js

Lines changed: 75 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,83 @@ import dotenv from 'dotenv';
55

66
dotenv.config({ path: '.env.development' });
77

8-
export default defineConfig({
9-
testDir: 'tests',
10-
retries: 3,
11-
12-
projects: [
13-
{ name: 'auth', testMatch: /auth\.setup\.js/ },
14-
{
15-
name: 'collect_core_tasks',
16-
testMatch: /v1\/collect_core_tasks\.setup\.js/,
17-
use: {
18-
storageState: 'tests/.auth/user.json'
19-
},
20-
dependencies: ['auth']
8+
const v1Tests = [
9+
{ name: 'auth', testMatch: /auth\.setup\.js/ },
10+
{
11+
name: 'collect_core_tasks',
12+
testMatch: /v1\/collect_core_tasks\.setup\.js/,
13+
use: {
14+
storageState: 'tests/.auth/user.json'
2115
},
22-
{
23-
name: 'collect_mock_tasks',
24-
testMatch: /v2\/collect_mock_tasks\.setup\.js/,
25-
use: {
26-
storageState: 'tests/.auth/user.json'
27-
},
28-
dependencies: ['auth']
16+
dependencies: ['auth']
17+
},
18+
{
19+
name: 'create_fake_task',
20+
testMatch: /v1\/create_fake_task\.setup\.js/,
21+
use: {
22+
storageState: 'tests/.auth/user.json'
2923
},
30-
{
31-
name: 'create_fake_task',
32-
testMatch: /v1\/create_fake_task\.setup\.js/,
33-
use: {
34-
storageState: 'tests/.auth/user.json'
35-
},
36-
dependencies: ['collect_core_tasks', 'auth']
24+
dependencies: ['collect_core_tasks', 'auth']
25+
},
26+
{
27+
name: 'chromium',
28+
testMatch: /v1\/.*\.spec\.js/,
29+
use: {
30+
...devices['Desktop Chrome'],
31+
storageState: 'tests/.auth/user.json'
3732
},
38-
{
39-
name: 'chromium',
40-
use: {
41-
...devices['Desktop Chrome'],
42-
storageState: 'tests/.auth/user.json'
43-
},
44-
dependencies: ['collect_mock_tasks', 'create_fake_task']
33+
dependencies: ['create_fake_task']
34+
},
35+
{
36+
name: 'firefox',
37+
testMatch: /v1\/.*\.spec\.js/,
38+
use: {
39+
...devices['Desktop Firefox'],
40+
storageState: 'tests/.auth/user.json'
4541
},
46-
{
47-
name: 'firefox',
48-
use: {
49-
...devices['Desktop Firefox'],
50-
storageState: 'tests/.auth/user.json'
51-
},
52-
dependencies: ['create_fake_task']
53-
}
54-
],
42+
dependencies: ['create_fake_task']
43+
}
44+
];
45+
46+
const v2Tests = [
47+
{ name: 'auth', testMatch: /auth\.setup\.js/ },
48+
{
49+
name: 'collect_mock_tasks',
50+
testMatch: /v2\/collect_mock_tasks\.setup\.js/,
51+
use: {
52+
storageState: 'tests/.auth/user.json'
53+
},
54+
dependencies: ['auth']
55+
},
56+
{
57+
name: 'chromium',
58+
testMatch: /v2\/.*\.spec\.js/,
59+
use: {
60+
...devices['Desktop Chrome'],
61+
storageState: 'tests/.auth/user.json'
62+
},
63+
dependencies: ['collect_mock_tasks']
64+
},
65+
{
66+
name: 'firefox',
67+
testMatch: /v2\/.*\.spec\.js/,
68+
use: {
69+
...devices['Desktop Firefox'],
70+
storageState: 'tests/.auth/user.json'
71+
},
72+
dependencies: ['collect_mock_tasks']
73+
}
74+
];
75+
76+
const version = process.env.TEST_VERSION || 'v2';
77+
78+
const tests = version === 'v2' ? v2Tests : v1Tests;
79+
80+
export default defineConfig({
81+
testDir: 'tests',
82+
retries: 3,
83+
84+
projects: tests,
5585

5686
webServer: [
5787
{
@@ -69,7 +99,8 @@ export default defineConfig({
6999
reuseExistingServer: !process.env.CI
70100
},
71101
{
72-
command: 'npm run build && LOG_LEVEL_CONSOLE=debug ORIGIN=http://localhost:5173 PORT=5173 node build',
102+
command:
103+
'npm run build && LOG_LEVEL_CONSOLE=debug ORIGIN=http://localhost:5173 PORT=5173 node build',
73104
port: 5173,
74105
stdout: 'pipe',
75106
reuseExistingServer: !process.env.CI

tests/.fractal_server.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
DEPLOYMENT_TYPE=testing
22
JWT_SECRET_KEY=somethingverysecret
3-
DB_ENGINE=postgres
3+
DB_ENGINE=postgres-psycopg
44
POSTGRES_DB=fractal_test
55
POSTGRES_USER=postgres
66
POSTGRES_PASSWORD=postgres

tests/start-test-server.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ if [ ! -d "$fractal_server_test_path" ]; then
2626
python3 -m venv myenv
2727
. myenv/bin/activate
2828
pip install "fractal-server==$1"
29-
pip install fractal-server[postgres]
29+
pip install fractal-server[postgres-psycopg-binary]
3030
fractalctl set-db
31+
else
32+
cd "$fractal_server_test_path"
33+
. myenv/bin/activate
3134
fi
3235

33-
cd "$fractal_server_test_path"
34-
3536
# Start
3637
fractalctl start --port 8000

tests/v2/stop_workflow.spec.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { expect, test } from './workflow_fixture.js';
2+
import { waitModalClosed, waitPageLoading } from '../utils.js';
3+
import { createDataset } from './dataset_utils.js';
4+
import { waitTaskSubmitted } from './workflow_task_utils.js';
5+
6+
test('Stop workflow [v2]', async ({ page, workflow }) => {
7+
await page.waitForURL(workflow.url);
8+
await waitPageLoading(page);
9+
10+
await test.step('Create test dataset', async () => {
11+
await createDataset(page, workflow.projectId);
12+
});
13+
14+
await test.step('Go to workflow page', async () => {
15+
await page.goto(workflow.url);
16+
await waitPageLoading(page);
17+
});
18+
19+
await test.step('Add and select generic_task', async () => {
20+
await workflow.addCollectedTask('generic_task');
21+
await workflow.selectTask('generic_task');
22+
});
23+
24+
await test.step('Increase task sleep time', async () => {
25+
await page.getByRole('spinbutton', { name: 'Sleep Time' }).fill('100');
26+
await page.getByRole('button', { name: 'Save changes' }).click();
27+
await expect(page.getByText('Arguments changes saved successfully')).toBeVisible();
28+
});
29+
30+
await test.step('Run workflow', async () => {
31+
await page.getByRole('button', { name: 'Run workflow' }).click();
32+
const modal = page.locator('.modal.show');
33+
await modal.waitFor();
34+
await page.getByRole('button', { name: 'Run', exact: true }).click();
35+
await page.getByRole('button', { name: 'Confirm' }).click();
36+
await waitModalClosed(page);
37+
});
38+
39+
await test.step('Wait tasks submitted', async () => {
40+
await waitTaskSubmitted(page, 1);
41+
});
42+
43+
await test.step('Stop workflow', async () => {
44+
await page.getByRole('button', { name: 'Stop workflow' }).click();
45+
await expect(page.getByText(/Job failed .* likely due to an executor shutdown./)).toBeVisible();
46+
await expect(page.getByRole('button', { name: 'Restart workflow' })).toBeVisible();
47+
});
48+
});

0 commit comments

Comments
 (0)