Skip to content

Commit 5354175

Browse files
committed
Fix: Modify user-course-session-behaviour.cy.tsx
Resolves timed out AssertionError for Session Completion form. Error only occurs in GHA environment. - adds button enabled / disabled state assertions - increase timeouts for feedback form - remove fixed delay in favor of state-based waiting
1 parent faa965c commit 5354175

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cypress/integration/tests/user-course-session-behaviour.cy.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ describe.only('A course session user', () => {
3333

3434
cy.get('h3').contains('Bonus content').click(); //open bonus content
3535

36-
cy.get('button').contains('Session complete').click(); //mark course as complete
36+
// Wait for button to be enabled before clicking
37+
cy.get('button').contains('Session complete').should('not.be.disabled').click(); //mark course as complete
3738

38-
// Add wait to ensure API call completes
39-
cy.wait(2000);
40-
41-
cy.get('h2').contains('How was this session?').should('exist'); //feedback form available after course has started
39+
// Wait for loading state to finish and feedback form to appear
40+
cy.get('button').contains('Session complete').should('not.be.disabled');
41+
cy.get('h2', { timeout: 15000 }).contains('How was this session?').should('exist'); //feedback form available after course has started
4242

4343
cy.get('button').contains('Send').click(); //try to send feedback without selecting feedback option first
4444

@@ -48,7 +48,9 @@ describe.only('A course session user', () => {
4848

4949
cy.get('button').contains('Send').click(); //submit feedback
5050

51-
cy.get('h3').contains('Thank you for submitting your feedback').should('exist'); //check user feedback
51+
cy.get('h3', { timeout: 15000 })
52+
.contains('Thank you for submitting your feedback')
53+
.should('exist'); //check user feedback
5254
});
5355

5456
after(() => {

0 commit comments

Comments
 (0)