Skip to content

Commit 87483c0

Browse files
committed
feat: stage 1 end to end test for studio interface
1 parent 258f956 commit 87483c0

File tree

9 files changed

+312
-52
lines changed

9 files changed

+312
-52
lines changed

.github/workflows/end-to-end-tests.yml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,40 @@ jobs:
2121
node-version: 20
2222
- name: Install everything
2323
run: npm install
24-
- name: Always test with the latest browserslist db
24+
#- name: Always test with the latest browserslist db
25+
# run: |
26+
# npx update-browserslist-db@latest
27+
#- name: Commit browserslist db changes on dev branches
28+
# if: ${{ github.ref_type == 'branch' && ! github.ref_protected }}
29+
# run: |
30+
# if git diff --exit-code package-lock.json; then
31+
# echo "The browserslist db is up to date."
32+
# else
33+
# echo "The browserslist db is out of date."
34+
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
35+
# git config --global user.name "github-actions[bot]"
36+
# git add package-lock.json
37+
# git commit -m "chore: update browserslist db"
38+
# git push
39+
# fi
40+
- name: Install and run the back-end API, needed for end-to-end testing
2541
run: |
26-
npx update-browserslist-db@latest
27-
- name: Commit browserslist db changes on dev branches
28-
if: ${{ github.ref_type == 'branch' && ! github.ref_protected }}
29-
run: |
30-
if git diff --exit-code package-lock.json; then
31-
echo "The browserslist db is up to date."
32-
else
33-
echo "The browserslist db is out of date."
34-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
35-
git config --global user.name "github-actions[bot]"
36-
git add package-lock.json
37-
git commit -m "chore: update browserslist db"
38-
git push
39-
fi
42+
git clone https://github.com/ReadAlongs/Studio
43+
cd Studio
44+
pip install -e . -r requirements.api.txt
45+
./run-web-api.sh &
46+
# wait for the API to be up
47+
curl --retry 20 --retry-delay 1 --retry-all-errors http://localhost:8000/api/v1/langs
4048
- name: Ng test for studio-web
4149
run: |
4250
npx nx build web-component
4351
npx nx test:once studio-web
52+
- name: Playwright for studio-web
53+
run: |
54+
npx nx build web-compnent
55+
npx nx nx run-many --targets=serve-test-data,serve-web-api,serve,serve-fr,serve-es --projects=web-component,studio-web --parallel 6
56+
npx nx e2e studio-web
57+
4458
- name: Cypress run for web-component
4559
uses: cypress-io/github-action@v6
4660
with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ www
88
.python-version
99
*~
1010
**/version.ts
11+
packages/studio-web/playwright-report
12+
**/test-results

package-lock.json

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@angular/localize": "^17",
1010
"@commitlint/cli": "^19.2.1",
1111
"@commitlint/config-conventional": "^19.1.0",
12+
"@playwright/test": "^1.36.0",
1213
"@nx/angular": "18.3.4",
1314
"@nx/eslint": "18.3.4",
1415
"@nx/eslint-plugin": "18.3.4",

packages/studio-web/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"helpme": "echo This project is part of a monorepo managed using nx. Run the targets in project.json using npx nx target studio-web at the root of the monorepo.",
1010
"ng": "ng",
1111
"test:ng": "ng test",
12-
"test:once": "ng test --watch=false --browsers ChromeHeadlessCI"
12+
"test:once": "ng test --watch=false --browsers ChromeHeadlessCI",
13+
"e2e": "playwright test",
14+
"e2e-ui": "playwright test --ui"
1315
},
1416
"private": true,
1517
"singleFileBundleVersion": "1.5.2",

packages/studio-web/playwright.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { defineConfig, devices } from "@playwright/test";
1212
* See https://playwright.dev/docs/test-configuration.
1313
*/
1414
export default defineConfig({
15+
timeout: 2 * 60 * 1000,
1516
testDir: "./tests",
1617
/* Run tests in files in parallel */
1718
fullyParallel: true,
@@ -26,7 +27,7 @@ export default defineConfig({
2627
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2728
use: {
2829
/* Base URL to use in actions like `await page.goto('/')`. */
29-
// baseURL: 'http://127.0.0.1:3000',
30+
baseURL: "http://localhost:4200",
3031

3132
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3233
trace: "on-first-retry",

packages/studio-web/project.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@
8080
},
8181
"defaultConfiguration": "production"
8282
},
83+
"update-browserslist": {
84+
"command": "npx update-browserslist-db@latest"
85+
},
8386
"serve": {
8487
"executor": "@angular-builders/custom-webpack:dev-server",
88+
"dependsOn": ["update-browserslist"],
8589
"configurations": {
8690
"production-en": {
8791
"buildTarget": "studio-web:build:production,en"

packages/studio-web/src/app/shared/download/download.component.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
<div class="download__buttons">
22
<mat-form-field class="d-lg-block" appearance="fill">
33
<mat-label i18n="Output format">Output Format</mat-label>
4-
<mat-select [(ngModel)]="selectedOutputFormat">
4+
<mat-select
5+
data-test-id="download-formats"
6+
[(ngModel)]="selectedOutputFormat"
7+
>
58
<mat-option *ngFor="let format of outputFormats" [value]="format.value">
69
{{ format.display }}
710
</mat-option>
811
</mat-select>
912
</mat-form-field>
1013
<button
14+
data-test-id="download-ras"
1115
class="download"
1216
color="primary"
1317
(click)="download()"

0 commit comments

Comments
 (0)