Skip to content

Commit

Permalink
Updated GingerSpec dependency to 2.2.1. Upgraded version in pom for 1…
Browse files Browse the repository at this point in the history
….15 release. Fixed formating of feature files and added new example scenario
  • Loading branch information
jose.fernandez committed Apr 13, 2021
1 parent de8ff90 commit fbf687d
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 59 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.github.privaliatech</groupId>
<artifactId>gingerspec-starter</artifactId>
<version>1.15-RC2</version>
<version>1.15</version>

<name>Archetype - gingerspec-starter</name>
<description>A maven archetype for creating new automation projects based on gingerspec library.</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/archetype-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<properties>
<!-- Check the latest version of gingerspec in: https://mvnrepository.com/artifact/com.github.privaliatech/gingerspec -->
<privalia.gingerspec.version>2.2.1-RC2</privalia.gingerspec.version>
<privalia.gingerspec.version>2.2.1</privalia.gingerspec.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
@rest
Feature: Testing a RestFull API

The @rest annotation is necessary when using GingerSpec Rest steps, here is why:
https://github.com/veepee-oss/gingerspec/wiki/Hook-tags#rest-tag

This example uses https://jsonplaceholder.typicode.com, Fake Online REST API for Testing and Prototyping

Execute this test like this:
mvn verify -Dcucumber.filter.tags="@rest"

You can check a more complete list of steps and examples at:
https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#rest-steps

Scenario: A successful response with a valid body is returned
Given I securely send requests to 'jsonplaceholder.typicode.com:443'
When I send a 'GET' request to '/posts'
Then the service response status must be '200'
And I save element '$.[0].userId' in environment variable 'USER_ID'
Then '${USER_ID}' matches '1'

Scenario: Data in local file is altered using a datatable before sending
Given I securely send requests to 'jsonplaceholder.typicode.com:443'
When I send a 'POST' request to '/posts' based on 'schemas/mytestdata.json' as 'json' with:
| $.title | UPDATE | This is a test 2 |
Then the service response status must be '201'
And I save element '$' in environment variable 'response'
And 'response' matches the following cases:
| $.title | contains | 2 |
| $.body | contains | This is a test |
| $.userId | not equal | 2 |

Scenario: This is an example of a custom REST step
Given I verify that a successful response with a valid body is returned
The @rest annotation is necessary when using GingerSpec Rest steps, here is why:
https://github.com/veepee-oss/gingerspec/wiki/Hook-tags#rest-tag

This example uses https://jsonplaceholder.typicode.com, Fake Online REST API for Testing and Prototyping

Execute this test like this:
mvn verify -Dcucumber.filter.tags="@rest"

You can check a more complete list of steps and examples at:
https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#rest-steps

Scenario: A successful response with a valid body is returned
Given I securely send requests to 'jsonplaceholder.typicode.com:443'
When I send a 'GET' request to '/posts'
Then the service response status must be '200'
And I save element '$.[0].userId' in environment variable 'USER_ID'
Then '${USER_ID}' matches '1'

Scenario: Data in local file is altered using a datatable before sending
Given I securely send requests to 'jsonplaceholder.typicode.com:443'
When I send a 'POST' request to '/posts' based on 'schemas/mytestdata.json' as 'json' with:
| $.title | UPDATE | This is a test 2 |
Then the service response status must be '201'
And I save element '$' in environment variable 'response'
And 'response' matches the following cases:
| $.title | contains | 2 |
| $.body | contains | This is a test |
| $.userId | not equal | 2 |

Scenario: Add the body to be sent directly
Given I securely send requests to 'jsonplaceholder.typicode.com:443'
When I send a 'POST' request to '/posts' with body
"""
{
"userId": 1,
"title": "This is a test",
"body": "This is a test"
}
"""
Then the service response status must be '201'

Scenario: This is an example of a custom REST step
Given I verify that a successful response with a valid body is returned
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
@web
Feature: Testing basic functionality of a web page

The @web annotation is necessary to be included when working with selenium, here is why:
https://github.com/veepee-oss/gingerspec/wiki/Hook-tags#web-tag
The @web annotation is responsible of initializing the driver. Read more here:
https://github.com/veepee-oss/gingerspec/wiki/Running-Selenium-tests

You can run this feature using the following command:
mvn verify -Dcucumber.filter.tags="@web"
You can run this feature using the following command:
mvn verify -Dcucumber.filter.tags="@web"

You can check a more complete list of selenium steps and examples at:
https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#selenium-steps
You can check a more complete list of selenium steps and examples at:
https://github.com/veepee-oss/gingerspec/wiki/Gherkin-steps#selenium-steps

Scenario: Fill the form and click the submit button
Given I go to 'http://demoqa.com/text-box'
And I type 'John' on the element with 'id:userName'
And I type 'john.smith@email.com' on the element with 'id:userEmail'
And I type '123 fake address' on the element with 'id:currentAddress'
When I scroll down until the element with 'id:submit' is visible
And I click on the element with 'id:submit'
Then at least '1' elements exists with 'id:output'
Scenario: Fill the form and click the submit button
Given I go to 'http://demoqa.com/text-box'
And I type 'John' on the element with 'id:userName'
And I type 'john.smith@email.com' on the element with 'id:userEmail'
And I type '123 fake address' on the element with 'id:currentAddress'
When I scroll down until the element with 'id:submit' is visible
And I click on the element with 'id:submit'
Then at least '1' elements exists with 'id:output'

Scenario: Interacting with radio buttons and doing double click
Given I go to 'http://demoqa.com/radio-button'
And I click on the element with 'xpath://input[@id='yesRadio']/following-sibling::label'
And at least '1' elements exists with 'id:yesRadio'
And the element on index '0' IS selected
And I wait '3' seconds
Given I go to 'http://demoqa.com/buttons'
And I double click on the element with 'id:doubleClickBtn'
And I right click on the element with 'id:rightClickBtn'
And I click on the element with 'xpath://button[.='Click Me']'
Scenario: Interacting with radio buttons and doing double click
Given I go to 'http://demoqa.com/radio-button'
And I click on the element with 'xpath://input[@id='yesRadio']/following-sibling::label'
And at least '1' elements exists with 'id:yesRadio'
And the element on index '0' IS selected
And I wait '3' seconds
Given I go to 'http://demoqa.com/buttons'
And I double click on the element with 'id:doubleClickBtn'
And I right click on the element with 'id:rightClickBtn'
And I click on the element with 'xpath://button[.='Click Me']'
Scenario: This is an example of a custom Selenium step
Given Fill the form and click the submit button
Scenario: This is an example of a custom Selenium step
Given Fill the form and click the submit button

0 comments on commit fbf687d

Please sign in to comment.