-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62c18b3
commit 48bd39b
Showing
3 changed files
with
103 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |