diff --git a/frontend/tests/pages/quiz-creation-page.ts b/frontend/tests/pages/quiz-creation-page.ts index b6659c3..ab00e08 100644 --- a/frontend/tests/pages/quiz-creation-page.ts +++ b/frontend/tests/pages/quiz-creation-page.ts @@ -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') + } } diff --git a/frontend/tests/steps/create-quiz.ts b/frontend/tests/steps/create-quiz.ts index ea2d81e..08315b9 100644 --- a/frontend/tests/steps/create-quiz.ts +++ b/frontend/tests/steps/create-quiz.ts @@ -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() }) @@ -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') +}) diff --git a/specs/CreateQuiz.feature b/specs/CreateQuiz.feature index 5051a19..94380c2 100644 --- a/specs/CreateQuiz.feature +++ b/specs/CreateQuiz.feature @@ -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 #