https://github.com/sridharbandi/bcmar22-aws-js-cypress
https://github.com/sridharbandi/bcmar22-aws-js-cypress
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sridharbandi/bcmar22-aws-js-cypress
- Owner: sridharbandi
- Created: 2025-03-22T08:49:22.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-22T20:54:26.000Z (7 months ago)
- Last Synced: 2025-05-19T01:12:59.636Z (5 months ago)
- Language: JavaScript
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# JS Cypress Project
This project is a test automation framework using Cypress for end-to-end testing of web applications.
## Pre-requisites
Before you begin, ensure you have met the following requirements:
- [Node](https://nodejs.org/en/download)
- [Visual Studio Code](https://code.visualstudio.com/download) (optional)## Installation
First, clone the repository and change to the project directory:
```bash
git clone https://github.com/Axone-Tech/js-cypress.git
cd js-cypress
```To install the project dependencies, run the following command:
```bash
npm install
```## Usage
To run the tests, use the following command:
```bash
npx cypress open
```This will open the Cypress Test Runner, where you can run your tests interactively.
Alternatively, to run the tests in headless mode, use:
```bash
npx cypress run
```To run the tests in headed mode, use:
```bash
npx cypress run --headed
```## Project Structure
- `cypress/`: Contains all the test files and configurations.
- `cypress/integration/`: Contains the test specifications.
- `cypress/fixtures/`: Contains test data.
- `cypress/support/`: Contains support files and custom commands.## Writing Tests
To write a new test, create a new file in the `cypress/integration/` directory with a `.spec.js` extension. Here is an example test:
```javascript
describe('My First Test', () => {
it('Visits the Kitchen Sink', () => {
cy.visit('https://example.cypress.io')
cy.contains('type').click()
cy.url().should('include', '/commands/actions')
cy.get('.action-email').type('fake@email.com').should('have.value', 'fake@email.com')
})
})
```## Reports
To generate test reports, you can use the `cypress-mochawesome-reporter` plugin. First, install the plugin:
```bash
npm install --save-dev cypress-mochawesome-reporter
```Then, add the following configuration to your `cypress.json` file:
```json
{
"reporter": "cypress-mochawesome-reporter",
"reporterOptions": {
"reportDir": "cypress/reports",
"overwrite": false,
"html": true,
"json": true
}
}
```Finally, run your tests with the following command to generate the reports:
```bash
npx cypress run
```The reports will be generated in the `cypress/reports` directory.