diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 8f58ac80..651d0454 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -21,7 +21,9 @@ jobs: node-version: 20 - name: Install everything run: npm install - + - name: Always test with the latest browserslist db + run: | + npx update-browserslist-db@latest - name: Ng test for studio-web run: | npx nx build web-component @@ -54,81 +56,3 @@ jobs: npx nx bundle web-component git status git diff --word-diff=porcelain --word-diff-regex=... --color | perl -ple 's/^(\x1b[^ -+]{0,6})? (.{81,})$/$1 . " " . substr($2, 0, 40) . " [... " . (length($2)-80) . " bytes ...] " . substr($2, -40)/ex' - playwright-tests: - name: Run Playwright test-suites - timeout-minutes: 60 - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - shardIndex: [1, 2, 3, 4] - shardTotal: [4] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install and run the back-end API, needed for end-to-end testing - run: | - git clone https://github.com/ReadAlongs/Studio - cd Studio - pip install -e . -r requirements.api.txt - ./run-web-api.sh & - # wait for the API to be up - curl --retry 20 --retry-delay 1 --retry-all-errors http://localhost:8000/api/v1/langs - - name: Install everything - run: npm install - - name: Install dependencies - run: npm ci - - name: Run studio-web in the background - run: | - npx nx build web-component - npx nx run-many --targets=serve,serve-fr,serve-es --projects=web-component,studio-web --parallel 6 & - - # wait for the studio web to be up - sleep 100 - curl --retry 20 --retry-delay 30 --retry-all-errors http://localhost:4200 - - name: Run Playwright tests for studio-web - run: | - npx playwright install --with-deps chromium - npx nx e2e studio-web --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} - - name: Upload blob report to GitHub Actions Artifacts - if: ${{ !cancelled() }} - uses: actions/upload-artifact@v4 - with: - name: blob-report-${{ matrix.shardIndex }} - path: packages/studio-web/blob-report - retention-days: 1 - merge-reports: - # Merge reports after playwright-tests, even if some shards have failed - if: ${{ !cancelled() }} - needs: [playwright-tests] - name: "Merge playwright reports" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install everything - run: npm install - - name: Install dependencies - run: npm ci - - name: Install playwright - run: npx playwright install - - name: Download blob reports from GitHub Actions Artifacts - uses: actions/download-artifact@v4 - with: - path: all-blob-reports - pattern: blob-report-* - merge-multiple: true - - - name: Merge into HTML Report - run: npx playwright merge-reports --reporter=html,github ./all-blob-reports - - - name: Upload HTML report - uses: actions/upload-artifact@v4 - with: - name: html-report--attempt-${{ github.run_attempt }} - path: playwright-report - retention-days: 5 diff --git a/.gitignore b/.gitignore index b370de85..d894bf63 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,3 @@ www *~ **/version.ts packages/web-component/wordpress-plugin/read-along-web-app-loader/js/* -packages/studio-web/playwright-report -**/test-results diff --git a/.husky/post-install b/.husky/post-install deleted file mode 100644 index 76ceb88b..00000000 --- a/.husky/post-install +++ /dev/null @@ -1 +0,0 @@ -npx playwright install --with-deps firefox chromium webkit diff --git a/package-lock.json b/package-lock.json index 744c510c..1b0ac0e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,6 @@ "jszip": "^3.10.1", "mime": "^4.0.1", "ngx-toastr": "^18.0.0", - "root": "file:", "shepherd.js": "^11.2.0", "soundswallower": "^0.6.3", "standardized-audio-context": "^25.3.70", @@ -46,7 +45,6 @@ "@nx/jest": "18.3.4", "@nx/storybook": "18.3.4", "@nxext/stencil": "^18", - "@playwright/test": "^1.36.0", "@stencil/angular-output-target": "^0.8.4", "@stencil/core": "^4.15.0", "@stencil/sass": "^3.0.11", @@ -75,7 +73,6 @@ "prettier": "^3.2.5", "pretty-quick": "^4.0.0", "ts-jest": "^29", - "ts-node": "^10.9.2", "tsx": "^4.7.3" } }, @@ -6551,50 +6548,6 @@ "node": ">=8" } }, - "node_modules/@nx/js/node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, "node_modules/@nx/linter": { "version": "18.3.4", "resolved": "https://registry.npmjs.org/@nx/linter/-/linter-18.3.4.tgz", @@ -7822,21 +7775,6 @@ "node": ">=14" } }, - "node_modules/@playwright/test": { - "version": "1.48.2", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.2.tgz", - "integrity": "sha512-54w1xCWfXuax7dz4W2M9uw0gDyh+ti/0K/MxcCUxChFh37kkdxPdfZDw5QBbuPUJHr1CiHJ1hXgSs+GgeQc5Zw==", - "dev": true, - "dependencies": { - "playwright": "1.48.2" - }, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/@polka/url": { "version": "1.0.0-next.25", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.25.tgz", @@ -11150,9 +11088,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001687", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz", - "integrity": "sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==", + "version": "1.0.30001680", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz", + "integrity": "sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA==", "dev": true, "funding": [ { @@ -21905,50 +21843,6 @@ "node": ">=8" } }, - "node_modules/playwright": { - "version": "1.48.2", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.2.tgz", - "integrity": "sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ==", - "dev": true, - "dependencies": { - "playwright-core": "1.48.2" - }, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "fsevents": "2.3.2" - } - }, - "node_modules/playwright-core": { - "version": "1.48.2", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.2.tgz", - "integrity": "sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA==", - "dev": true, - "bin": { - "playwright-core": "cli.js" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/playwright/node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/portfinder": { "version": "1.0.32", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz", @@ -23542,10 +23436,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/root": { - "resolved": "", - "link": true - }, "node_modules/run-async": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", @@ -25476,11 +25366,10 @@ } }, "node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, - "license": "MIT", "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -27725,10 +27614,7 @@ }, "packages/studio-web": { "name": "readalong-studio", - "version": "0.0.0", - "dependencies": { - "readalong-studio": "file:" - } + "version": "0.0.0" }, "packages/web-component": { "name": "@readalongs/web-component", diff --git a/package.json b/package.json index 5e677f4c..bd43b8c6 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "@nx/jest": "18.3.4", "@nx/storybook": "18.3.4", "@nxext/stencil": "^18", - "@playwright/test": "^1.36.0", "@stencil/angular-output-target": "^0.8.4", "@stencil/core": "^4.15.0", "@stencil/sass": "^3.0.11", @@ -44,7 +43,6 @@ "prettier": "^3.2.5", "pretty-quick": "^4.0.0", "ts-jest": "^29", - "ts-node": "^10.9.2", "tsx": "^4.7.3" }, "dependencies": { @@ -64,7 +62,6 @@ "jszip": "^3.10.1", "mime": "^4.0.1", "ngx-toastr": "^18.0.0", - "root": "file:", "shepherd.js": "^11.2.0", "soundswallower": "^0.6.3", "standardized-audio-context": "^25.3.70", diff --git a/packages/studio-web/package.json b/packages/studio-web/package.json index d098d9d2..83378871 100644 --- a/packages/studio-web/package.json +++ b/packages/studio-web/package.json @@ -9,14 +9,9 @@ "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.", "ng": "ng", "test:ng": "ng test", - "test:once": "ng test --watch=false --browsers ChromeHeadlessCI", - "e2e": "playwright test", - "e2e-ui": "playwright test --ui" + "test:once": "ng test --watch=false --browsers ChromeHeadlessCI" }, "private": true, "singleFileBundleVersion": "1.5.2", - "singleFileBundleTimestamp": "2024-11-18+11-19-49", - "dependencies": { - "readalong-studio": "file:" - } + "singleFileBundleTimestamp": "2024-11-18+11-19-49" } diff --git a/packages/studio-web/playwright.config.ts b/packages/studio-web/playwright.config.ts deleted file mode 100644 index 8e9c022b..00000000 --- a/packages/studio-web/playwright.config.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { defineConfig, devices } from "@playwright/test"; - -/** - * Read environment variables from file. - * https://github.com/motdotla/dotenv - */ -// import dotenv from 'dotenv'; -// import path from 'path'; -// dotenv.config({ path: path.resolve(__dirname, '.env') }); - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - timeout: (process.env.CI ? 25 : 50) * 1000, - testDir: "./tests", - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: process.env.CI ? 2 : 3, - /* Opt out of parallel tests on CI. */ - workers: process.env.CI ? 1 : 2, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: process.env.CI ? [["blob", { open: "never" }]] : "html", - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: "http://localhost:4200", - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: "on-first-retry", - testIdAttribute: "data-test-id", - video: "retain-on-failure", - }, - - /* Configure projects for major browsers */ - /* Only test chromium on CI */ - projects: process.env.CI - ? [ - { - name: "chromium", - use: { ...devices["Desktop Chrome"] }, - }, - { - name: "Mobile Chrome", - use: { ...devices["Pixel 5"] }, - }, - ] - : [ - { - name: "chromium", - use: { ...devices["Desktop Chrome"] }, - }, - - { - name: "firefox", - use: { ...devices["Desktop Firefox"] }, - }, - /* We do not have full webkit support - { - name: "webkit", - use: { ...devices["Desktop Safari"] }, - }, - - /* Test against mobile viewports. */ - { - name: "Mobile Chrome", - use: { ...devices["Pixel 5"] }, - }, - /* - { - name: "Mobile Safari", - use: { ...devices["iPhone 12"] }, - }, - - /* Test against branded browsers. */ - // { - // name: 'Microsoft Edge', - // use: { ...devices['Desktop Edge'], channel: 'msedge' }, - // }, - // { - // name: 'Google Chrome', - // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, - // }, - ], - - /* Run your local dev server before starting the tests */ - // webServer: { - // command: 'npm run start', - // url: 'http://127.0.0.1:3000', - // reuseExistingServer: !process.env.CI, - // }, -}); diff --git a/packages/studio-web/src/app/demo/demo.component.html b/packages/studio-web/src/app/demo/demo.component.html index f0d7136c..da275a25 100644 --- a/packages/studio-web/src/app/demo/demo.component.html +++ b/packages/studio-web/src/app/demo/demo.component.html @@ -38,24 +38,22 @@ [(ngModel)]="studioService.slots.title" [ngStyle]="{ 'width.ch': studioService.slots.title.length, - 'min-width.ch': 20 + 'min-width.ch': 20, }" style="border: none" placeholder="Enter your title here" slot="read-along-header" - data-test-id="ra-header" /> diff --git a/packages/studio-web/src/app/shared/download/download.component.html b/packages/studio-web/src/app/shared/download/download.component.html index cd12fef4..13dd931b 100644 --- a/packages/studio-web/src/app/shared/download/download.component.html +++ b/packages/studio-web/src/app/shared/download/download.component.html @@ -1,17 +1,13 @@
Output Format - + {{ format.display }} @@ -99,7 +97,6 @@

