Skip to content

Commit

Permalink
test: now waiting for soundswallower model to load before test begins
Browse files Browse the repository at this point in the history
  • Loading branch information
deltork committed Nov 22, 2024
1 parent 706439d commit 4b0f50a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
9 changes: 5 additions & 4 deletions packages/studio-web/tests/studio-web/download-praat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ test("should Download Praat ( file format)", async ({ page, browserName }) => {
download2.suggestedFilename(),
"should have the expected filename",
).toMatch(/readalong\.textgrid/);
/* TODO: figure out spacing issue
/* 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(fileData, "file content should match reference data").toEqual(
refFileData,
);*/
await expect(
fileData.replace(/\r/g, ""),
"file content should match reference data",
).toEqual(refFileData);
});
9 changes: 5 additions & 4 deletions packages/studio-web/tests/studio-web/download-srt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ test("should Download SRT ( file format)", async ({ page, browserName }) => {
download2.suggestedFilename(),
"should have the expected filename",
).toMatch(/readalong\.srt/);
/* TODO: figure out spacing issue
/* 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`, {
encoding: "utf8",
flag: "r",
});
await expect(fileData, "file content should match reference data").toEqual(
refFileData,
);*/
await expect(
fileData.replace(/\r/g, ""),
"file content should match reference data",
).toEqual(refFileData);
});
13 changes: 8 additions & 5 deletions packages/studio-web/tests/studio-web/download-webvtt.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { test, expect } from "@playwright/test";

Check failure on line 1 in packages/studio-web/tests/studio-web/download-webvtt.spec.ts

View workflow job for this annotation

GitHub Actions / Merge playwright reports

[chromium] › studio-web/download-webvtt.spec.ts:9:1 › should Download WebVTT ( file format)

4) [chromium] › studio-web/download-webvtt.spec.ts:9:1 › should Download WebVTT ( file format) › generate the readalong Test timeout of 360000ms exceeded.
import { testMakeAReadAlong, defaultBeforeEach } from "../test-commands";
import {
testMakeAReadAlong,
defaultBeforeEach,
testAssetsPath,
} from "../test-commands";
import fs from "fs";

test("should Download WebVTT ( file format)", async ({ page, browserName }) => {
Expand All @@ -17,15 +21,14 @@ test("should Download WebVTT ( file format)", async ({ page, browserName }) => {
download2.suggestedFilename(),
"should have the expected filename",
).toMatch(/readalong\.vtt/);

/* TODO: figure out spacing issue
// 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(refFileData, "file content should match reference data").toMatch(
fileData,
);*/
fileData.replace(/\r/g, ""),
);
});
10 changes: 5 additions & 5 deletions packages/studio-web/tests/test-commands.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { test, expect, Page } from "@playwright/test";
import process from "process";
//for vscode
//export const testAssetsPath = "packages/studio-web/tests/fixtures/";
//for nx

export const testAssetsPath = process.cwd().includes("packages")
? "tests/fixtures/"
: "packages/studio-web/tests/fixtures/";
? "tests/fixtures/" // for nx
: "packages/studio-web/tests/fixtures/"; //for vscode
export const testText = `This is a test.
Sentence.
Expand Down Expand Up @@ -106,7 +104,9 @@ export const defaultBeforeEach = async (page: Page, browserName: string) => {
"The aligner feature is not stable for webkit",
);
//await page.coverage.startJSCoverage();
const waitForSoundSwallowerModel = page.waitForRequest(/noisedict\.txt/);
await page.goto("/");
await waitForSoundSwallowerModel;
});
};

Expand Down

0 comments on commit 4b0f50a

Please sign in to comment.