-
-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add readme for testing suite #2085
Changes from 17 commits
1c462b6
f81d256
6c9557e
f98c630
f978325
f0dff39
9e3f7e4
63ec832
ef1da74
fd5a902
f26fd37
1e62162
bff5053
a017bf4
40d20d0
0ed18b2
b72046f
e4dc135
33be619
e698a13
26309e5
67b612f
ed74613
bde099b
73aff46
9aae1ce
38f70c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,59 @@ | ||||||
[![AsyncAPI Banner and Logo](./public/img/logos/github-repobanner-website.png)](https://www.asyncapi.com) | ||||||
|
||||||
--- | ||||||
## Overview | ||||||
|
||||||
This folder contains the test code of AsyncAPI website : | ||||||
|
||||||
- It's powered by [Cypress](https://docs.cypress.io/guides/overview/why-cypress). | ||||||
|
||||||
- It utilises [Cypress/react] to provide some additional functionalites to Cypress . | ||||||
|
||||||
- Unlike traditional testing tools, Cypress operates directly within the browser, providing real-time feedback as tests execute. This allows developers to see the application's behavior as tests run and pinpoint issues more effectively. | ||||||
|
||||||
- Component testing in Cypress refers to the practice of testing individual components of a web application in isolation. | ||||||
These tests can help ensure that components function as expected and interact correctly with other parts of the application. | ||||||
|
||||||
- End-to-end (E2E) testing in Cypress involves testing an entire web application from start to finish to ensure that all its components, interactions, and workflows function correctly as a cohesive whole. E2E tests simulate user behavior and interactions, providing a comprehensive validation of the application's functionality. | ||||||
|
||||||
## Requirements | ||||||
Use the following tools to set up the project: | ||||||
- [Cypress] (This is installed as a dev-dependency). | ||||||
|
||||||
## Run tests locally | ||||||
|
||||||
Assuming you have all the necessary website dependencies installed: | ||||||
|
||||||
1. Run it and check on the Cypress Graphical User Interface | ||||||
```bash | ||||||
npm cypress open | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per the latest changes in master branch, it should be |
||||||
``` | ||||||
(You can check out the tests and their outputs on the Cypress Window) | ||||||
|
||||||
2. Run it on your local CLI | ||||||
```bash | ||||||
npm run test | ||||||
``` | ||||||
|
||||||
## Cypress Folder structure | ||||||
```text | ||||||
├── downloads # Any necessary downloads for the tests | ||||||
├── fixtures # Stores all the mock data files used in various tests | ||||||
├── plugins # Used to create additional functionalities in Cypress(if required) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
├── support # Main skeleton for the Cypress tests , Custom commands can be added here | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
├── test # Source for the entire testing suite | ||||||
├── utils # Necessary Reusable Code and components for writing tests. | ||||||
file | ||||||
``` | ||||||
|
||||||
## Add your own tests | ||||||
|
||||||
To add your own tests follow the following steps : | ||||||
|
||||||
1. Navigate to the "test" folder . | ||||||
|
||||||
2. Add tests in the respective testing folder : | ||||||
akshatnema marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
For eg : Include tests for "scripts" in the scripts folder . | ||||||
For creating a new component , create a new folder with the same name as component is named in the code . | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not necessary to create a new folder to add a test for a component. It can be a separate file. Important point here is to follow same directory inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will change this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I am reading in this thread, it looks like @reachaadrika has yet to address this feedback from @akshatnema. This section still seems to have incorrect information suggesting one must open a new folder to add a test for a component. |
||||||
|
||||||
3. Create testing files using extension "cy.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the command to do
npm install
with correct npm version and run cypress with appropriate Node version.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reachaadrika This comment is not addressed.