Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qavajs/template
library that allow to define step definitions on Gherkin language
https://github.com/qavajs/template
qa test-automation testing
Last synced: about 1 month ago
JSON representation
library that allow to define step definitions on Gherkin language
- Host: GitHub
- URL: https://github.com/qavajs/template
- Owner: qavajs
- License: mit
- Created: 2022-07-06T06:57:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-05T08:45:30.000Z (6 months ago)
- Last Synced: 2024-08-09T22:34:57.864Z (5 months ago)
- Topics: qa, test-automation, testing
- Language: TypeScript
- Size: 850 KB
- Stars: 12
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.MD
- License: LICENSE
Awesome Lists containing this project
README
# @qavajs/template
Library that allow to define step definitions on Gherkin language.## Installation
`npm install @qavajs/template`## Templates
```gherkin
Feature: TemplatesScenario: I login
When I open 'https://your-app.com'
And I type 'username' to 'Login Form > Username Input'
And I type 'password' to 'Login Form > Password Input'
And I click 'Login Form > Login Button'
```Then following template can be called from scenario as simple step
```gherkin
Feature: AuthScenario: Verify that user is able to login
When I login
Then I expect 'Header' to be visible
```## Configuration
To use templates their location need to be passed to templates property of config file and library need to be listed
in require
```javascript
module.exports = {
default: {
requireModule: [
'@qavajs/template'
],
templates: ['templates/*.feature']
}
}```
## Parameters
Templates also can accept parameters as `` e.g```gherkin
Feature: TemplatesScenario: I login as '' with '' password
When I open 'https://your-app.com'
And I type '' to 'Login Form > Username Input'
And I type '' to 'Login Form > Password Input'
And I click 'Login Form > Login Button'
```Then following template can be called with actual params
```gherkin
Feature: AuthScenario: Verify that user is able to login
When I login as 'admin' with 'admin' password
Then I expect 'Header' to be visible
```## Multiline parameter
It is also possible to pass multi line parameter to template
```gherkin
Feature: TextAreaScenario: Verify that user is able to login
When I set text area:
"""
this
is
multiline
text
"""
```Multiline data can be accessed by `` formal parameter in template
```gherkin
Feature: TemplatesScenario: I set text area:
When I type '' to 'Form > Text Area'
```## Key Value Params
Multiple parameters can be passed in form of key-value data table
```gherkin
Feature: TextAreaScenario: Verify that user is able to login
When I fill registration form:
| name | John Dou |
| position | Test Automation Engineer |
```And values can be accessed by corresponding keys
```gherkin
Feature: TemplatesScenario: I fill registration form:
When I type '' to 'Form > Name'
When I type '' to 'Form > Position'
```