Created
December 20, 2018 23:20
-
-
Save Sharondio/90578a9a7c7c4c62d50b322d2c796bd9 to your computer and use it in GitHub Desktop.
Cypress failing test.
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
it.only('Can add items to a previously saved quiz', () => { | |
cy.route('GET', '**/quizapi/quizzes/*', '@quizUnpublished').as('getQuiz'); | |
cy.route('POST', '**/quizapi/items/query', { data: [] }).as('getItems'); | |
cy.route('POST', '**/qtmongo/items/query', '@items').as('getAllItems'); | |
cy.route('PATCH', '**/quizapi/quizzes', { | |
data: [{ reference: 'qz100369' }] | |
}).as('patchQuiz'); | |
cy.visit(quizzesPath); | |
cy.wait('@getQuizzes'); | |
cy.get(':nth-child(2) > .datatable-body-row').click(); | |
cy.get('#quiz-details').click(); | |
cy.get('#status').contains('unpublished'); | |
cy.get('#add-content').click(); | |
cy.wait('@getAllItems'); | |
cy.wait(5000); | |
cy.get( | |
':nth-child(1) > .datatable-body-row > .datatable-row-center > [style="width: 46.8333px; max-width: 50px; height: 88px;"] > .datatable-body-cell-label > .datatable-checkbox > input' | |
).check(); | |
cy.get( | |
':nth-child(3) > .datatable-body-row > .datatable-row-center > [style="width: 46.8333px; max-width: 50px; height: 88px;"] > .datatable-body-cell-label > .datatable-checkbox > input' | |
).check(); | |
cy.get(':nth-child(2) > .btn-primary').click(); | |
cy.wait('@patchQuiz').then((xhr) => { | |
const requestBody = xhr.request.body; | |
cy.log(requestBody.reference); | |
expect(requestBody.items.length).to.eq(2); | |
expect(requestBody.items[0]).to.eq('i130654'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment