-
Notifications
You must be signed in to change notification settings - Fork 295
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
Showing
3 changed files
with
87 additions
and
5 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
82 changes: 82 additions & 0 deletions
82
tests/cypress/e2e/for-teacher_page/class_page/class-survey.cy.js
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import {loginForTeacher, logout} from '../../tools/login/login.js' | ||
import { createClass} from '../../tools/classes/class' | ||
|
||
const surveyView = body => body.find("#survey") | ||
describe('Class Survey View', () => { | ||
it('Can respond to 1 questions', () => { | ||
|
||
loginForTeacher(); | ||
cy.wait(500); | ||
|
||
cy.get("#total_students").should('not.have.value', '0').then( | ||
cy.get(".view_class").first().click(), | ||
cy.get("body").then(surveyView).then(survey => { | ||
if (survey.length){ | ||
survey = cy.get("#survey") | ||
survey.should("exist") | ||
survey.get("#input").type("test") | ||
survey.get("#submit").click() | ||
} | ||
}) | ||
) | ||
}) | ||
|
||
it('Should have 3 questions remaning, can respond to those', () => { | ||
|
||
loginForTeacher(); | ||
cy.wait(500); | ||
|
||
cy.get("#total_students").should('not.have.value', '0').then( | ||
cy.get(".view_class").first().click(), | ||
cy.get("body").then(surveyView).then(survey => { | ||
if (survey.length){ | ||
survey = cy.get("#survey") | ||
survey.should("exist") | ||
var surveyInputs = Array.from({length:3},(v, k)=>k+1) | ||
cy.wrap(surveyInputs).each((index) => { | ||
cy.getBySel("input_" + index) | ||
.type("test") | ||
.invoke('val').then((text) => { | ||
expect('test').to.equal(text); | ||
}); | ||
}); | ||
survey.get("#submit").click() | ||
} | ||
}) | ||
) | ||
}) | ||
|
||
it('Can be skipped - never show again', () => { | ||
|
||
loginForTeacher(); | ||
cy.wait(500); | ||
|
||
cy.get("#total_students").should('not.have.value', '0').then( | ||
cy.get(".view_class").eq(2).click(), | ||
cy.get("body").then(surveyView).then(survey => { | ||
if (survey.length){ | ||
survey = cy.get("#survey") | ||
survey.should("exist") | ||
survey.get("#skip").click() | ||
} | ||
}) | ||
) | ||
}) | ||
|
||
it('Can be skipped - remind me later', () => { | ||
|
||
loginForTeacher(); | ||
cy.wait(500); | ||
|
||
cy.get("#total_students").should('not.have.value', '0').then( | ||
cy.get(".view_class").eq(3).click(), | ||
cy.get("body").then(surveyView).then(survey => { | ||
if (survey.length){ | ||
survey = cy.get("#survey") | ||
survey.should("exist") | ||
survey.get("#remind_later").click() | ||
} | ||
}) | ||
) | ||
}) | ||
}) |