Created
October 30, 2015 22:12
-
-
Save samselikoff/118f3738b7025750fa93 to your computer and use it in GitHub Desktop.
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
- visit('/1'); | |
- | |
- andThen(() => { | |
- assert.ok(find('.Question-list__item :contains(My first question)').length); | |
- }); | |
+ new MultipleChoiceQuestionPage({ assert }) | |
+ .visit(`/1`) | |
+ .assertQuestionWithTitleIsVisible('My first question'); | |
}); | |
test("I can edit a multiple choice question's timecode", function(assert) { | |
@@ -38,15 +37,12 @@ test("I can edit a multiple choice question's timecode", function(assert) { | |
server.create('answer', {question_id: q.id}); | |
server.create('answer', {question_id: q.id, correct: true}); | |
- visit('/1'); | |
- click('.Question-list__item:first'); | |
- click('.Timecode-input .Timecode-input__increment'); | |
- click('[data-test-id="save"]'); | |
- | |
- andThen(function() { | |
- assertNotFound('.Ted-modal', 'the modal was dismissed'); | |
- assert.equal(server.db.questions[0].duration, 31); | |
- }); | |
+ new MultipleChoiceQuestionPage({ assert }) | |
+ .visit(`/1`) | |
+ .clickFirstQuestion() | |
+ .incrementTimecode() | |
+ .save() | |
+ .assertQuestionWasSavedWithDuration(31); | |
}); | |
test("I can delete a a multiple choice question", function(assert) { | |
@@ -56,14 +52,12 @@ test("I can delete a a multiple choice question", function(assert) { | |
visit('/1'); | |
- click('.Question-list__item :contains(Question 1)'); | |
- click('.Ted-modal button:contains(Delete)'); | |
- click('.Ted-modal button:contains(Delete this question?)'); | |
- | |
- andThen(function() { | |
- assertNotFound('.Ted-modal', 'the modal was dismissed'); | |
- assert.equal(server.db.questions.length, 0); | |
- }); | |
+ new MultipleChoiceQuestionPage({ assert }) | |
+ .visit(`/1`) | |
+ .clickFirstQuestion() | |
+ .delete() | |
+ .confirmDelete() | |
+ .assertQuestionWasDeleted(); | |
}); | |
test("I can add an answer to a multiple choice question", function(assert) { | |
@@ -73,16 +67,13 @@ test("I can add an answer to a multiple choice question", function(assert) { | |
server.create('answer', {question_id: question.id, correct: true}); | |
server.createList('answer', 2, {question_id: question.id}); | |
- visit('/1'); | |
- | |
- click('.Question-list__item :contains(Question 1)'); | |
- click('.Ted-modal :contains(add answer)'); | |
- fillInRedactor('.Ted-modal', 'ABC123'); | |
- click('[data-test-id="save"]'); | |
- | |
- andThen(function() { | |
- assert.equal(server.db.answers.length, 4); | |
- }); | |
+ new MultipleChoiceQuestionPage({ assert }) | |
+ .visit(`/1`) | |
+ .clickFirstQuestion() | |
+ .clickAddAnswer() | |
+ .fillInNewAnswerText('ABC123') | |
+ .save() | |
+ .assertQuestionHasAnswers(4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment