Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
peterszeles committed Apr 18, 2021
1 parent 62c18b3 commit 48bd39b
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 36 deletions.
122 changes: 88 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Cypress Cucumber testing DSL
# Cypress Cucumber testing DSL πŸ₯’ πŸš€

This is a project for UI/UX purposes with Cypress and Cucumber frameworks.
There is implemented a unique DSL (Domain Specific Language) usage placed in folder cypress/tests/common.


## Installation
## Installation βš™οΈ

- Install [NodeJS](https://nodejs.org/en/) \
- Use the [CLI](https://www.w3schools.com/whatis/whatis_cli.asp) to install this project.
Expand All @@ -14,7 +14,7 @@ git clone https://github.com/peterszeles/cypress-cucumber-testing.git
npm intall
```

## Running
## Running ⏳

To open the Cypress UI use this command:
```bash
Expand All @@ -31,50 +31,98 @@ To run all Gherkin tests use this command:
npm test
```

## Supported Gherkin commands
## Supported Gherkin commands πŸ₯’ πŸ”¦

Given, When, Then, And

| Command | Description |
| ------- | ----------- |
| I am on "string" page | |
| I click on input "string" | |
| I click on Nth "string" | |
| I click on Nth "string" button | |
| I click on "string" | |
| I click on "string" button | |
| I click on "string" link | |
| I scroll "string" into view | |
| I scroll to "string" at "string" | |
| I see "string" in the title | |
| I see "string" on the page | |
| I select from dropdown "string" "string" | |
| I select "string" | |
| Label "string" is present | |
| Set input at label "string" to "string" | |
| Set input "string" to "string" | |
| Command | Expression |
| --- | --- |
| Given / When / Then / And | I am on "string" page |
| Given / When / Then / And | I click on input "string" |
| Given / When / Then / And | I click on Nth "string" |
| Given / When / Then / And | I click on Nth "string" button |
| Given / When / Then / And | I click on "string" |
| Given / When / Then / And | I click on "string" button |
| Given / When / Then / And | I click on "string" link |
| Given / When / Then / And | I scroll "string" into view |
| Given / When / Then / And | I scroll to "string" at "string" |
| Given / When / Then / And | I see "string" in the title |
| Given / When / Then / And | I see "string" on the page |
| Given / When / Then / And | I select from dropdown "string" "string" |
| Given / When / Then / And | I select "string" |
| Given / When / Then / And | Label "string" is present |
| Given / When / Then / And | Set input at label "string" to "string" |
| Given / When / Then / And | Set input "string" to "string" |


## Develop a Gherkin command πŸ’»
Use any JavaScript file in test/common folder as a template
```javascript
import {Given, When, Then, And} from "cypress-cucumber-preprocessor/steps";

Given(`Expression {string}`, (str) => {
/** Here goes the implementation of the Gherkin command
* Use the Cypress documentation for implementing the test.
* @str is the variable from inside the Expression.
* You can use STRING or NUMBER
* as many as it is **/

});

When(`Expression {string}`, (str) => {
/** Here goes the implementation of the Gherkin command
* Use the Cypress documentation for implementing the test.
* @str is the variable from inside the Expression.
* You can use STRING or NUMBER
* as many as it is **/

});

Then(`Expression {string}`, (str) => {
/** Here goes the implementation of the Gherkin command
* Use the Cypress documentation for implementing the test.
* @str is the variable from inside the Expression.
* You can use STRING or NUMBER
* as many as it is **/

});

And(`Expression {string}`, (str) => {
/** Here goes the implementation of the Gherkin command
* Use the Cypress documentation for implementing the test.
* @str is the variable from inside the Expression.
* You can use STRING or NUMBER
* as many as it is **/

});

```gherkin

```

## Develop a Gherkin command

## Usage

## Usage βš™οΈ
Create a new folder at folder tests/common which describes the testing domain.
Inside in this new folder create a Gherkin file type .feature
```gherkin
@custom-tag
# The NAME of the feature testing file
Feature: The name of the feature
# The description
Here goes the description
Scenario: The name or description of scenario
Given I am on "https://getbootstrap.com/docs/5.0/forms/form-control/" page
When I set input at label "Email address" to "[email protected]"
Then I set input at label "Example textaera" to "Lorem ipsum."
# First scenario
Given I am on "https://github.com/peterszeles/cypress-cucumber-testing" page
When I click on "Go to file"
Then I click on "cypress/fixtures/example.json"
# Second scenario
Scenario: Another scenario
Given I am on "https://github.com/peterszeles/cypress-cucumber-testing/blob/master/cypress/fixtures/example.json" page
Then I see "cypress-cucumber-testing" on the page
```

## Google Sheets format
## Google Sheets format πŸ—„
To use Google Sheets for implementig test scenarios
- create a developer google site
- cleate a google sheet
Expand All @@ -84,10 +132,16 @@ To use Google Sheets for implementig test scenarios
node sheets/snippet.js
```

## Contributing
## Contributing πŸ₯’ πŸ“βœ‚οΈβœ’οΈ
You are welcome to contribute on this project. By contributing you can make testers life easyer πŸ™‚ \
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
## License πŸ›’πŸ”’
[MIT](https://choosealicense.com/licenses/mit/)

## Links πŸ”—
[KPI - Department of comupters and informatics](https://kpi.fei.tuke.sk/en) \
[Technical University of Kosice](https://www.tuke.sk/wps/portal)

Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

Scenario: Testing the bootstrap components
Given I am on "https://getbootstrap.com/docs/5.0/forms/form-control/" page
Then I set input at label "Email address" to "[email protected]"
Then I set input at label "Example textaera" to "Lorem ipsum."
Then Set input at label "Email address" to "[email protected]"
Then Set input at label "Example textaera" to "Lorem ipsum."
13 changes: 13 additions & 0 deletions cypress/tests/examples/github.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@custom-tag
Feature: The name of the feature

Here goes the description

Scenario: The name or description of scenario
Given I am on "https://github.com/peterszeles/cypress-cucumber-testing" page
When I click on "Go to file"
Then I click on "cypress/fixtures/example.json"

Scenario: Another scenario
Given I am on "https://github.com/peterszeles/cypress-cucumber-testing/blob/master/cypress/fixtures/example.json" page
Then I see "cypress-cucumber-testing" on the page

0 comments on commit 48bd39b

Please sign in to comment.