simpler crud tests

This commit is contained in:
Thomas Nahuel Rusiecki 2025-03-10 13:18:05 -03:00
parent 125c30c4eb
commit d63744ef51

View file

@ -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();