Skip to content

Commit

Permalink
Add steps to CreateQuiz.feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kateryna-ponomarova committed Sep 5, 2024
1 parent a535c5d commit a48cd5f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion frontend/tests/pages/quiz-creation-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Page } from '@playwright/test'
export default class QuizCreationPage {
constructor(private page: Page) {}

goto = async () => this.page.goto('/quiz/create')
goto = async () => this.page.goto('/quiz-question/all')

getTitle = () => this.page.locator('h1').innerText()

Expand Down Expand Up @@ -44,4 +44,6 @@ export default class QuizCreationPage {
getQuizLink = () => this.page.locator('a.quiz-link').getAttribute('href')

getValidationError = () => this.page.locator('.validation-error').innerText()

getUrl = () => this.page.url()
}
5 changes: 3 additions & 2 deletions frontend/tests/steps/create-quiz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ Given('quiz maker opens a quiz creation page', async () => {
})

Then('quiz maker is on the quiz creation page', async () => {
const pageTitle = await world.quizCreationPage.getTitle()
expect(pageTitle).toBe('Quiz Creation')
const currentUrl = await world.quizCreationPage.getUrl()
const urlPattern = /^http:\/\/localhost:(5173|8080)\/quiz-question\/all$/
expect(currentUrl).toMatch(urlPattern)
})

When('quiz maker chooses id from the table', async () => {
Expand Down
8 changes: 4 additions & 4 deletions specs/CreateQuiz.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Feature: Quiz creation feature


Scenario: Create a quiz as a quiz maker - happy path
# Given quiz maker opens a quiz creation page
# Then quiz maker is on the quiz creation page
Given quiz maker opens a quiz creation page
Then quiz maker is on the quiz creation page
#
# When quiz maker chooses id from the table
# Then quiz maker sees that expected check boxes are selected
Expand All @@ -18,8 +18,8 @@ Feature: Quiz creation feature


Scenario: Create a quiz as a quiz maker - validation error
# Given quiz maker opens a quiz creation page
# Then quiz maker is on the quiz creation page
Given quiz maker opens a quiz creation page
Then quiz maker is on the quiz creation page
#
# When quiz maker does not choose id from the table
# Then quiz maker sees that expected check boxes are not selected
Expand Down

0 comments on commit a48cd5f

Please sign in to comment.