Skip to content

Commit e8d868d

Browse files
Pollepsjoepio
authored andcommitted
Fix gh ci
1 parent 187fbbb commit e8d868d

File tree

7 files changed

+58
-25
lines changed

7 files changed

+58
-25
lines changed

.github/workflows/main.yml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
on: [push, workflow_dispatch]
1+
on:
2+
[
3+
push,
4+
workflow_dispatch,
5+
]
26

3-
name: "Build, test, clippy"
7+
name: 'Build, test, clippy'
48
jobs:
59
fmt:
610
name: Rustfmt
711
runs-on: ubuntu-latest
812
steps:
9-
- run: |
13+
- run:
14+
|
1015
sudo apt-get update
1116
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
1217
- uses: actions/checkout@v2
@@ -38,36 +43,42 @@ jobs:
3843

3944
- name: Get pnpm store directory
4045
id: pnpm-cache
41-
run: |
46+
run:
47+
|
4248
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
4349

4450
- uses: actions/cache@v3
4551
name: Setup pnpm cache
4652
with:
4753
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
4854
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
49-
restore-keys: |
55+
restore-keys:
56+
|
5057
${{ runner.os }}-pnpm-store-
5158

5259
- name: Install JS deps
5360
working-directory: ./browser/
54-
run: |
61+
run:
62+
|
5563
pnpm install
5664
pnpm run playwright-install
5765

5866
- name: Lint JS
5967
working-directory: ./browser/
60-
run: |
68+
run:
69+
|
6170
pnpm run lint
6271

6372
- name: Test JS (no e2e)
6473
working-directory: ./browser/
65-
run: |
74+
run:
75+
|
6676
pnpm run test
6777

6878
- name: Build JS
6979
working-directory: ./browser/
70-
run: |
80+
run:
81+
|
7182
pnpm run build
7283

7384
- name: Save JS Build Artifacts
@@ -78,9 +89,13 @@ jobs:
7889
e2e:
7990
name: End-to-end tests
8091
runs-on: ubuntu-latest
81-
needs: [build_js]
92+
needs:
93+
[
94+
build_js,
95+
]
8296
steps:
83-
- run: |
97+
- run:
98+
|
8499
sudo apt-get update
85100
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
86101
- uses: actions/checkout@v3
@@ -131,20 +146,23 @@ jobs:
131146

132147
- name: Get pnpm store directory
133148
id: pnpm-cache
134-
run: |
149+
run:
150+
|
135151
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
136152

137153
- uses: actions/cache@v3
138154
name: Setup pnpm cache
139155
with:
140156
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
141157
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
142-
restore-keys: |
158+
restore-keys:
159+
|
143160
${{ runner.os }}-pnpm-store-
144161

145162
- name: Install Playwright
146163
working-directory: ./browser/
147-
run: |
164+
run:
165+
|
148166
pnpm install
149167
pnpm run playwright-install
150168

@@ -156,6 +174,7 @@ jobs:
156174
env:
157175
FRONTEND_URL: http://localhost:9883
158176
LANGUAGE: 'en_GB'
177+
DELETE_PREVIOUS_TEST_DRIVES: 'false'
159178
run: pnpm run test-e2e
160179

161180
# Coverage

browser/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "0.35.2",
33
"author": "Polle Pas",
44
"dependencies": {
5-
"@tomic/lib": "^0.35.2",
5+
"@tomic/lib": "workspace:*",
66
"chalk": "^5.3.0",
77
"prettier": "3.0.3"
88
},
@@ -30,6 +30,6 @@
3030
},
3131
"type": "module",
3232
"peerDependencies": {
33-
"@tomic/lib": "^0.35.2"
33+
"@tomic/lib": "workspace:*"
3434
}
3535
}

browser/data-browser/tests/global.setup.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
import { test as setup, expect } from '@playwright/test';
2-
import { before, FRONTEND_URL, signIn } from './test-utils';
2+
import {
3+
before,
4+
DELETE_PREVIOUS_TEST_DRIVES,
5+
FRONTEND_URL,
6+
signIn,
7+
} from './test-utils';
38

49
setup('delete previous test data', async ({ page }) => {
10+
if (!DELETE_PREVIOUS_TEST_DRIVES) {
11+
expect(true).toBe(true);
12+
13+
return;
14+
}
15+
516
await before({ page });
617
await signIn(page);
718
await page.goto(`${FRONTEND_URL}/prunetests`);

browser/data-browser/tests/ontology.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
currentDialog,
88
} from './test-utils';
99

10+
const WAIT_FOR_SEARCH_INDEX_TIME = 6000;
11+
1012
test.describe('Ontology', async () => {
1113
test.beforeEach(before);
1214

@@ -157,7 +159,7 @@ test.describe('Ontology', async () => {
157159

158160
// Create arrow-kind instances
159161

160-
await page.waitForTimeout(5000);
162+
await page.waitForTimeout(WAIT_FOR_SEARCH_INDEX_TIME);
161163

162164
const createInstance = async (name: string) => {
163165
await page.getByRole('button', { name: 'New Instance' }).click();
@@ -180,7 +182,7 @@ test.describe('Ontology', async () => {
180182
await createInstance('Red arrow with circle');
181183
await createInstance('Green arrow with black border');
182184

183-
await page.waitForTimeout(5000);
185+
await page.waitForTimeout(WAIT_FOR_SEARCH_INDEX_TIME);
184186

185187
await page
186188
.getByRole('button', { name: 'add an item to the allows-only list' })

browser/data-browser/tests/test-utils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { Page, expect, Browser, Locator } from '@playwright/test';
22

33
export const DEMO_FILENAME = 'testimage.svg';
44
export const SERVER_URL = 'http://localhost:9883';
5+
export const DELETE_PREVIOUS_TEST_DRIVES =
6+
process.env.DELETE_PREVIOUS_TEST_DRIVES === 'false' ? false : true;
7+
58
export const FRONTEND_URL = process.env.FRONTEND_URL || 'http://localhost:5173';
69
// TODO: Should use an env var so the CI can test the setup test.
710
export const INITIAL_TEST = false;
@@ -168,10 +171,8 @@ export async function fillSearchBox(
168171
await selector.getByPlaceholder(placeholder).type(fillText);
169172

170173
return async (name: string) => {
171-
// wait for the search to load (TODO: make this better)
172-
await page.waitForTimeout(100);
173-
selector.getByTestId('searchbox-results').getByText(name).hover();
174-
selector.getByTestId('searchbox-results').getByText(name).click();
174+
await selector.getByTestId('searchbox-results').getByText(name).hover();
175+
await selector.getByTestId('searchbox-results').getByText(name).click();
175176
};
176177
}
177178

browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"dev": "pnpm run start",
3838
"lint": "pnpm run -r lint",
3939
"lint-fix": "pnpm run -r lint-fix",
40-
"build": "pnpm run -r build",
40+
"build": "pnpm --filter \"@tomic/lib\" run build && pnpm --filter=!./lib run -r build ",
4141
"test": "pnpm run -r test",
4242
"test-e2e": "pnpm run --filter @tomic/data-browser test-e2e",
4343
"test-query": "pnpm run --filter @tomic/data-browser test-query",

browser/pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)