alessandro trinca tornidor commited on
Commit
03112f1
·
1 Parent(s): 38f204d

test: update e2e playwright test

Browse files
static/tests/test-app-7860-example-medium0-upload-de.spec.ts CHANGED
@@ -17,7 +17,8 @@ test("test: get a phonetic accuracy evaluation from an uploaded audio file.", as
17
 
18
  await page.goto('http://localhost:7860/');
19
 
20
- const accordionExamples = page.getByText('Click here to expand the table examples ▼ Examples Learner Transcription');
 
21
  accordionExamples.click();
22
  const exampleMediumFirst = page.getByRole('gridcell', { name: 'medium' }).first();
23
  await exampleMediumFirst.click();
 
17
 
18
  await page.goto('http://localhost:7860/');
19
 
20
+ const accordionExamples = page.getByText('Click here to expand the table examples');
21
+ accordionExamples.click();
22
  accordionExamples.click();
23
  const exampleMediumFirst = page.getByRole('gridcell', { name: 'medium' }).first();
24
  await exampleMediumFirst.click();
static/tests/test-app-7860-example-medium0-upload-en.spec.ts CHANGED
@@ -17,7 +17,8 @@ test("test: get a phonetic accuracy evaluation from an uploaded audio file.", as
17
 
18
  await page.goto('http://localhost:7860/');
19
 
20
- const accordionExamples = page.getByText('Click here to expand the table examples ▼ Examples Learner Transcription');
 
21
  accordionExamples.click();
22
  const exampleMediumFirst = page.getByRole('gridcell', { name: 'medium' }).nth(1);
23
  await exampleMediumFirst.click();
 
17
 
18
  await page.goto('http://localhost:7860/');
19
 
20
+ const accordionExamples = page.getByText('Click here to expand the table examples');
21
+ accordionExamples.click();
22
  accordionExamples.click();
23
  const exampleMediumFirst = page.getByRole('gridcell', { name: 'medium' }).nth(1);
24
  await exampleMediumFirst.click();
static/tests/test-app-7860-random-upload-de.spec.ts CHANGED
@@ -18,20 +18,20 @@ test("test: get a phonetic accuracy evaluation from an uploaded audio file.", as
18
  await page.goto('http://localhost:7860/');
19
  await page.waitForSelector("textarea")
20
 
21
- const textboxLearnerTranscriptionInput = page.getByLabel("Learner Transcription");
22
- let learnerTranscriptionScreenshot0 = await textboxLearnerTranscriptionInput.screenshot()
23
 
24
  const buttonRandom = page.getByRole('button', { name: 'Choose a random phrase' });
25
  await buttonRandom.click();
26
  await page.waitForTimeout(300);
27
- let learnerTranscriptionScreenshot1 = await textboxLearnerTranscriptionInput.screenshot();
28
 
29
  // find a way to measure how much the screenshots differ
30
- // assert that the Learner Transcription screenshots (converted both to base64 strings) changed
31
  expect(
32
- learnerTranscriptionScreenshot0.toString('base64')
33
  ).not.toEqual(
34
- learnerTranscriptionScreenshot1.toString('base64')
35
  )
36
 
37
  await page.getByRole('button', { name: 'TTS backend', exact: true }).click();
 
18
  await page.goto('http://localhost:7860/');
19
  await page.waitForSelector("textarea")
20
 
21
+ const textboxStudentTranscriptionInput = page.getByLabel("Phrase to read for speech recognition");
22
+ let studentTranscriptionScreenshot0 = await textboxStudentTranscriptionInput.screenshot()
23
 
24
  const buttonRandom = page.getByRole('button', { name: 'Choose a random phrase' });
25
  await buttonRandom.click();
26
  await page.waitForTimeout(300);
27
+ let studentTranscriptionScreenshot1 = await textboxStudentTranscriptionInput.screenshot();
28
 
29
  // find a way to measure how much the screenshots differ
30
+ // assert that the Phrase to read for speech recognition screenshots (converted both to base64 strings) changed
31
  expect(
32
+ studentTranscriptionScreenshot0.toString('base64')
33
  ).not.toEqual(
34
+ studentTranscriptionScreenshot1.toString('base64')
35
  )
36
 
37
  await page.getByRole('button', { name: 'TTS backend', exact: true }).click();
static/tests/test-app-7860-random-upload-en.spec.ts CHANGED
@@ -18,20 +18,20 @@ test("test: get a phonetic accuracy evaluation from an uploaded audio file.", as
18
  await page.goto('http://localhost:7860/');
19
  await page.waitForSelector("textarea")
20
 
21
- const textboxLearnerTranscriptionInput = page.getByLabel("Learner Transcription");
22
- let learnerTranscriptionScreenshot0 = await textboxLearnerTranscriptionInput.screenshot()
23
 
24
  const buttonRandom = page.getByRole('button', { name: 'Choose a random phrase' });
25
  await buttonRandom.click();
26
  await page.waitForTimeout(300);
27
- let learnerTranscriptionScreenshot1 = await textboxLearnerTranscriptionInput.screenshot();
28
 
29
  // find a way to measure how much the screenshots differ
30
- // assert that the Learner Transcription screenshots (converted both to base64 strings) changed
31
  expect(
32
- learnerTranscriptionScreenshot0.toString('base64')
33
  ).not.toEqual(
34
- learnerTranscriptionScreenshot1.toString('base64')
35
  )
36
 
37
  await page.getByRole('button', { name: 'TTS backend', exact: true }).click();
 
18
  await page.goto('http://localhost:7860/');
19
  await page.waitForSelector("textarea")
20
 
21
+ const textboxStudentTranscriptionInput = page.getByLabel("Phrase to read for speech recognition");
22
+ let studentTranscriptionScreenshot0 = await textboxStudentTranscriptionInput.screenshot()
23
 
24
  const buttonRandom = page.getByRole('button', { name: 'Choose a random phrase' });
25
  await buttonRandom.click();
26
  await page.waitForTimeout(300);
27
+ let studentTranscriptionScreenshot1 = await textboxStudentTranscriptionInput.screenshot();
28
 
29
  // find a way to measure how much the screenshots differ
30
+ // assert that the Phrase to read for speech recognition screenshots (converted both to base64 strings) changed
31
  expect(
32
+ studentTranscriptionScreenshot0.toString('base64')
33
  ).not.toEqual(
34
+ studentTranscriptionScreenshot1.toString('base64')
35
  )
36
 
37
  await page.getByRole('button', { name: 'TTS backend', exact: true }).click();
static/tests/test-app-7860-upload-de.spec.ts CHANGED
@@ -20,8 +20,8 @@ test("test: get a phonetic accuracy evaluation from an uploaded audio file.", as
20
  const radioLanguageSelectedDE = page.getByRole('radio', { name: 'de' })
21
  await radioLanguageSelectedDE.check();
22
 
23
- const textboxLearnerTranscriptionInput = page.getByLabel('Learner Transcription')
24
- await textboxLearnerTranscriptionInput.fill('Ich bin Alex, wer bist du?');
25
 
26
  await page.getByRole('button', { name: 'TTS backend', exact: true }).click();
27
  const buttonPlay = page.getByLabel('Play', { exact: true })
 
20
  const radioLanguageSelectedDE = page.getByRole('radio', { name: 'de' })
21
  await radioLanguageSelectedDE.check();
22
 
23
+ const textboxStudentTranscriptionInput = page.getByLabel('Phrase to read for speech recognition')
24
+ await textboxStudentTranscriptionInput.fill('Ich bin Alex, wer bist du?');
25
 
26
  await page.getByRole('button', { name: 'TTS backend', exact: true }).click();
27
  const buttonPlay = page.getByLabel('Play', { exact: true })
static/tests/test-webApp-3000.spec.ts CHANGED
@@ -30,7 +30,7 @@ test("test: get a custom sample writing within the input field.", async () => {
30
  page.getByText("/ hiː toːm, hoː aːrɛː yːuː? /")
31
  ).toBeVisible();
32
  await expect(textDescription).toBeHidden();
33
- await expect(page).toHaveScreenshot();
34
 
35
  console.log("end");
36
  await page.close();
 
30
  page.getByText("/ hiː toːm, hoː aːrɛː yːuː? /")
31
  ).toBeVisible();
32
  await expect(textDescription).toBeHidden();
33
+ await expect(page).toHaveScreenshot({threshold: 0.1});
34
 
35
  console.log("end");
36
  await page.close();