Skip to content

Commit

Permalink
refactor: minor improvements to list e2e-test
Browse files Browse the repository at this point in the history
  • Loading branch information
roar-larsen authored and eoaksnes committed Oct 10, 2023
1 parent 4692ddc commit 04e73c2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions e2e/tests/plugin-list-task_list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ test('Add a new task', async ({ page }) => {
await page
.getByLabel('Task description: (optional)')
.fill('Review and submit the tax return.')
await page.getByTestId('form-submit').click()
await page.getByRole('button', { name: 'Submit' }).click()
await expect(page.getByRole('alert')).toHaveText(['Document updated'])
await page.getByRole('button', { name: 'close', exact: true }).click()
await reloadPage(page) //TODO: Remove when #153 is solved.
await expect(page.getByText('Tax returnMaria Johnson')).toBeVisible()
await expect(page.getByText('Tax return', { exact: true })).toBeVisible()
await page.getByRole('button', { name: 'Open item' }).last().click()
await expect(page.getByLabel('Task title:')).toHaveValue('Tax return')
await expect(page.getByLabel('Assigned to: (optional)')).toHaveValue(
Expand All @@ -58,7 +58,7 @@ test('Mark task as complete', async ({ page }) => {
await page.getByRole('button', { name: 'Open item' }).first().click()
await expect(page.getByLabel('Task title:')).toHaveValue('Wash the car')
await page.getByText('Mark task as complete').click()
await page.getByTestId('form-submit').click()
await page.getByRole('button', { name: 'Submit' }).click()
await expect(page.getByRole('alert')).toHaveText(['Document updated'])
await page.getByRole('button', { name: 'close', exact: true }).click()
await reloadPage(page) //TODO: Remove when #153 is solved.
Expand All @@ -79,6 +79,9 @@ test('Delete a task', async ({ page }) => {
.click()
await page.getByRole('button', { name: 'Save' }).click()
await reloadPage(page) //TODO: Remove when #153 is solved.
await expect(
page.getByRole('paragraph').getByText('Wash the car')
).toBeVisible()
await expect(
page.getByRole('paragraph').getByText('Tax return')
).not.toBeVisible()
Expand Down Expand Up @@ -185,12 +188,13 @@ test('Edit a task', async ({ page }) => {
await page
.getByLabel('Task description: (optional)')
.fill('Remember to buy new brush.')
await page.getByTestId('form-submit').click()
await page.getByRole('button', { name: 'Submit' }).click()
await expect(page.getByRole('alert')).toHaveText(['Document updated'])
await page.getByRole('button', { name: 'close', exact: true }).click()
await reloadPage(page) //TODO: Remove when #153 is solved.

await expect(
page.getByText('Paint the living room greenMark Johnson')
page.getByText('Paint the living room green', { exact: true })
).toBeVisible()
await page.getByRole('button', { name: 'Open item' }).last().click()
await expect(page.getByLabel('Task title:')).toHaveValue(
Expand Down Expand Up @@ -220,7 +224,7 @@ test('Pagination', async ({ page }) => {
await page.getByRole('button', { name: 'Save' }).click()
await page.getByRole('button', { name: 'Next page' }).click()
await expect(page.getByText('6 - 6 of 6')).toBeVisible()
//await expect(page.getByRole('button', { name: 'Next page' })).toBeDisabled() //BUG #258
await expect(page.getByRole('button', { name: 'Next page' })).toBeDisabled()
await page.getByRole('button', { name: 'Previous page' }).click()
await expect(page.getByText('1 - 5 of 6')).toBeVisible()
await expect(
Expand Down

0 comments on commit 04e73c2

Please sign in to comment.