Cypress Tests for Udemy's homepage
├── _.circleci
│ ├── config.yml
| |
├── _cypress
│ ├── _integration
│ | ├── home-header.spec.js
│ | |── home-body.spec.js
│ | ├── home-footer.spec.js
│ | ├── trending-preview.spec.js
│ | ├── skills-preview.spec.js
│ | └── cart.spec.js
| |
│ ├── _support
| └── commands.js
|
|───── cypress.json
|───── package.json
└────── README.md
$ git clone https://github.com/karthikshetty03/Cypress-Microtasks-GSOC-21.git
$ npm install
To run test file of your choice:
$ npm run cypress
To run all tests:
$ npm run cypress:all
#!/bin/bash -eo pipefail
npm run cypress:all
> Cypress-Microtasks-GSOC-21@1.0.0 cypress:all /root/project
> cypress run
Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 7.1.0 │
│ Browser: Electron 89 (headless) │
│ Specs: 6 found (cart.spec.js, home-body.spec.js, home-footer.spec.js, home-header.spec.js │
│ , skills-previews.spec.js, trending-previews.spec.js) │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: cart.spec.js (1 of 6)
Checking the Cart functionality
Desktop View
✓ Empty Cart (9599ms)
✓ Adding a course from students are viewing Panel (24788ms)
✓ Deleting a course from the cart of students are viewing Panel (28306ms)
✓ Adding a course from each skill in Skills Hub Panel (79928ms)
✓ Deleting all courses of skills hub panel in the cart (95688ms)
5 passing (4m)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 5 │
│ Passing: 5 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 3 minutes, 59 seconds │
│ Spec Ran: cart.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: home-body.spec.js (2 of 6)
Check Body of Udemy's home page
Desktop View
✓ Check Main Title and Sub title (7908ms)
✓ Check Skills hub Panel (17421ms)
✓ Checks Udemy Brand value panel (14810ms)
✓ Check 'Students are viewing' panel (81836ms)
✓ Check Onboarding Banner (9036ms)
✓ Checking top categories (11093ms)
✓ Checking Featured Topics by category (13422ms)
7 passing (3m)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 7 │
│ Passing: 7 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 2 minutes, 36 seconds │
│ Spec Ran: home-body.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: home-footer.spec.js (3 of 6)
Check Footer of Udemy's home page
Desktop View
✓ Checks 'Teach on Udemy' Box (11212ms)
✓ Checks 'Udemy for Business' box (4680ms)
✓ Checks User stories panel (4321ms)
✓ Bottomost Panel (Links, Language, Logo and Copyright) (5294ms)
4 passing (26s)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 4 │
│ Passing: 4 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 26 seconds │
│ Spec Ran: home-footer.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: home-header.spec.js (4 of 6)
Check header of Udemy's home page
Desktop View
✓ Check Navbar (23313ms)
✓ Check Billboard (4635ms)
2 passing (28s)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 2 │
│ Passing: 2 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 28 seconds │
│ Spec Ran: home-header.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: skills-previews.spec.js (5 of 6)
Testing cards on Skills Hub Panel
Desktop View
✓ Course Cards (343402ms)
1 passing (6m)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 1 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 5 minutes, 43 seconds │
│ Spec Ran: skills-previews.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: trending-previews.spec.js (6 of 6)
Testing cards on 'Students are Viewing' Panel
Desktop View
✓ Course Cards (37984ms)
1 passing (38s)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 1 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 37 seconds │
│ Spec Ran: trending-previews.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ cart.spec.js 03:59 5 5 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ home-body.spec.js 02:36 7 7 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ home-footer.spec.js 00:26 4 4 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ home-header.spec.js 00:28 2 2 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ skills-previews.spec.js 05:43 1 1 - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ trending-previews.spec.js 00:37 1 1 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! 13:51 20 20 - - -
CircleCI received exit code 0
- All images are taken from Udemy website and used for reference purpose only
- Mobile View is similar with almost no change
- Running all the tests together on headless browser (locally or CIrcleCI) can fail some tests as there will be problems with popups not showing up etc.
- In this case, you can run
$ npm run cypress
and open a file of your choice.