Skip to content

Commit

Permalink
Also update e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
leung018 committed Oct 5, 2024
1 parent 2b42416 commit 4d9b1ea
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ describe('End to end tests', () => {

cy.findByText('Answer 1').then(($el1) => {
cy.findByText('Answer 2').then(($el2) => {
expect($el2[0].compareDocumentPosition($el1[0])).to.eq(
Node.DOCUMENT_POSITION_FOLLOWING,
)
assertIsBefore($el2[0], $el1[0])
})
})
})
Expand Down Expand Up @@ -103,6 +101,13 @@ function assertIsInHomePage(cy) {
cy.contains('Add New Question Set')
}

// TODO: Copy from the main codebase, can't figure out how to import it here yet
function assertIsBefore(aHtmlElement, bHtmlElement) {
expect(aHtmlElement.compareDocumentPosition(bHtmlElement)).to.eq(
Node.DOCUMENT_POSITION_FOLLOWING,
)
}

/**
* TODO: Currently not support more than 2 choices or more than 1 question. But no need for e2e testing currently
*/
Expand Down

0 comments on commit 4d9b1ea

Please sign in to comment.