fix(app): Fixed some broken e2e tests after merging

This commit is contained in:
Quinton den Haan 2024-06-21 15:13:21 +02:00
parent 7e1561c5c4
commit ecd259bd2a
12 changed files with 90 additions and 60 deletions

1
.gitignore vendored
View file

@ -2,4 +2,5 @@
kernel/.coverage
app/.pnpm-store
data/*
.nyc_output

View file

@ -12,7 +12,7 @@ test.beforeEach(async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('link', { name: 'Sample Session sample-session' }).click();
});
@ -46,18 +46,19 @@ test('file management test', async ({ page }) => {
await page.getByRole('textbox').click();
await page
.getByRole('textbox')
.setInputFiles('./static/samples/torgo-dataset/MC02_control_head_sentence1.wav');
.setInputFiles('./app/static/samples/torgo-dataset/MC02_control_head_sentence1.wav');
await expect(page.getByRole('button', { name: 'MC02_control_head_sentence1.' })).toBeVisible();
await expect(page.getByRole('button', { name: 'sample' })).toBeVisible();
await page
.locator('div')
.filter({ hasText: /^sample \+$/ })
.getByRole('button')
.nth(1)
.click();
await page.locator('.ml-auto').first().click();
await expect(page.getByLabel('Are you absolutely sure?')).toBeVisible();
await expect(page.getByLabel('Are you absolutely sure?')).toContainText(
'This action cannot be undone. This will permanently delete this pane and the analysis conducted in it.'
);
await page.getByRole('button', { name: 'Continue' }).click();
await expect(page.getByRole('button', { name: 'sample' })).toHaveCount(0);
await page.getByRole('button', { name: 'New tab' }).click();
await expect(page.getByRole('button', { name: 'New Tab' })).toBeVisible();
await expect(page.getByText('Drag a file from the file')).toBeVisible();
});
//Please use chromium (firefox is used as standard) to run this test as Firefox does not support "microphone" permission

View file

@ -12,7 +12,7 @@ test.beforeEach(async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('link', { name: 'Sample Session sample-session' }).click();
});
@ -21,19 +21,23 @@ test.afterEach(deleteEverything);
test('error rate test', async ({ page }) => {
await page.locator('div:nth-child(2) > .inline-flex').hover();
await page.locator('div:nth-child(5) > .inline-flex').click();
await page.getByText('empty').nth(1).click();
await page.getByText('no model').nth(1).click();
await page.getByRole('option', { name: 'deepgram' }).click();
await page.getByRole('button', { name: 'Create New Track' }).nth(1).click();
await page.waitForTimeout(6000);
await page.getByText('deepgram Create New Track').getByRole('combobox').click();
await page.waitForTimeout(4000);
await page.getByRole('option', { name: 'whisper' }).click();
await page.getByRole('option', { name: 'whisper', exact: true }).click();
await page.getByRole('button', { name: 'Create New Track' }).nth(1).click();
await page.waitForTimeout(5000);
await page.getByRole('button', { name: 'brown' }).nth(1).click({
clickCount: 3
});
await page.getByRole('button', { name: 'brown' }).nth(1).fill('red');
await page.getByRole('button', { name: 'brown' }).nth(1).click({
clickCount: 3
});
await page.getByRole('button', { name: 'brown' }).nth(1).fill('red');
await page.getByRole('button', { name: 'fox' }).nth(1).click({
clickCount: 3
});
@ -52,7 +56,7 @@ test('error rate test', async ({ page }) => {
await expect(page.getByText('Reference track').nth(1)).toBeVisible();
await expect(page.getByText('Hypothesis track').nth(1)).toBeVisible();
await expect(
page.getByRole('heading', { name: 'This file has no ground truth.' }).nth(1)
page.getByRole('heading', { name: 'Select a non-empty track for' }).nth(1)
).toBeVisible();
await page.getByRole('combobox').nth(2).click();
await page.waitForTimeout(500);
@ -67,7 +71,8 @@ test('error rate test', async ({ page }) => {
await expect(page.getByRole('group')).toContainText(
'WER: 55.56% MER: 55.56% WIL: 80.25% WIP: 19.75%'
);
await expect(page.getByRole('group')).toContainText('BERT: 0.74 Jaro Winkler: 0.84');
await expect(page.getByRole('group')).toContainText('BERT: 0.74');
await expect(page.getByRole('group')).toContainText('Jaro Winkler: 0.84');
await expect(page.getByText('hits: 4')).toBeVisible();
await expect(page.getByText('substitutions: 5')).toBeVisible();
await expect(page.getByRole('heading', { name: 'the   quick   brown fox jumps' })).toBeVisible();

View file

@ -12,13 +12,14 @@ test.beforeEach(async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('link', { name: 'Sample Session sample-session' }).click();
});
test.afterEach(deleteEverything);
test('simple info test', async ({ page }) => {
await page.waitForTimeout(1000);
await page.locator('div:nth-child(2) > .inline-flex').hover();
await page.locator('.select > .inline-flex').first().click();
await expect(
@ -30,9 +31,10 @@ test('simple info test', async ({ page }) => {
.getByRole('button', { name: 'MC02_control_head_sentence1' })
.dragTo(
page.getByText(
'simple-info waveform spectrogram vowel-space transcription error-rate 00.511.'
'00.511.522.533.544.5 00:00.000/00:04.800 1.00x F01_severe_head_sentence1 00.511'
)
);
await page.waitForTimeout(1000);
await page.locator('div:nth-child(2) > .inline-flex').hover();
await page.locator('.select > .inline-flex').first().click();
await expect(
@ -45,6 +47,7 @@ test('simple info test', async ({ page }) => {
});
test('frame info test', async ({ page }) => {
await page.waitForTimeout(1000);
await page.locator('div:nth-child(2) > .inline-flex').hover();
await page.locator('.select > .inline-flex').first().click();
await expect(page.getByText('Select a frame in the').first()).toBeVisible();
@ -54,6 +57,7 @@ test('frame info test', async ({ page }) => {
await page.mouse.down();
await page.mouse.move(500, 0);
await page.mouse.up();
await page.waitForTimeout(1000);
await expect(page.locator('div:nth-child(4) > div')).toBeVisible();
await page.locator('div:nth-child(2) > .inline-flex').hover();
await page.locator('.select > .inline-flex').first().click();

View file

@ -12,7 +12,7 @@ test.beforeEach(async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('link', { name: 'Sample Session sample-session' }).click();
});
@ -58,5 +58,5 @@ test('playback test', async ({ page }) => {
await page.waitForTimeout(3200);
await expect(page.getByText('00:00.000/00:04.800')).toHaveCount(0);
await page.locator('.wrapper > div:nth-child(5)').first().click();
await expect(page.getByRole('group')).toContainText('00:02.398/00:04.800');
await expect(page.getByRole('group')).toContainText('00:02.396/00:04.800');
});

View file

@ -12,7 +12,7 @@ test.beforeEach(async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('link', { name: 'Sample Session sample-session' }).click();
});
@ -21,7 +21,11 @@ test.afterEach(deleteEverything);
test('download textgrid test', async ({ page }) => {
await page.locator('div:nth-child(2) > .inline-flex').hover();
await page.locator('div:nth-child(5) > .inline-flex').click();
await page.getByText('empty Create New Track').nth(1).getByRole('combobox').click();
await page
.getByText('Select transcription model: no model Create New Track')
.nth(1)
.getByRole('combobox')
.click();
await page.waitForTimeout(500);
await page.getByRole('option', { name: 'deepgram' }).click();
await page.getByRole('button', { name: 'Create New Track' }).nth(1).click();
@ -35,20 +39,27 @@ test('download textgrid test', async ({ page }) => {
.nth(2)
.click();
const download = await downloadPromise;
await expect(download.suggestedFilename()).toBe('transcription.TextGrid');
await expect(download.suggestedFilename()).toBe('F03_moderate_head_sentence1.TextGrid');
});
test('split test', async ({ page }) => {
await page.locator('div:nth-child(2) > .inline-flex').hover();
await page.locator('div:nth-child(5) > .inline-flex').click();
await page.getByText('empty Create New Track').nth(1).getByRole('combobox').click();
await page
.getByText('Select transcription model: no model Create New Track')
.nth(1)
.getByRole('combobox')
.click();
await page.waitForTimeout(500);
await page.getByRole('option', { name: 'deepgram' }).click();
await page.getByRole('button', { name: 'Create New Track' }).nth(1).click();
await page.waitForTimeout(2000);
await page.getByRole('button', { name: 'quick' }).click({
modifiers: ['Shift']
});
await page
.getByRole('button', { name: 'quick' })
.first()
.click({
modifiers: ['Shift']
});
await page.locator('div:nth-child(7) > .flex').dblclick();
await page.keyboard.press('h');
await page.keyboard.press('a');
@ -58,7 +69,7 @@ test('split test', async ({ page }) => {
await page.keyboard.press('Enter');
await expect(
page.getByRole('group').locator('div').filter({ hasText: 'the quick brown fox jumps' }).nth(1)
).toHaveCount(0);
).toHaveCount(1);
await expect(
page.getByRole('group').locator('div').filter({ hasText: 'the quick happy fox jumps' }).nth(1)
).toBeVisible();
@ -67,13 +78,22 @@ test('split test', async ({ page }) => {
test('track test', async ({ page }) => {
await page.locator('div:nth-child(2) > .inline-flex').hover();
await page.locator('div:nth-child(5) > .inline-flex').click();
await expect(page.getByText('empty').first()).toBeVisible();
await expect(page.getByText('Select transcription model:').first()).toBeVisible();
await expect(page.getByText('no model').first()).toBeVisible();
await expect(page.getByRole('button', { name: 'Create New Track' }).first()).toBeVisible();
await expect(
page.getByText('empty Create New Track').first().getByRole('button').nth(1)
page
.getByText('Select transcription model: no model Create New Track')
.first()
.getByRole('button')
.nth(1)
).toBeVisible();
await expect(page.getByText(':00.000/00:04.800 F01_severe_head_sentence1')).toBeVisible();
await page.getByText('empty Create New Track').nth(1).getByRole('combobox').click();
await page
.getByText('Select transcription model: no model Create New Track')
.nth(1)
.getByRole('combobox')
.click();
await page.getByRole('option', { name: 'deepgram' }).click();
await page.getByRole('button', { name: 'Create New Track' }).nth(1).click();
await page.waitForTimeout(6000);

View file

@ -12,7 +12,7 @@ test.beforeEach(async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('link', { name: 'Sample Session sample-session' }).click();
});

View file

@ -12,7 +12,7 @@ test.beforeEach(async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await page.getByRole('link', { name: 'Sample Session sample-session' }).click();
});
@ -46,11 +46,7 @@ test('playback test', async ({ page }) => {
).toHaveCount(0);
await page
.getByRole('button', { name: 'MC02_control_head_sentence1' })
.dragTo(
page.getByText(
'simple-info waveform spectrogram vowel-space transcription error-rate 00.511.'
)
);
.dragTo(page.locator('canvas').nth(2));
await expect(
page
.getByRole('group')

View file

@ -12,7 +12,7 @@ test.beforeEach(async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
});
test.afterEach(deleteEverything);
@ -23,7 +23,7 @@ test.afterEach(deleteEverything);
test('multi-take test', async ({ page, browser }) => {
await page.waitForTimeout(1000);
await page.getByRole('textbox').click();
await page.getByRole('textbox').setInputFiles('./static/samples/prompts/text-7.txt');
await page.getByRole('textbox').setInputFiles('./app/static/samples/prompts/text-7.txt');
const context = await browser.newContext();
await context.grantPermissions(['microphone', 'camera']);
await page.waitForTimeout(5000);
@ -87,15 +87,14 @@ test('multi-take test', async ({ page, browser }) => {
test('record all prompts test', async ({ page, browser }) => {
await page.waitForTimeout(1000);
await page.getByRole('textbox').click();
await page.getByRole('textbox').setInputFiles('./static/samples/prompts/text-7.txt');
await page.getByRole('textbox').setInputFiles('./app/static/samples/prompts/text-7.txt');
const context = await browser.newContext();
await context.grantPermissions(['microphone', 'camera']);
await page.waitForTimeout(5000);
await expect(page.getByText('You have recorded 0/7 prompts')).toBeVisible();
await page.getByRole('button', { name: 'Record', exact: true }).first().click();
await page.waitForTimeout(1000);
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Stop recording' }).first().click();
await page.waitForTimeout(5000);
await expect(page.getByText('You have recorded 1/7 prompts')).toBeVisible();
await page
.locator('section')
@ -105,7 +104,7 @@ test('record all prompts test', async ({ page, browser }) => {
.click();
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Record', exact: true }).nth(1).click();
await page.waitForTimeout(1000);
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Stop recording' }).nth(1).click();
await expect(page.getByText('You have recorded 2/7 prompts')).toBeVisible();
await page
@ -116,7 +115,7 @@ test('record all prompts test', async ({ page, browser }) => {
.click();
await expect(page.getByText('You have recorded 1/7 prompts')).toBeVisible();
await page.getByRole('button', { name: 'Record', exact: true }).nth(1).click();
await page.waitForTimeout(1000);
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Stop recording' }).nth(1).click();
await page
.locator('section')
@ -126,7 +125,7 @@ test('record all prompts test', async ({ page, browser }) => {
.click();
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Record', exact: true }).nth(2).click();
await page.waitForTimeout(1000);
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Stop recording' }).nth(2).click();
await page
.locator('section')
@ -136,7 +135,7 @@ test('record all prompts test', async ({ page, browser }) => {
.click();
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Record', exact: true }).nth(2).click();
await page.waitForTimeout(1000);
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Stop recording' }).nth(2).click();
await page
.locator('section')
@ -146,7 +145,7 @@ test('record all prompts test', async ({ page, browser }) => {
.click();
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Record', exact: true }).nth(2).click();
await page.waitForTimeout(1000);
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Stop recording' }).nth(2).click();
await page
.locator('section')
@ -155,8 +154,8 @@ test('record all prompts test', async ({ page, browser }) => {
.nth(2)
.click();
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Record', exact: true }).nth(3).click();
await page.waitForTimeout(1500);
await page.getByRole('button', { name: 'Record' }).nth(3).click();
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Stop recording' }).nth(2).click();
await page
.locator('section')
@ -164,9 +163,8 @@ test('record all prompts test', async ({ page, browser }) => {
.getByRole('button')
.nth(2)
.click();
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Record' }).nth(4).click();
await page.waitForTimeout(1000);
await page.waitForTimeout(100);
await page.getByRole('button', { name: 'Stop recording' }).nth(3).click();
await expect(page.getByText('You have recorded 7/7 prompts')).toBeVisible();
await expect(page.getByText('admires as rapturously as herself 7 Record Take')).toBeVisible();
@ -182,7 +180,7 @@ test('record all prompts test', async ({ page, browser }) => {
test('save files test', async ({ page, browser }) => {
await page.waitForTimeout(1000);
await page.getByRole('textbox').click();
await page.getByRole('textbox').setInputFiles('./static/samples/prompts/text-7.txt');
await page.getByRole('textbox').setInputFiles('./app/static/samples/prompts/text-7.txt');
const context = await browser.newContext();
await context.grantPermissions(['microphone', 'camera']);
await page.waitForTimeout(5000);
@ -206,7 +204,7 @@ test('export to session test', async ({ page, browser }) => {
await page.getByRole('link', { name: 'Record' }).click();
await page.waitForTimeout(1000);
await page.getByRole('textbox').click();
await page.getByRole('textbox').setInputFiles('./static/samples/prompts/text-7.txt');
await page.getByRole('textbox').setInputFiles('./app/static/samples/prompts/text-7.txt');
const context = await browser.newContext();
await context.grantPermissions(['microphone', 'camera']);
await page.waitForTimeout(5000);

View file

@ -9,7 +9,7 @@ test('can login under sample user', async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await expect(page.getByRole('link', { name: 'Sample Session sample-session' })).toBeVisible();
await expect(page.getByRole('menubar')).toContainText('home session Spectral Profile');
await expect(page.locator('h2')).toContainText('Sample Session');
@ -26,7 +26,7 @@ test('invalid username or password', async ({ page }) => {
await page.getByLabel('Username').fill('Spectral');
await page.getByLabel('Username').press('Tab');
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await expect(page.locator('form')).toContainText('Invalid username or password');
});

View file

@ -27,7 +27,7 @@ test('register and walk through', async ({ page }) => {
await expect(page.getByText('String must contain at least')).toBeVisible();
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Sign up' }).click();
await expect(page.getByRole('button')).toBeVisible();
await page.waitForTimeout(100);
await page.getByRole('button').click();
@ -52,7 +52,7 @@ test('register and walk through', async ({ page }) => {
await page.getByLabel('Username').fill('Roman');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
await expect(page.locator('h2')).toContainText('new session asdf');
});

View file

@ -12,7 +12,7 @@ test.beforeEach(async ({ page }) => {
await page.getByLabel('Username').fill('Sample');
await page.getByLabel('Password').click();
await page.getByLabel('Password').fill('password');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Login' }).click();
});
test('everything in session is visible', async ({ page }) => {
@ -39,11 +39,11 @@ test('everything in session is visible', async ({ page }) => {
.getByRole('button')
.nth(1)
).toBeVisible();
await expect(page.locator('li').filter({ hasText: 'F01_severe_head_sentence1' })).toBeVisible();
await expect(page.locator('li').filter({ hasText: 'F03_moderate_head_sentence1' })).toBeVisible();
await expect(page.getByRole('button', { name: 'F01_severe_head_sentence1' })).toBeVisible();
await expect(page.getByRole('button', { name: 'F03_moderate_head_sentence1' })).toBeVisible();
await expect(page.getByRole('button', { name: 'MC02_control_head_sentence1' })).toBeVisible();
await expect(
page.getByText('home session sample-session Spectral Show Info Profile')
page.getByText('home session Sample Session Spectral Show Info Profile')
).toBeVisible();
await expect(page.getByRole('button', { name: 'Record' })).toBeVisible();
await expect(page.getByRole('textbox')).toBeVisible();
@ -65,7 +65,12 @@ test('session selection screen test', async ({ page }) => {
await page.locator('input[name="sessionName"]').click();
await page.locator('input[name="sessionName"]').fill('spectrum');
await page.locator('input[name="sessionName"]').press('Enter');
await expect(page.locator('ol').filter({ hasText: 'No files yet!' })).toBeVisible();
await expect(
page
.locator('div')
.filter({ hasText: /^No files yet!$/ })
.first()
).toBeVisible();
await page.getByRole('link', { name: 'session' }).click();
await expect(page.getByRole('link', { name: 'spectrum' })).toBeVisible();
});