From d63744ef514d2aed4ac0170caa5180060e6fc98a Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Mon, 10 Mar 2025 13:18:05 -0300 Subject: [PATCH] simpler crud tests --- tests/end-to-end/tests/lots.spec.ts | 67 +++++++++++++---------------- 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/tests/end-to-end/tests/lots.spec.ts b/tests/end-to-end/tests/lots.spec.ts index bed47df..d8288d6 100644 --- a/tests/end-to-end/tests/lots.spec.ts +++ b/tests/end-to-end/tests/lots.spec.ts @@ -22,48 +22,41 @@ async function login(page, date, time) { //}); +test.only('Lot CRUD', async ({ page }) => { + await login(page); + //await page.pause(); -test.describe.serial('Lot CRUD', () => { + // Create Lot + await page.getByRole('link', { name: 'Entrada' }).click(); + await page.getByRole('link', { name: 'New lot' }).click(); + await page.getByLabel('Type').selectOption('2'); + await page.getByPlaceholder('Name').fill('Organizaci'); + await page.getByPlaceholder('Code').click(); + await page.getByPlaceholder('Code').fill('Codigo'); + await page.getByPlaceholder('Description').fill('Descripcion muy extensa de una organizacion muy extensa'); + await page.getByRole('button', { name: ' Save' }).click(); - let page: Page; - test.beforeAll(async ({ browser }) => { - page = await browser.newPage(); - await login(page); - }); + // Edit Lot + await page.getByRole('link', { name: ' Edit' }).first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Organización'); + await page.getByPlaceholder('Name').press('Enter'); - test('Create Lot', async () => { - - //await page.pause(); - - await page.getByRole('link', { name: 'Entrada' }).click(); - await page.getByRole('link', { name: 'New lot' }).click(); - await page.getByLabel('Type').selectOption('2'); - await page.getByPlaceholder('Name').fill('Organizaci'); - await page.getByPlaceholder('Code').click(); - await page.getByPlaceholder('Code').fill('Codigo'); - await page.getByPlaceholder('Description').fill('Descripcion muy extensa de una organizacion muy extensa'); - await page.getByRole('button', { name: ' Save' }).click(); - }); - - test('Edit Lot', async () => { - //newest lot will be first - await page.getByRole('link', { name: ' Edit' }).first().click(); - await page.getByPlaceholder('Name').click(); - await page.getByPlaceholder('Name').fill('Organización'); - await page.getByPlaceholder('Name').press('Enter'); - }); - - test('Delete Lot', async () => { - await page.getByRole('row', { name: ' Organización Descripcion' }).getByRole('checkbox').check(); - await page.getByRole('button', { name: ' Delete Selected' }).click(); - await page.getByRole('button', { name: ' Delete' }).click(); - }); + // Delete Lot + await page.getByRole('row', { name: ' Organización Descripcion' }).getByRole('checkbox').check(); + await page.getByRole('button', { name: ' Delete Selected' }).click(); + await page.getByRole('button', { name: '' }).click(); + await page.getByRole('button', { name: '' }).click(); + await page.getByRole('button', { name: ' Delete' }).click(); + await page.close(); }); + test('Search function', async ({ page }) => { //Searches for a demo loaded lot (orgC) await login(page); + //await page.pause(); await page.getByRole('link', { name: 'Entrada' }).click(); await page.getByPlaceholder('Search by name or description').click(); @@ -75,6 +68,7 @@ test('Search function', async ({ page }) => { test('Show archived', async ({ page }) => { await login(page); + //await page.pause(); await page.getByRole('link', { name: 'Entrada' }).click(); await page.getByText('Archived (1)').click(); @@ -85,7 +79,7 @@ test('Show archived', async ({ page }) => { test('Sort by different columns', async ({ page }) => { await login(page); - await page.pause(); + //await page.pause(); await page.getByRole('link', { name: 'Entrada' }).click(); await page.getByText('All Lots (3)').click(); await page.getByRole('link', { name: 'Status' }).click(); @@ -103,10 +97,9 @@ test('Sort by different columns', async ({ page }) => { }); -test.only('Select all and delete all', async ({ page }) => { +test('Select all and delete all', async ({ page }) => { await login(page); - - await page.pause(); + // await page.pause(); await page.getByRole('link', { name: 'Entrada' }).click(); await page.locator('#select-all').check();