Skip to content

Commit

Permalink
add step to create-quiz
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Gorelik authored and Alexander Gorelik committed Sep 6, 2024
1 parent ea6900b commit 80d8c08
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
8 changes: 8 additions & 0 deletions frontend/tests/pages/quiz-creation-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,12 @@ export default class QuizCreationPage {
getValidationError = () => this.page.locator('.validation-error').innerText()

getUrl = () => this.page.url()

enterQuizName = async () => {
await this.page.fill('#quizName', 'Test name')
}

getQuizName = async () => {
return this.page.inputValue('#quizName')
}
}
16 changes: 11 additions & 5 deletions frontend/tests/steps/create-quiz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ When('quiz maker chooses id from the table', async () => {
await world.quizCreationPage.selectRandomQuizId()
})

// Then('quiz maker sees that expected check boxes are selected', async () => {
// const selectedIds = await world.quizCreationPage.getSelectedIds()
// expect(selectedIds.length).toBeGreaterThan(0) // Должны быть выбраны какие-то чекбоксы
// })

When('quiz maker submits the quiz', async () => {
await world.quizCreationPage.submitQuiz()
})
Expand Down Expand Up @@ -83,3 +78,14 @@ Then('quiz maker sees a validation error', async () => {
const errorText = await world.quizCreationPage.getValidationError()
expect(errorText).toBe('You must select at least one question.')
})

Then('quiz maker inserts name', async () => {
const { quizCreationPage } = world

await quizCreationPage.enterQuizName()

await quizCreationPage.submitQuiz()

const quizName = await quizCreationPage.getQuizName()
expect(quizName).toBe('Test name')
})
10 changes: 5 additions & 5 deletions specs/CreateQuiz.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ 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
#
# When quiz maker chooses id from the table
# Then quiz maker sees that expected check boxes are selected
#
# When quiz maker submits the quiz

When quiz maker chooses id from the table
And quiz maker inserts name

When quiz maker submits the quiz
# Then quiz maker sees a correct list of the questions
# And link for the quiz taker is present
#
Expand Down

0 comments on commit 80d8c08

Please sign in to comment.