Text

matInput i18n-placeholder="Example input text" placeholder="Ex. Hello my name is..." - data-test-id="ras-text-input" >
@@ -118,7 +115,6 @@

Audio

name="inputMethod" aria-label="Input Method" [value]="studioService.inputMethod.audio" - data-test-id="audio-btn-group" > Record type="file" id="updateAudio" accept=".mp3,.wav,.webm,.m4a" - data-test-id="ras-audio-fileselector" />
[color]="recording ? 'warn' : 'primary'" aria-label="Record button" [disabled]="starting_to_record" - data-test-id="ras-audio-recording-btn" > mic Select Language - + {{ lang.names["_"] }} - ({{ lang.code }}) @@ -363,12 +353,11 @@

i18n="Next button" id="next-step" class="mt-4 plausible-event-name=CreateReadalong" - [disabled]="loading || !isLoaded" + [disabled]="loading" mat-raised-button color="primary" type="submit" (click)="nextStep()" - data-test-id="next-step" > Go to the next step! diff --git a/packages/studio-web/src/app/upload/upload.component.ts b/packages/studio-web/src/app/upload/upload.component.ts index 990ab2df..c5e8795a 100644 --- a/packages/studio-web/src/app/upload/upload.component.ts +++ b/packages/studio-web/src/app/upload/upload.component.ts @@ -88,11 +88,6 @@ export class UploadComponent implements OnDestroy, OnInit { .subscribe((textString) => this.uploadService.$currentText.next(textString), ); - this.ssjsService.modelLoaded - .pipe(takeUntil(this.unsubscribe$)) - .subscribe((loaded) => { - this.isLoaded = loaded; - }); } async ngOnInit() { diff --git a/packages/studio-web/tests/fixtures/page1.png b/packages/studio-web/tests/fixtures/page1.png deleted file mode 100644 index f4b793c0..00000000 Binary files a/packages/studio-web/tests/fixtures/page1.png and /dev/null differ diff --git a/packages/studio-web/tests/fixtures/page2.png b/packages/studio-web/tests/fixtures/page2.png deleted file mode 100644 index 71f95098..00000000 Binary files a/packages/studio-web/tests/fixtures/page2.png and /dev/null differ diff --git a/packages/studio-web/tests/fixtures/ref/edited/readalong.eaf b/packages/studio-web/tests/fixtures/ref/edited/readalong.eaf deleted file mode 100644 index 0cb0da70..00000000 --- a/packages/studio-web/tests/fixtures/ref/edited/readalong.eaf +++ /dev/null @@ -1,95 +0,0 @@ - - -
- 0 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - This is a test - - - - - Sentences - - - - - Paragraph - - - - - Page - - - - - - - This - - - - - is - - - - - a - - - - - test - - - - - Sentences - - - - - Paragraph - - - - - Page - - - - - - - - -
diff --git a/packages/studio-web/tests/fixtures/ref/edited/readalong.srt b/packages/studio-web/tests/fixtures/ref/edited/readalong.srt deleted file mode 100644 index 12657b60..00000000 --- a/packages/studio-web/tests/fixtures/ref/edited/readalong.srt +++ /dev/null @@ -1,16 +0,0 @@ -1 -00:00:00,500 --> 00:00:01,800 -This is a test - -2 -00:00:01,800 --> 00:00:02,360 -Sentences - -3 -00:00:02,360 --> 00:00:03,030 -Paragraph - -4 -00:00:03,030 --> 00:00:03,400 -Page - diff --git a/packages/studio-web/tests/fixtures/ref/edited/readalong.textgrid b/packages/studio-web/tests/fixtures/ref/edited/readalong.textgrid deleted file mode 100644 index 34b0cc2a..00000000 --- a/packages/studio-web/tests/fixtures/ref/edited/readalong.textgrid +++ /dev/null @@ -1,72 +0,0 @@ -File type = "ooTextFile" -Object class = "TextGrid" - -xmin = 0.000000 -xmax = 3.400000 -tiers? -size = 2 -item []: - item [1]: - class = "IntervalTier" - name = "Sentence" - xmin = 0.000000 - xmax = 3.400000 - intervals: size = 5 - intervals [1]: - xmin = 0.000000 - xmax = 0.500000 - text = "" - intervals [2]: - xmin = 0.500000 - xmax = 1.800000 - text = "This is a test" - intervals [3]: - xmin = 1.800000 - xmax = 2.360000 - text = "Sentences" - intervals [4]: - xmin = 2.360000 - xmax = 3.030000 - text = "Paragraph" - intervals [5]: - xmin = 3.030000 - xmax = 3.400000 - text = "Page" - item [2]: - class = "IntervalTier" - name = "Word" - xmin = 0.000000 - xmax = 3.400000 - intervals: size = 8 - intervals [1]: - xmin = 0.000000 - xmax = 0.500000 - text = "" - intervals [2]: - xmin = 0.500000 - xmax = 1.070000 - text = "This" - intervals [3]: - xmin = 1.070000 - xmax = 1.200000 - text = "is" - intervals [4]: - xmin = 1.200000 - xmax = 1.230000 - text = "a" - intervals [5]: - xmin = 1.230000 - xmax = 1.800000 - text = "test" - intervals [6]: - xmin = 1.800000 - xmax = 2.360000 - text = "Sentences" - intervals [7]: - xmin = 2.360000 - xmax = 3.030000 - text = "Paragraph" - intervals [8]: - xmin = 3.030000 - xmax = 3.400000 - text = "Page" diff --git a/packages/studio-web/tests/fixtures/ref/edited/readalong.vtt b/packages/studio-web/tests/fixtures/ref/edited/readalong.vtt deleted file mode 100644 index 881a4035..00000000 --- a/packages/studio-web/tests/fixtures/ref/edited/readalong.vtt +++ /dev/null @@ -1,13 +0,0 @@ -WEBVTT - -00:00:00.500 --> 00:00:01.800 -This is a test - -00:00:01.800 --> 00:00:02.360 -Sentences - -00:00:02.360 --> 00:00:03.030 -Paragraph - -00:00:03.030 --> 00:00:03.400 -Page diff --git a/packages/studio-web/tests/fixtures/ref/edited/sentence-paragr-date.readalong b/packages/studio-web/tests/fixtures/ref/edited/sentence-paragr-date.readalong deleted file mode 100644 index 5a386e4d..00000000 --- a/packages/studio-web/tests/fixtures/ref/edited/sentence-paragr-date.readalong +++ /dev/null @@ -1,21 +0,0 @@ - - - - -
-

- This is a test.Un vrai test. - Sentences.Phrase. -

-

- Paragraph. -

-
-
-

- Page. -

-
- -
-
diff --git a/packages/studio-web/tests/fixtures/ref/readalong.eaf b/packages/studio-web/tests/fixtures/ref/readalong.eaf deleted file mode 100644 index 1e0c31ce..00000000 --- a/packages/studio-web/tests/fixtures/ref/readalong.eaf +++ /dev/null @@ -1,95 +0,0 @@ - - -
- 0 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - This is a test - - - - - Sentence - - - - - Paragraph - - - - - Page - - - - - - - This - - - - - is - - - - - a - - - - - test - - - - - Sentence - - - - - Paragraph - - - - - Page - - - - - - - - -
diff --git a/packages/studio-web/tests/fixtures/ref/readalong.srt b/packages/studio-web/tests/fixtures/ref/readalong.srt deleted file mode 100644 index 70dad4c1..00000000 --- a/packages/studio-web/tests/fixtures/ref/readalong.srt +++ /dev/null @@ -1,16 +0,0 @@ -1 -00:00:00,840 --> 00:00:01,800 -This is a test - -2 -00:00:01,800 --> 00:00:02,360 -Sentence - -3 -00:00:02,360 --> 00:00:03,030 -Paragraph - -4 -00:00:03,030 --> 00:00:03,400 -Page - diff --git a/packages/studio-web/tests/fixtures/ref/readalong.textgrid b/packages/studio-web/tests/fixtures/ref/readalong.textgrid deleted file mode 100644 index c08343ec..00000000 --- a/packages/studio-web/tests/fixtures/ref/readalong.textgrid +++ /dev/null @@ -1,72 +0,0 @@ -File type = "ooTextFile" -Object class = "TextGrid" - -xmin = 0.000000 -xmax = 3.400000 -tiers? -size = 2 -item []: - item [1]: - class = "IntervalTier" - name = "Sentence" - xmin = 0.000000 - xmax = 3.400000 - intervals: size = 5 - intervals [1]: - xmin = 0.000000 - xmax = 0.840000 - text = "" - intervals [2]: - xmin = 0.840000 - xmax = 1.800000 - text = "This is a test" - intervals [3]: - xmin = 1.800000 - xmax = 2.360000 - text = "Sentence" - intervals [4]: - xmin = 2.360000 - xmax = 3.030000 - text = "Paragraph" - intervals [5]: - xmin = 3.030000 - xmax = 3.400000 - text = "Page" - item [2]: - class = "IntervalTier" - name = "Word" - xmin = 0.000000 - xmax = 3.400000 - intervals: size = 8 - intervals [1]: - xmin = 0.000000 - xmax = 0.840000 - text = "" - intervals [2]: - xmin = 0.840000 - xmax = 1.070000 - text = "This" - intervals [3]: - xmin = 1.070000 - xmax = 1.200000 - text = "is" - intervals [4]: - xmin = 1.200000 - xmax = 1.230000 - text = "a" - intervals [5]: - xmin = 1.230000 - xmax = 1.800000 - text = "test" - intervals [6]: - xmin = 1.800000 - xmax = 2.360000 - text = "Sentence" - intervals [7]: - xmin = 2.360000 - xmax = 3.030000 - text = "Paragraph" - intervals [8]: - xmin = 3.030000 - xmax = 3.400000 - text = "Page" diff --git a/packages/studio-web/tests/fixtures/ref/readalong.vtt b/packages/studio-web/tests/fixtures/ref/readalong.vtt deleted file mode 100644 index ca0e5f1a..00000000 --- a/packages/studio-web/tests/fixtures/ref/readalong.vtt +++ /dev/null @@ -1,13 +0,0 @@ -WEBVTT - -00:00:00.840 --> 00:00:01.800 -This is a test - -00:00:01.800 --> 00:00:02.360 -Sentence - -00:00:02.360 --> 00:00:03.030 -Paragraph - -00:00:03.030 --> 00:00:03.400 -Page diff --git a/packages/studio-web/tests/fixtures/test-sentence-paragraph-page-56k.mp3 b/packages/studio-web/tests/fixtures/test-sentence-paragraph-page-56k.mp3 deleted file mode 100644 index 051998b2..00000000 Binary files a/packages/studio-web/tests/fixtures/test-sentence-paragraph-page-56k.mp3 and /dev/null differ diff --git a/packages/studio-web/tests/studio-web/check-page-1.spec.ts b/packages/studio-web/tests/studio-web/check-page-1.spec.ts deleted file mode 100644 index 1b81f779..00000000 --- a/packages/studio-web/tests/studio-web/check-page-1.spec.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { test, expect } from "@playwright/test"; -import { testText, defaultBeforeEach } from "../test-commands"; -test.describe.configure({ mode: "parallel" }); -test.describe("test studio UI & UX", () => { - test("should check UI (en)", async ({ page }) => { - await page.goto("/"); - //tour button is visible - await expect(page.getByText("Take the tour!")).toBeVisible(); - //check text button group - await expect(page.getByTestId("text-btn-group")).toBeVisible(); - //check audio button group - await expect(page.getByTestId("audio-btn-group")).toBeVisible(); - //check the language list - await expect(page.getByTestId("language-list")).toBeDisabled(); - await page - .getByRole("radio", { name: "Select a specific language" }) - .check(); - await expect(page.getByTestId("language-list")).toBeEnabled(); - }); - test("should check UI (fr)", async ({ page }) => { - await page.goto("http://localhost:4203/"); - //tour button is visible - await expect( - page.getByRole("button", { name: "Visite guidée" }), - ).toBeVisible(); - //check text button group - await expect(page.getByTestId("text-btn-group")).toBeVisible(); - //check audio button group - await expect(page.getByTestId("audio-btn-group")).toBeVisible(); - //check the language list - await expect(page.getByTestId("language-list")).toBeDisabled(); - await page - .getByRole("radio", { name: "Sélectionner une languge spécifique" }) - .check(); - await expect(page.getByTestId("language-list")).toBeEnabled(); - }); - test("should check UI (es)", async ({ page }) => { - await page.goto("http://localhost:4204/"); - //tour button is visible - await expect(page.getByText("¡Siga el tour!")).toBeVisible(); - //check text button group - await expect(page.getByTestId("text-btn-group")).toBeVisible(); - //check audio button group - await expect(page.getByTestId("audio-btn-group")).toBeVisible(); - //check the language list - await expect(page.getByTestId("language-list")).toBeDisabled(); - await page - .getByRole("radio", { name: "Seleccione un idioma específico" }) - .check(); - await expect(page.getByTestId("language-list")).toBeEnabled(); - }); - test("should input and save text", async ({ page }) => { - await page.goto("/"); - await expect(page.getByTestId("text-download-btn")).toBeDisabled(); - await page.getByTestId("ras-text-input").fill(testText); - await expect(page.getByTestId("text-download-btn")).toBeEnabled(); - - const download2Promise = page.waitForEvent("download"); - await page.getByTestId("text-download-btn").click(); - const download2 = await download2Promise; - await expect( - download2.suggestedFilename(), - "should have the expected filename", - ).toMatch(/ras-text-\d+\.txt/); - }); -}); diff --git a/packages/studio-web/tests/studio-web/download-elan.spec.ts b/packages/studio-web/tests/studio-web/download-elan.spec.ts deleted file mode 100644 index 2c4af2d0..00000000 --- a/packages/studio-web/tests/studio-web/download-elan.spec.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { test, expect } from "@playwright/test"; -import { testMakeAReadAlong, defaultBeforeEach } from "../test-commands"; - -test("should Download ELAN ( file format)", async ({ page, browserName }) => { - await defaultBeforeEach(page, browserName); - await testMakeAReadAlong(page); - - await page.locator("#mat-select-value-3").click(); - await page.getByRole("option", { name: "Elan File" }).click(); - const download2Promise = page.waitForEvent("download"); - await page.getByTestId("download-ras").click(); - const download2 = await download2Promise; - await expect( - download2.suggestedFilename(), - "should have the expected filename", - ).toMatch(/readalong\.eaf/); -}); diff --git a/packages/studio-web/tests/studio-web/download-html.spec.ts b/packages/studio-web/tests/studio-web/download-html.spec.ts deleted file mode 100644 index 7f392d52..00000000 --- a/packages/studio-web/tests/studio-web/download-html.spec.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { test, expect } from "@playwright/test"; -import { testMakeAReadAlong, defaultBeforeEach } from "../test-commands"; - -test("should Download default (single file format)", async ({ - page, - browserName, -}) => { - await expect(async () => { - await defaultBeforeEach(page, browserName); - await testMakeAReadAlong(page); - }).toPass(); - //download default - const downloadPromise = page.waitForEvent("download"); - await page.getByTestId("download-ras").click(); - const download = await downloadPromise; - await expect( - download.suggestedFilename(), - "should have the expected filename", - ).toMatch(/sentence\-paragr\-[0-9]*\.html/); -}); diff --git a/packages/studio-web/tests/studio-web/download-praat.spec.ts b/packages/studio-web/tests/studio-web/download-praat.spec.ts deleted file mode 100644 index d30ce846..00000000 --- a/packages/studio-web/tests/studio-web/download-praat.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { test, expect } from "@playwright/test"; -import { - testAssetsPath, - testMakeAReadAlong, - defaultBeforeEach, - replaceValuesWithZeroes, -} from "../test-commands"; -import fs from "fs"; - -test("should Download Praat ( file format)", async ({ page, browserName }) => { - await defaultBeforeEach(page, browserName); - await testMakeAReadAlong(page); - - await page.locator("#mat-select-value-3").click(); - await page.getByRole("option", { name: "Praat TextGrid" }).click(); - const download2Promise = page.waitForEvent("download"); - await page.getByTestId("download-ras").click(); - const download2 = await download2Promise; - await expect( - download2.suggestedFilename(), - "should have the expected filename", - ).toMatch(/readalong\.textgrid/); - /* check output*/ - const filePath = await download2.path(); - const fileData = fs.readFileSync(filePath, { encoding: "utf8", flag: "r" }); - const refFileData = fs.readFileSync( - `${testAssetsPath}/ref/readalong.textgrid`, - { encoding: "utf8", flag: "r" }, - ); - await expect( - replaceValuesWithZeroes(fileData.replace(/\r/g, "")), - "file content should match reference data", - ).toEqual(replaceValuesWithZeroes(refFileData)); -}); diff --git a/packages/studio-web/tests/studio-web/download-srt.spec.ts b/packages/studio-web/tests/studio-web/download-srt.spec.ts deleted file mode 100644 index 7af1a2f1..00000000 --- a/packages/studio-web/tests/studio-web/download-srt.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { test, expect } from "@playwright/test"; -import { - testAssetsPath, - testMakeAReadAlong, - defaultBeforeEach, - replaceValuesWithZeroes, -} from "../test-commands"; -import fs from "fs"; - -test("should Download SRT ( file format)", async ({ page, browserName }) => { - await defaultBeforeEach(page, browserName); - await testMakeAReadAlong(page); - - await page.locator("#mat-select-value-3").click(); - await page.getByRole("option", { name: "SRT Subtitles" }).click(); - const download2Promise = page.waitForEvent("download"); - await page.getByTestId("download-ras").click(); - const download2 = await download2Promise; - await expect( - download2.suggestedFilename(), - "should have the expected filename", - ).toMatch(/readalong\.srt/); - - const filePath = await download2.path(); - const fileData = fs.readFileSync(filePath, { encoding: "utf8", flag: "r" }); - const refFileData = fs.readFileSync(`${testAssetsPath}/ref/readalong.srt`, { - encoding: "utf8", - flag: "r", - }); - await expect( - replaceValuesWithZeroes(fileData.replace(/\r/g, "")), - "file content should match reference data", - ).toEqual(replaceValuesWithZeroes(refFileData)); -}); diff --git a/packages/studio-web/tests/studio-web/download-web-bundle.spec.ts b/packages/studio-web/tests/studio-web/download-web-bundle.spec.ts deleted file mode 100644 index dc9708f8..00000000 --- a/packages/studio-web/tests/studio-web/download-web-bundle.spec.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { test, expect } from "@playwright/test"; -import { testMakeAReadAlong, defaultBeforeEach } from "../test-commands"; -import fs from "fs"; -import JSZip from "jszip"; - -test("should Download web bundle (zip file format)", async ({ - page, - browserName, -}) => { - test.slow(); - - await defaultBeforeEach(page, browserName); - await testMakeAReadAlong(page); - - //download web bundle - await page.getByLabel("2Step").locator("svg").click(); - await page.locator(".cdk-overlay-backdrop").click(); - await page.locator("#mat-select-value-3").click(); - await page.getByRole("option", { name: "Web Bundle" }).click(); - const download1Promise = page.waitForEvent("download"); - await page.getByTestId("download-ras").click(); - const download1 = await download1Promise; - await expect( - download1.suggestedFilename(), - "should have the expected filename", - ).toMatch(/sentence\-paragr\-[0-9]*\.zip/); - //await download1.saveAs(testAssetsPath + download1.suggestedFilename()); - const zipPath = await download1.path(); - const zipBin = await fs.readFileSync(zipPath); - const zip = await JSZip.loadAsync(zipBin); - await expect( - zip.folder(/Offline-HTML/), - "should have Offline-HTML folder", - ).toHaveLength(1); //Offline-HTML folder exists - await expect( - zip.file(/Offline-HTML\/sentence\-paragr\-[0-9]*\.html/), - "should have Offline-HTML file", - ).toHaveLength(1); //Offline-HTML folder exists - await expect( - zip.folder(/www/).length, - "should have www folder", - ).toBeGreaterThan(1); //www folder exists - await expect( - zip.folder(/www\/assets/), - "should have assets folder", - ).toHaveLength(1); //www/assets folder exists - await expect( - zip.file(/www\/assets\/sentence\-paragr\-[0-9]*\.readalong/), - "should have readalong file", - ).toHaveLength(1); //www/assets readalong exists - await expect( - zip.file(/www\/assets\/sentence\-paragr\-[0-9]*\.wav/), - "should have wav file", - ).toHaveLength(1); //www/assets audio exists - await expect( - zip.file(/www\/assets\/image-sentence\-paragr\-[0-9\-]*\.png/), - "should have image files", - ).toHaveLength(2); //www/assets image exists - await expect( - zip.file(/www\/sentence\-paragr\-[0-9]*\.txt/), - "should have readalong plain text file", - ).toHaveLength(1); //www/ readalong text exists - await expect( - zip.file(/www\/readme.txt/), - "should have readme file", - ).toHaveLength(1); //www/ readme text exists - await expect( - zip.file(/www\/index.html/), - "should have index file", - ).toHaveLength(1); //www/index.html exists -}); diff --git a/packages/studio-web/tests/studio-web/download-webvtt.spec.ts b/packages/studio-web/tests/studio-web/download-webvtt.spec.ts deleted file mode 100644 index 68f05f79..00000000 --- a/packages/studio-web/tests/studio-web/download-webvtt.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { test, expect } from "@playwright/test"; -import { - testMakeAReadAlong, - defaultBeforeEach, - testAssetsPath, - replaceValuesWithZeroes, -} from "../test-commands"; -import fs from "fs"; - -test("should Download WebVTT ( file format)", async ({ page, browserName }) => { - test.slow(); - - await defaultBeforeEach(page, browserName); - await testMakeAReadAlong(page); - - await page.locator("#mat-select-value-3").click(); - await page.getByRole("option", { name: "WebVTT Subtitles" }).click(); - const download2Promise = page.waitForEvent("download"); - await page.getByTestId("download-ras").click(); - const download2 = await download2Promise; - await expect( - download2.suggestedFilename(), - "should have the expected filename", - ).toMatch(/readalong\.vtt/); - // check output - const filePath = await download2.path(); - const fileData = fs.readFileSync(filePath, { encoding: "utf8", flag: "r" }); - const refFileData = fs.readFileSync(`${testAssetsPath}/ref/readalong.vtt`, { - encoding: "utf8", - flag: "r", - }); - await expect( - replaceValuesWithZeroes(refFileData), - "file content should match reference data", - ).toMatch(replaceValuesWithZeroes(fileData.replace(/\r/g, ""))); -}); diff --git a/packages/studio-web/tests/studio-web/make-read-along.spec.ts b/packages/studio-web/tests/studio-web/make-read-along.spec.ts deleted file mode 100644 index aa0682d5..00000000 --- a/packages/studio-web/tests/studio-web/make-read-along.spec.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { test, expect } from "@playwright/test"; -import { - testText, - testMp3Path, - testAssetsPath, - defaultBeforeEach, -} from "../test-commands"; - -test("should make read along", async ({ page, browserName }) => { - test.slow(); - await defaultBeforeEach(page, browserName); - //fill in text and audio - await page.getByTestId("ras-text-input").fill(testText); - await expect(page.getByTestId("text-download-btn")).toBeVisible(); - await page - .getByTestId("audio-btn-group") - .getByRole("button", { name: "File" }) - .click(); - await page.getByTestId("ras-audio-fileselector").click(); - await page.getByTestId("ras-audio-fileselector").setInputFiles(testMp3Path); - await expect(page.getByLabel("Play")).toBeVisible(); - await expect(page.getByLabel("Audio save button")).toBeVisible(); - await expect(page.getByLabel("Delete")).toBeVisible(); - //create the readalong - await page.getByTestId("next-step").click(); - //edit the headers - await expect(page.getByTestId("ra-header")).toHaveValue("Title"); - await expect(page.getByTestId("ra-header")).toBeEditable(); - await page.getByTestId("ra-header").dblclick(); - await page.getByTestId("ra-header").fill("Sentence Paragraph Page"); - await expect(page.getByTestId("ra-header")).toHaveValue( - "Sentence Paragraph Page", - ); - await expect(page.getByTestId("ra-subheader")).toHaveValue("Subtitle"); - await expect(page.getByTestId("ra-subheader")).toBeEditable(); - await page.getByTestId("ra-subheader").click(); - await page.getByTestId("ra-subheader").dblclick(); - await page.getByTestId("ra-subheader").fill("by me"); - await expect(page.getByTestId("ra-subheader")).toHaveValue("by me"); - //add translations - await expect( - page.locator("#t0b0d0p0s0").getByLabel("Add translation"), - ).toBeVisible(); - await page.locator("#t0b0d0p0s0").getByRole("button").click(); - await expect( - page.locator("#t0b0d0p0s0").getByLabel("Remove translation"), - ).toBeVisible(); - await expect( - page.locator("#t0b0d0p0s0").getByLabel("Add translation"), - ).toBeHidden(); //check - await page.locator("#t0b0d0p0s1").getByRole("button").click(); - await page.locator("#t0b0d0p1s0").getByRole("button").click(); - //update translations - let translation = await page.locator("#t0b0d0p0s0translation"); - await translation.click(); - await expect(translation).toBeEditable(); - await translation.fill("Ceci est un test."); - - translation = await page.locator("#t0b0d0p0s1translation"); - await translation.click(); - await translation.fill("Phrase."); - - translation = await page.locator("#t0b0d0p1s0translation"); - await translation.click(); - await translation.fill("Paragraphe."); - await expect(page.locator(".editable__translation")).toHaveCount(3); - // delete a translation - await page.locator("#t0b0d0p0s1").getByRole("button").click(); - await expect(page.locator(".editable__translation")).toHaveCount(2); - await page.locator("#t0b0d0p1s0").getByRole("button").click(); - await expect(page.locator(".editable__translation").first()).toBeVisible(); - await page.getByTestId("translation-toggle").click(); - await expect(page.locator(".editable__translation").first()).toBeHidden(); - //upload a photo to page 1 - let fileChooserPromise = page.waitForEvent("filechooser"); - page.locator("#fileElem--t0b0d0").dispatchEvent("click"); - - let fileChooser = await fileChooserPromise; - fileChooser.setFiles(testAssetsPath + "page1.png"); - //delete the photo uploaded - await page.getByTestId("delete-button").click(); - await page.locator("#t0b0d0p0s0w0").click(); - //upload a photo to page 2 - fileChooserPromise = page.waitForEvent("filechooser"); - page.locator("#fileElem--t0b0d1").dispatchEvent("click"); - - fileChooser = await fileChooserPromise; - fileChooser.setFiles(testAssetsPath + "page2.png"); - await page.getByRole("tab", { name: "Editable Step" }).click(); -}); diff --git a/packages/studio-web/tests/test-cases.md b/packages/studio-web/tests/test-cases.md deleted file mode 100644 index b974b1ae..00000000 --- a/packages/studio-web/tests/test-cases.md +++ /dev/null @@ -1,318 +0,0 @@ -# Test cases for end-to-end testing of the ReadAlong Studio-Web Studio and Editor - -Global setting: make sure analytics is disable, stubbed out, or sent to a fake -server, so we don't generate bogus traffic. - -## Story 1: main walk through the Studio - -### Fill in Step 1 - -- Launch Studio. - - Expect it is loaded. -- Enter this text in the text box. - - This is a test. - Sentence. - - Paragraph. - - - Page. - -- Load this audio: `test-sentence-paragraph-page-56k.mp3`. -- Click on "Go to the next step!". - - Expect alignment to succeed, and step 2 to get displayed with the preview. - -### Edit the read along in Step 2 - -- Click on Title and type "Sentence Paragraph Page". -- Click on Subtitle and type "by me". -- Click in turn on the first and second "+" buttons and add translations "Ceci est un test." - and "Phrase.", respectively. -- Add translation "Paragraphe." to the 3rd sentence. -- Click "-" to delete the translation of the 2nd sentence, "Sentence." -- Click on the translation toggle. - - Expect all translations to be hidden. -- Click on the translation toggle again. - - Expect translations for the 1st and 3rd sentences to be visible. -- Click to add an image on page 1: add `page1.png` - - Expect the image is visible and the image delete button appears -- Click on Delete to remove the image - - Expect the option to choose a file is back -- Scroll to page two and add `page2.png`. - -### Download formats - -- Click on the download button - - Expect a file download to happen -- Let download1 = name of that downloaded file. - - Expect download1 matches RE `sentence-paragr-[0-9]*.html` - - TODO validate the contents, somehow -- Select Web Bundle output format -- Click on the download button - - Expect a file download to happen -- Let download2 = name of that downloaded zip file. - - - Expect download2 matches RE `sentence-paragr-[0-9]*.zip` - - Expect download2 contents to look like this: - - $ unzip -l sentence-paragr-20241023184608.zip - Archive: sentence-paragr-20241023184608.zip - Length Date Time Name - --------- ---------- ----- ---- - 0 2024-10-23 18:46 www/ - 0 2024-10-23 18:46 Offline-HTML/ - 0 2024-10-23 18:46 www/assets/ - 865623 2024-10-23 18:46 Offline-HTML/sentence-paragr-20241023184608.html - 26277 2024-10-23 18:46 www/assets/sentence-paragr-20241023184608.wav - 2023 2024-10-23 18:46 www/assets/image-sentence-paragr-20241023184608-1.png - 45 2024-10-23 18:46 www/sentence-paragr-20241023184608.txt - 1749 2024-10-23 18:46 www/assets/sentence-paragr-20241023184608.readalong - 1378 2024-10-23 18:46 www/index.html - 1750 2024-10-23 18:46 www/readme.txt - --------- ------- - 898845 10 files - - We can't check this exactly, but maybe all the filenames, and some contents: - - - `Offline-HTML/sentence-paragr-.html` is identical to download1. - - `www/assets/image-sentence-paragr--1.png` is identical to `page1.png`. - - `www/assets/sentence-paragr-.wav` is identical to `test-sentence-paragraph-page-56k.mp3`. - - `www/index.html` is identical to `ref/www/index.html` except for the - dates, and we'll want soft updating the version number so we don't have to - change the ref files for each version bump - - `www/readme.txt` is identical to `ref/www/readme.txt` modulo date and version number. - - `www/sentence-paragr-.txt` is identical to `ref/www/sentence-paragr-date.txt`. - - `www/assets/sentence-paragr-.readalong` is identical to - `ref/www/assets/sentence-paragr-date.readalong` modulo date (for the - .png file) and time= and dur= values for each word. And maybe get the - read-along version number from config and studio-cli version number too, - so the test doesn't fail whenever those get bumped. - -- For each of the other four download format: - - select it - - click download - - check the download contents against the matching file in `ref`. - - Note: those files are all called `readalong.`, should probably also be `-<date>.<ext>` (#366) - -## Story 2: main walk through the Editor - -### Load a readalong to edit - -- Launch the Editor -- load download1 from story 1 - - Expect the readalong shown - - Expect no image on page 1, an image on page 2 - - Expect translations for the 1st and 3rd sentence - - Expect no translation for the second sentence - -### edit images - -- add image `page1.png` to page 1 - - expect to see it -- remove the image on page 2 - - expect the add image button to be back on page 2 - -### edit translations - -- edit the translation of the first sentence to say "Un vrai test." -- click + to add translation "Phrase." to the second sentence -- click - to delete the translation of the third sentence - - Expect to see translations for the 1st and 2nd sentence but not the third -- click on translation toggle - - Expect translations to be hidden -- click on translation toggle - - Expect to see translations for the 1st and 2nd sentence but not the third - -### Change an alignment - -- click on "This" in the web-c preview - - Expect the audio playback cue to be betwee 0.7 s and 1.0 s in the web-c preview -- Drag the start of "This" to 0.5 s in the Audio Toolbar -- click on "This" in the web-c preview - - Expect the audio playback cue to be at 0.5 s in the web-c preview - -### Change a word - -- Before: - - Expect the second sentence's word in the web-c to read "Sentence" -- click on "Sentence" in the Audio Toolbar -- add an "s" at the end of the word so it spells "Sentences" - - Expect the second sentence's word in the web-c to read "Sentences" with an "s" added - -### Download the results - -- Select Web Bundle format -- Click download - - - Expect the .readalong file in the Zip file to match my hand-created `ref/sentence-paragr-edited.readalong` modulo dates. - - Expect the timing for "This" to be close to `time="0.50" dur="0.57"` (rather than the original `time="0.84" dur="0.23"`) - - Expect `<w id="t0b0d0p0s1w0"` to be spelled "Sentences" with an "s" - - Expect `<graphic url="image-sentence-paragr-20241023184608-0.png"/>` on `<div type="page" id="t0b0d0">` - - Expect no graphic element on `<div type="page" id="t0b0d1">` - - Expect translations on the first and second sentences - - Expect no translations on the 3rd and 4th sentences. - -- Select the Offline HTML format -- click download - - - Expect a .html file - -- Select each of the remaining four formats and download them - - Expect each to match the corresponding ref file in `ref/edited`. - - Specifically, in each format, check that - - "This" starts at 0.5s - - "Sentences" has been updated to take the plural "s". - -## Story 3: run the Tour - -### Take the tour from the top right through to the end - -- Launch the Studio -- click on "Take the Tour" - - expect it to start -- click next until "That's it!" is there -- click "Next (overwrites your data)" - - Expect Step 2 to load and the tour to continue -- click next until "Go to the Editor" is there -- click "Editor" (or "To the Editor" once #349 is merged) - - Expect the Editor to open and the tour to continue -- click "Next" until the last step, with "Close" -- click "Close" - - Expect to be in the Editor with the dummy "Hello world!" RA loaded. - -### Take the tour from the Editor - -- We are still in the Editor at this point. -- Click "Take the Tour". - - Expect the Editor tour to start. -- Click through the tour. - -## Story 4: Analytics - -Question: can we stub analytics? I'd like to detect that analytics work without -causing events to be send to Plausible. Maybe we can give it a bogus hostname -and track network traffic? We really don't want these tests to trigger traffic -on Plausible! - -### Turn analytics on and off - -- Launch Studio -- click on Privacy (will depend on screen size with #349) - - Expect the Privacy Policy to be displayed -- click on "Opt out of Analytics" if shown (i.e., unless "Opt in to Analytics" is shown) -- click on "I agree" -- Click Take the Tour - - Expect no event sent to analytics -- type Escape to exit the tour -- Reload the page - - - Expect no event sent to analytics - -- Opt in to analytics -- Click Take the Tour - - Expect a Tour event sent to analytics -- Reload the page - - - Expect a Studio event sent to analytics - -- Load text and audio as in Story 1 -- click "Go to the next step!" - - Expect step 2 to show - - Expect a CreateReadalong event sent to analytics -- click on the Download icon - - - Expect a Download event sent to analytics - -- click on "Step 1" - - Expect step 1 to be shown again -- opt out of analytics -- click on "Go to the next step!" - - Expect no event sent to analytics -- click on the Download icon - - Expect no event sent to analytics - -## Story 5: click around the Studio a lot - -- Load the Studio - -### Text entry - -- Click on "? Format" in Text entry - - Expect the "Here is how to format your plain text input text." modal to show -- click on Close -- click on "Go to the next step" - - Expect three error toasts, including "No text" -- Enter "Random Text" in the text box -- Click on "Save a copy" - - Expect a `ras-text-<date>.txt` file to be downloaded containing "Random Text" -- Click on File - - Expect the Choose file option to appear -- click on Choose file and select `ref/www/sentence-paragr-date.txt` - - Can't expect anything here: the contents never get shown in step 1 we should - probably fix that, somehow. - -### Audio - -- Expect to see only the "Record" button -- Click on File - - Expect the Choose File option -- choose `test-sentence-paragraph-page-56k.mp3` - - Expect the "Play", "Save a copy" and "Delete" buttons to be shown -- Click on Record - - Expect the "Delete and re-record", "Play", "Save a copy" and "Delete" buttons to be shown -- Click on Delete - - Expect to see only the "Record" button" -- click on Go to the next step! - - Expect two error toasts, including "No audio" -- click on File and reload the same audio file. - -### Language settings - -- Expect Default is selected -- Expect Select Language drop down to be shown but inactive -- click Select a specific language - - Expect Select Language drop down to be active -- click "Go the the next step!" - - Expect the "No language selected" error toast -- Select English - -### Go to step 2 - -- click on Go to the next step! - - - Expect the "Great!" success toast - - Expect step 2 to load - - Expect Title and Subtitle to be "Title" and "Subtitle" - -- Edit Title and Subtitle to "foo" and "bar" - -- click on Step 1 (top left) - - - Expect step 1 to display again with the same text file, audio file and English still selected - -- click on Step 2 (top right) - - - Expect step 2 to display, but no toast - - Expect Title and Subtitle to still be "foo" and "bar". - -## Story 6: click around the Editor - -- Load the Editor - -- Load download1 - -- In the Audio Toolbar, click on Zoom + twice - - - Expect a zoomed in view showing a shorter duration than the whole - -- click on the Zoom - five times (three times is enough on a large screen) - - Expect the zoomed out view with the whole text and no scrool bar anymore - -## Notes and Questions - -I assume the web-component testing already verifies play/pause/back 5 sec, -etc, so I'm not covering them here. - -Q: Does the web-c testing already test the gear menu for setting My Preferences? -That also doesn't really belong here, but needs to happen somewhere. diff --git a/packages/studio-web/tests/test-commands.ts b/packages/studio-web/tests/test-commands.ts deleted file mode 100644 index d59cf44c..00000000 --- a/packages/studio-web/tests/test-commands.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { test, expect, Page } from "@playwright/test"; -import process from "process"; - -export const testAssetsPath = process.cwd().includes("packages") - ? "tests/fixtures/" // for nx - : "packages/studio-web/tests/fixtures/"; //for vscode -export const testText = `This is a test. -Sentence. - -Paragraph. - - -Page.`; -export const testMp3Path = - testAssetsPath + "test-sentence-paragraph-page-56k.mp3"; -/** - * Steps to recreate a readalong for tests - */ -export const testMakeAReadAlong = async (page: Page) => { - await test.step("generate the readalong", async () => { - await page.getByTestId("ras-text-input").fill(testText); - - await page - .getByTestId("audio-btn-group") - .getByRole("button", { name: "File" }) - .click(); - await page.getByTestId("ras-audio-fileselector").click({ force: true }); - await page.getByTestId("ras-audio-fileselector").setInputFiles(testMp3Path); - await expect(async () => { - await expect( - page.getByTestId("next-step"), - "model is loaded", - ).not.toBeDisabled(); - - //create the readalong - await page.getByTestId("next-step").click(); - }).toPass(); - - //wait for edit page to load - await expect(async () => { - await expect(page.getByTestId("ra-header")).toBeVisible({ - timeout: 0, - }); - await expect(page.getByTestId("ra-header")).toBeEditable(); - //edit the headers - - await page - .getByTestId("ra-header") - .fill("Sentence Paragraph Page", { force: true }); - - await expect(page.getByTestId("ra-header")).toHaveValue( - "Sentence Paragraph Page", - ); - }).toPass(); - - await page - .getByTestId("ra-subheader") - .fill("by me", { force: true, timeout: 0 }); - await expect(page.getByTestId("ra-subheader")).toHaveValue("by me"); - //add translations - - await page - .locator("#t0b0d0p0s0") - .getByRole("button") - .click({ force: true, timeout: 0 }); - - await page - .locator("#t0b0d0p0s1") - .getByRole("button") - .click({ force: true, timeout: 0 }); - await page - .locator("#t0b0d0p1s0") - .getByRole("button") - .click({ force: true, timeout: 0 }); - //update translations - await expect(page.locator("#t0b0d0p0s0translation")).toBeEditable(); - await page - .locator("#t0b0d0p0s0translation") - .fill("Ceci est un test.", { force: true, timeout: 0 }); - await expect(page.locator("#t0b0d0p0s1translation")).toBeEditable(); - await page - .locator("#t0b0d0p0s1translation") - .fill("Phrase.", { force: true, timeout: 0 }); - await expect(page.locator("#t0b0d0p1s0translation")).toBeEditable(); - await page - .locator("#t0b0d0p1s0translation") - .fill("Paragraphe.", { force: true, timeout: 0 }); - - //upload a photo to page 1 - let fileChooserPromise = page.waitForEvent("filechooser"); - page.locator("#fileElem--t0b0d0").dispatchEvent("click"); - - let fileChooser = await fileChooserPromise; - fileChooser.setFiles(testAssetsPath + "page1.png"); - - await page.locator("#t0b0d0p0s0w0").dispatchEvent("click"); - //upload a photo to page 2 - fileChooserPromise = page.waitForEvent("filechooser"); - page.locator("#fileElem--t0b0d1").dispatchEvent("click"); - fileChooser = await fileChooserPromise; - fileChooser.setFiles(testAssetsPath + "page2.png"); - await expect(async () => { - await expect(page.locator("div.toast-message")).not.toBeVisible(); - }).toPass(); - }); -}; - -/* default before each */ -export const defaultBeforeEach = async (page: Page, browserName: string) => { - test.step("setup test", async () => { - test.skip( - browserName === "webkit", - "The aligner feature is not stable for webkit", - ); - - await page.goto("/", { waitUntil: "load" }); - await expect( - page.getByTestId("next-step"), - "Soundswallower model has loaded", - ).not.toBeDisabled(); - }); -}; - -/** - * @param text:string - * @return text:string - * Timestamps generated by alignment can be off by a couple of microseconds. - * The point of the test is check format not the values generated, - * therefore we zero the values to restrict the comparison to format checking - */ -export const replaceValuesWithZeroes = (text: string): string => { - return text.replace(/\d/g, "0"); -}; diff --git a/packages/web-component/src/components/read-along-component/read-along.tsx b/packages/web-component/src/components/read-along-component/read-along.tsx index 8aa1f0f0..13139d8e 100644 --- a/packages/web-component/src/components/read-along-component/read-along.tsx +++ b/packages/web-component/src/components/read-along-component/read-along.tsx @@ -1603,7 +1603,6 @@ export class ReadAlongComponent { attributes: NamedNodeMap; }): Element => ( <div - {...props.attributes} class={ "paragraph sentence__container theme--" + this.theme + @@ -1640,7 +1639,7 @@ export class ReadAlongComponent { } let nodeProps = {}; //attributes of sentence you want to retain - for (const attr of ["annotation-id", "do-not-align", "lang", "id"]) { + for (const attr of ["annotation-id", "do-not-align", "lang"]) { if (props.sentenceData.hasAttribute(attr)) { nodeProps[attr] = props.sentenceData.getAttribute(attr); }