-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TESTING] Survey view testing (#4802)
Fixes #4782 Tests: - Fill in one answer - Fill in remaining 3 answers - Click skip button - Click remind me tomorrow button It would be nice to only test classes that have students, anyone knows how to do that?
- Loading branch information
Showing
4 changed files
with
54 additions
and
6 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
48 changes: 48 additions & 0 deletions
48
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,48 @@ | ||
import {loginForTeacher} from '../../tools/login/login.js' | ||
import {createClassAndAddStudents} from '../../tools/classes/class.js' | ||
import { goToTeachersPage } from '../../tools/navigation/nav.js'; | ||
|
||
let classname; | ||
|
||
beforeEach(() => { | ||
loginForTeacher("teacher4"); | ||
({classname} = createClassAndAddStudents()); | ||
goToTeachersPage(); | ||
cy.get(".view_class").contains(new RegExp(`^${classname}$`)).click(); | ||
}) | ||
|
||
describe('Class Survey View', () => { | ||
it('Can first respond to 1 question, then to last 3 questions', () => { | ||
cy.get("#input").type("test"); | ||
cy.get("#submit").click(); | ||
goToTeachersPage(); | ||
cy.get(".view_class").contains(new RegExp(`^${classname}$`)).click(); | ||
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); | ||
}); | ||
}); | ||
cy.get("#submit").click(); | ||
goToTeachersPage(); | ||
cy.get(".view_class").contains(new RegExp(`^${classname}$`)).click(); | ||
cy.get("#survey").should('not.exist'); | ||
}) | ||
|
||
|
||
it('Can be skipped and survey is not shown after', () => { | ||
cy.get("#skip").click(); | ||
goToTeachersPage(); | ||
cy.get(".view_class").contains(new RegExp(`^${classname}$`)).click(); | ||
cy.get("#survey").should('not.exist'); | ||
}) | ||
|
||
it('Can be skipped and survey is not shown after', () => { | ||
cy.get("#remind_later").click(); | ||
goToTeachersPage(); | ||
cy.get(".view_class").contains(new RegExp(`^${classname}$`)).click(); | ||
cy.get("#survey").should('not.exist'); | ||
}) | ||
}) |
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