Skip to content

Commit 4979299

Browse files
Add Cypress integration test for new Shorts feature (#1482)
* Add Cypress integration test for new Shorts feature # 1435 Add end-to-end Cypress tests for Shorts features to ensure users can play a short, select a related session, log in, and continue the session. * Add Cypress integration test for new Conversations feature Add end-to-end Cypress tests for the Conversations feature to ensure users can navigate to Courses, select a conversation, log in, play audio, and submit feedback. * Removed conversations.cy.tsx from PR --------- Co-authored-by: Kylee Fields <43586156+kyleecodes@users.noreply.github.com>
1 parent a880fa8 commit 4979299

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
describe('Shorts Flow', () => {
2+
const email = `cypresstestemail+${Date.now()}@chayn.co`;
3+
const password = 'testtesttest';
4+
5+
before(() => {
6+
cy.cleanUpTestState();
7+
cy.createUser({ emailInput: email, passwordInput: password });
8+
});
9+
10+
it('Should allow a user to play a short, select a related session, log in, and continue to the session', () => {
11+
// User visits the home page
12+
cy.visit('/');
13+
14+
// User clicks on a short titled "Sex after trauma"
15+
cy.contains('Sex after trauma', { timeout: 10000 }).should('be.visible').click();
16+
17+
// User plays the short video
18+
cy.get('.react-player__preview', { timeout: 10000 }).should('be.visible').click();
19+
cy.wait(2000); // wait to ensure user plays the short
20+
21+
// User clicks on a related session titled "Sexuality and desire"
22+
cy.contains('h3', 'Sexuality and desire', { timeout: 10000 }).should('be.visible').click();
23+
24+
// User is prompted to login
25+
cy.get('a[qa-id="dialogLoginButton"]').click();
26+
27+
// User logs in
28+
cy.get('#email').type(email);
29+
cy.get('#password').type(password);
30+
cy.get('button[type=submit]').click();
31+
cy.wait(2000); // wait to ensure user is redirected to and plays the session
32+
33+
// User is redirected to and plays the session
34+
cy.get('.react-player__preview', { timeout: 10000 }).should('be.visible').click();
35+
cy.wait(2000); // wait to ensure user is redirected to and plays the session
36+
37+
// User clicks the button to complete session
38+
cy.contains('button', 'Session complete', { timeout: 10000 }).should('be.visible').click();
39+
40+
// Feedback form appears
41+
cy.contains('h2', 'How was this session?').should('be.visible');
42+
43+
// Click the Send button and check for error message
44+
cy.get('button').contains('Send').click();
45+
cy.contains('p', 'Please select a rating before sending.').should('be.visible');
46+
47+
// User selects a rating
48+
cy.get('input[name="feedback-radio-buttons"]').first().check();
49+
50+
// User submits feedback
51+
cy.contains('button', 'Send').click();
52+
cy.wait(2000);
53+
54+
// Confirmation message appears
55+
cy.contains('h3', 'Thank you for submitting your feedback').should('exist');
56+
});
57+
58+
after(() => {
59+
cy.logout();
60+
});
61+
});

0 commit comments

Comments
 (0)