-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1118854
commit 621e8fd
Showing
2 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,32 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
test('has title', async ({ page }) => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/') | ||
}) | ||
|
||
// Expect a title "to contain" a substring. | ||
test('has title', async ({ page }) => { | ||
await expect(page).toHaveTitle(/Riksutin/) | ||
}) | ||
|
||
test('has the first question', async ({ page }) => { | ||
await expect(page.getByText('Ilmoittajan nimi')).toBeVisible() | ||
|
||
const nameInput = page.getByTestId('question-1').getByRole('textbox') | ||
|
||
await nameInput.click() | ||
await nameInput.fill('') | ||
|
||
await expect(nameInput).toHaveValue('') | ||
}) | ||
|
||
test('shows answers after submitting', async ({ page }) => { | ||
const nameInput = page.getByTestId('question-1').getByRole('textbox') | ||
|
||
await nameInput.click() | ||
await nameInput.fill('Testi Testinen') | ||
|
||
await page.getByRole('button', { name: 'Valinnat tehty' }).click() | ||
|
||
await expect(page.getByText('Yhteenveto valinnoistasi')).toBeVisible() | ||
await expect(page.getByText('Ilmoittajan nimi: Testi Testinen')).toBeVisible() | ||
}) |