Skip to content

Commit

Permalink
test: one tab in dom at any time
Browse files Browse the repository at this point in the history
  • Loading branch information
soofstad committed Mar 12, 2024
1 parent ead8c85 commit 10fe8fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
23 changes: 8 additions & 15 deletions e2e/tests/plugin-view_selector-car_garage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ test('View selector - car garage', async ({ page }) => {
page.getByRole('tab', { name: 'Owner details' })
).toHaveAttribute('aria-selected', 'true')
await expect(page.getByRole('tab', { name: 'Owner history' })).toBeVisible()
await expect(page.locator('#name').nth(2)).toHaveValue('Aiden')
await expect(
page.getByTestId('form-text-widget-Name of Owner')
).toHaveValue('Aiden')
await page.getByText('Owner history').click()
await expect(
page.getByRole('tab', { name: 'group Owner history' })
Expand Down Expand Up @@ -100,23 +102,14 @@ test('View selector - car garage', async ({ page }) => {
).not.toBeVisible()
})

await test.step('Testing that tabs are still open for the first car when going back and forth', async () => {
await test.step('Testing that tabs are reset for the first car when going back and forth', async () => {
await page.getByRole('tab', { name: 'Audi' }).click()
await expect(page.getByRole('tab', { name: 'Owner' })).toBeVisible()
await expect(page.getByRole('tab', { name: 'Technical' })).toHaveAttribute(
'aria-selected',
'true'
)
await expect(page.getByRole('tab', { name: 'EU control' })).toBeVisible()
await expect(page.getByRole('tab', { name: 'Dimensions' })).toHaveAttribute(
'aria-selected',
'true'
)
await expect(page.getByRole('tab', { name: 'Owner' })).not.toBeVisible()
})

await test.step('Testing that saving one car does not override the other car', async () => {
await page.getByRole('tab', { name: 'Volvo' }).click()
await page.getByLabel('Open in tab').nth(3).click()
await page.getByTestId('Technical').getByLabel('Open in tab').click()

await expect(
page.getByTestId('form-text-widget-Next control date').last()
Expand All @@ -126,9 +119,9 @@ test('View selector - car garage', async ({ page }) => {
page.getByTestId('form-number-widget-Length (mm) (Optional)').last()
).toHaveValue('4500')
await page.getByRole('tab', { name: 'Home' }).click()
await page.getByLabel('Open in tab').nth(2).click()
await page.getByTestId('Owner').getByLabel('Open in tab').click()
await expect(
page.getByTestId('form-text-widget-Name of Owner').nth(1)
page.getByTestId('form-text-widget-Name of Owner')
).toBeVisible()
await page.getByRole('tab', { name: 'Owner history' }).click()
await expect(page.getByRole('textbox').first()).toHaveValue('Jack')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test('Admin role', async ({ page }) => {
).toBeVisible()
await expect(page.getByTestId('form-text-widget-Name')).toBeEditable()
await page.getByRole('tab', { name: 'Hogwarts All', exact: true }).click()
await expect(page.getByRole('tabpanel').locator('#name')).not.toBeEditable()
await expect(page.getByTestId('form-text-widget-Name')).toBeDisabled()
})

test('Change role to operator and back', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"_id": "hogwars-school-meta",
"name": "HogwartsMeta",
"type": "./blueprints/SchoolDistrict",
"country": "England",
Expand Down

0 comments on commit 10fe8fd

Please sign in to comment.