Skip to content

Commit

Permalink
Added a test for manual record create/edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Nov 20, 2024
1 parent 9090eaa commit 03bcee8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 29 deletions.
45 changes: 38 additions & 7 deletions test/export.audio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,53 @@ test.afterAll(async () => {
await electronApp.close()
})

test.describe.configure({ mode: 'parallel', retries: 2, timeout: 20_000 });
//test.describe.configure({ mode: 'parallel', retries: 2, timeout: 20_000 });

/*
REMEMBER TO REBUILD THE APP IF THE *APPLICATION CODE* NEEDS TO BE CHANGED
----------------
*/


test('Export mp3 works', async () => {
await runExampleAnalysis(page,'chirpity');
await changeSettings(page, 'select', 'format', 'mp3', 0)
await page.locator('region').click({button: 'right'});
await page.locator('#context-create-clip').click();
// test('Export mp3 works', async () => {
// await runExampleAnalysis(page,'chirpity');
// await changeSettings(page, 'select', 'format', 'mp3', 0)
// await page.locator('region').click({button: 'right'});
// await page.locator('#context-create-clip').click();

})
// })

test('Can create/edit a manual record', async () => {
await runExampleAnalysis(page,'chirpity');
await page.locator('#result1').click();
await page.locator('region').click({button: 'right'});
await page.locator('#create-manual-record').click();
const birdList = page.locator('#bird-list-all');
// @ts-ignore
const selectedValue = await birdList.evaluate(select => select.value);
// The edit form has the current species selected
expect(selectedValue === 'Redwing (call)' )
await birdList.selectOption('Ring Ouzel (call)');
await page.locator('#call-count').fill('3');
await page.locator('#record-comment').fill('a test comment');
await page.locator('#record-add').click();
const cname = await page.locator('#result1 td.cname > span.material-symbols-outlined')
const confidence = await cname.textContent();
// Confidence has a checkmark
expect(confidence).toBe('verified');
const comment = await (await page.locator('#result1 td.comment span')).getAttribute('title');
// Comment saved
expect(comment).toBe('a test comment');
const callCount = await page.locator('#call-count').inputValue();
// Call count updated
expect(callCount).toBe('3');
await page.keyboard.press('ControlOrMeta+s');
await page.waitForTimeout(1000);
const filename = await page.locator('#filename span.filename');
// File name is blue - saved
const hasClass = await filename.evaluate(el => el.classList.contains('text-info'));
expect(hasClass).toBe(true)
})

// test(`Nocmig analyse works and second result is 61%`, async () => {
// await runExampleAnalysis(page,'chirpity');
Expand Down
14 changes: 1 addition & 13 deletions test/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,13 @@ test("Amend file start dialog contains date", async () =>{
await runExampleAnalysis(page, 'chirpity');
await page.locator('#dropdownMenuButton').click({button: 'right'});
await page.locator('#setFileStart').click();
const fileStart = await page.locator('#fileStart');
const fileStart = page.locator('#fileStart');
const entry = await fileStart.inputValue();
const currentYear = new Date().getFullYear().toString();
expect(entry.toString()).toContain(currentYear);
// await page.locator('#spectrogramWrapper button.btn-secondary').click();
})

// test("Copes with scatter bomb", async () =>{
// await runExampleAnalysis(page, 'chirpity');
// await page.locator('#dropdownMenuButton').click({button: 'right'});
// await page.locator('#setFileStart').click();
// const fileStart = await page.locator('#fileStart');
// const entry = await fileStart.inputValue();
// const currentYear = new Date().getFullYear().toString();
// expect(entry.toString()).toContain(currentYear);
// // await page.locator('#spectrogramWrapper button.btn-secondary').click();
// })


/*
The current issue with click fest is that while element are hidden, they can't be clicked.
Expand Down
9 changes: 0 additions & 9 deletions tests/spec.ts

This file was deleted.

0 comments on commit 03bcee8

Please sign in to comment.