diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index c273fe85..8f58ac80 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -21,22 +21,7 @@ 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: Commit browserslist db changes on dev branches - # if: ${{ github.ref_type == 'branch' && ! github.ref_protected }} - # run: | - # if git diff --exit-code package-lock.json; then - # echo "The browserslist db is up to date." - # else - # echo "The browserslist db is out of date." - # git config --global user.email "github-actions[bot]@users.noreply.github.com" - # git config --global user.name "github-actions[bot]" - # git add package-lock.json - # git commit -m "chore: update browserslist db" - # git push - # fi + - name: Ng test for studio-web run: | npx nx build web-component diff --git a/package-lock.json b/package-lock.json index 0e10c300..744c510c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "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", @@ -74,6 +75,7 @@ "prettier": "^3.2.5", "pretty-quick": "^4.0.0", "ts-jest": "^29", + "ts-node": "^10.9.2", "tsx": "^4.7.3" } }, @@ -6549,6 +6551,50 @@ "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", @@ -11104,9 +11150,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001680", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz", - "integrity": "sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA==", + "version": "1.0.30001687", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz", + "integrity": "sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==", "dev": true, "funding": [ { @@ -23496,6 +23542,10 @@ "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", @@ -25426,10 +25476,11 @@ } }, "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==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, + "license": "MIT", "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -27674,7 +27725,10 @@ }, "packages/studio-web": { "name": "readalong-studio", - "version": "0.0.0" + "version": "0.0.0", + "dependencies": { + "readalong-studio": "file:" + } }, "packages/web-component": { "name": "@readalongs/web-component", diff --git a/package.json b/package.json index 0746f4df..5e677f4c 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "@angular/localize": "^17", "@commitlint/cli": "^19.2.1", "@commitlint/config-conventional": "^19.1.0", - "@istanbuljs/nyc-config-typescript": "^1.0.2", "@nx/angular": "18.3.4", "@nx/eslint": "18.3.4", "@nx/eslint-plugin": "18.3.4", @@ -42,14 +41,11 @@ "karma-jasmine-html-reporter": "^2.1.0", "ng-packagr": "^17", "nx": "18.3.4", - "nyc": "^17.1.0", "prettier": "^3.2.5", "pretty-quick": "^4.0.0", - "source-map-support": "^0.5.21", "ts-jest": "^29", "ts-node": "^10.9.2", - "tsx": "^4.7.3", - "v8-to-istanbul": "^9.3.0" + "tsx": "^4.7.3" }, "dependencies": { "@angular/animations": "^17", @@ -68,6 +64,7 @@ "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/.gitignore b/packages/studio-web/.gitignore index 1fcc35e2..9ed39a75 100644 --- a/packages/studio-web/.gitignore +++ b/packages/studio-web/.gitignore @@ -35,4 +35,3 @@ e2e/*.map # End of https://www.toptal.com/developers/gitignore/api/angular *~ -.nyc_output diff --git a/packages/studio-web/.nycrc b/packages/studio-web/.nycrc deleted file mode 100644 index 21348854..00000000 --- a/packages/studio-web/.nycrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "@istanbuljs/nyc-config-typescript", - "all": false, - "include": ["src/app/*.ts"], - "exclude": [ - "**/*spec.ts", - "**/*config.ts", - "**/*lang.ts", - "src/@types/audio-recorder-polyfill/mpeg-encoder/index.d.ts" - ], - "reporter": ["html", "text-summary"], - "sourceMap": true, - "instrument": true, - "require": ["ts-node/register"] -} diff --git a/packages/studio-web/package.json b/packages/studio-web/package.json index c2163300..d098d9d2 100644 --- a/packages/studio-web/package.json +++ b/packages/studio-web/package.json @@ -11,10 +11,12 @@ "test:ng": "ng test", "test:once": "ng test --watch=false --browsers ChromeHeadlessCI", "e2e": "playwright test", - "nyc": "nyc --reporter=html --reporter=text-summary playwright test ", "e2e-ui": "playwright test --ui" }, "private": true, "singleFileBundleVersion": "1.5.2", - "singleFileBundleTimestamp": "2024-11-18+11-19-49" + "singleFileBundleTimestamp": "2024-11-18+11-19-49", + "dependencies": { + "readalong-studio": "file:" + } } diff --git a/packages/studio-web/playwright.config.ts b/packages/studio-web/playwright.config.ts index 7dd643e7..018a480f 100644 --- a/packages/studio-web/playwright.config.ts +++ b/packages/studio-web/playwright.config.ts @@ -12,7 +12,7 @@ import { defineConfig, devices } from "@playwright/test"; * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ - timeout: 2 * 60 * 1000, + timeout: (process.env.CI ? 25 : 50) * 1000, testDir: "./tests", /* Run tests in files in parallel */ fullyParallel: true, @@ -59,20 +59,21 @@ export default defineConfig({ use: { ...devices["Desktop Firefox"] }, }, /* We do not have full webkit support - { - name: "webkit", - use: { ...devices["Desktop Safari"] }, - }, + { + name: "webkit", + use: { ...devices["Desktop Safari"] }, + }, - /* Test against mobile viewports. */ + /* Test against mobile viewports. */ { name: "Mobile Chrome", use: { ...devices["Pixel 5"] }, }, - /*{ - name: "Mobile Safari", - use: { ...devices["iPhone 12"] }, - }, + /* + { + name: "Mobile Safari", + use: { ...devices["iPhone 12"] }, + }, /* Test against branded browsers. */ // { diff --git a/packages/studio-web/tests/studio-web/download-srt.spec.ts b/packages/studio-web/tests/studio-web/download-srt.spec.ts index 806d40f2..d4b71058 100644 --- a/packages/studio-web/tests/studio-web/download-srt.spec.ts +++ b/packages/studio-web/tests/studio-web/download-srt.spec.ts @@ -19,7 +19,7 @@ test("should Download SRT ( file format)", async ({ page, browserName }) => { download2.suggestedFilename(), "should have the expected filename", ).toMatch(/readalong\.srt/); - /* TODO: figure out spacing issue*/ + const filePath = await download2.path(); const fileData = fs.readFileSync(filePath, { encoding: "utf8", flag: "r" }); const refFileData = fs.readFileSync(`${testAssetsPath}/ref/readalong.srt`, { diff --git a/packages/studio-web/tests/test-commands.ts b/packages/studio-web/tests/test-commands.ts index 91ee380e..20c9daf6 100644 --- a/packages/studio-web/tests/test-commands.ts +++ b/packages/studio-web/tests/test-commands.ts @@ -56,7 +56,7 @@ export const testMakeAReadAlong = async (page: Page) => { 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 @@ -73,15 +73,15 @@ export const testMakeAReadAlong = async (page: Page) => { .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 }); @@ -99,6 +99,9 @@ export const testMakeAReadAlong = async (page: Page) => { 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(); }); }; @@ -109,7 +112,6 @@ export const defaultBeforeEach = async (page: Page, browserName: string) => { browserName === "webkit", "The aligner feature is not stable for webkit", ); - //await page.coverage.startJSCoverage(); await page.goto("/", { waitUntil: "load" }); await expect( @@ -118,15 +120,3 @@ export const defaultBeforeEach = async (page: Page, browserName: string) => { ).not.toBeDisabled(); }); }; - -/*test.afterEach(async ({ page }) => { - const coverage = await page.coverage.stopJSCoverage(); - for (const entry of coverage) { - if (entry.source) { - const converter = v8toIstanbul("", 0, { source: entry.source }); - await converter.load(); - converter.applyCoverage(entry.functions); - console.log(JSON.stringify(converter.toIstanbul())); - } - } - });*/