0.8.2 • Published 9 months ago

@qavajs/template v0.8.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@qavajs/template

Library that allow to define step definitions on Gherkin language.

Templates

Feature: Templates

  Scenario: 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

Feature: Auth

  Scenario: 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

module.exports = {
    default: {
        requireModule: [
            '@qavajs/template'
        ],
        templates: ['templates/*.feature']
    }
}

Parameters

Templates also can accept parameters as <param> e.g

Feature: Templates

  Scenario: I login as '<username>' with '<password>' password
    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 with actual params

Feature: Auth

  Scenario: 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

Feature: TextArea

  Scenario: Verify that user is able to login
    When I set text area:
    """
    this
    is
    multiline
    text
    """

Multiline data can be accessed by <qavajsMultiline> formal parameter in template

Feature: Templates

  Scenario: I set text area:
    When I type '<qavajsMultiline>' to 'Form > Text Area'

Key Value Params

Multiple parameters can be passed in form of key-value data table

Feature: TextArea

  Scenario: 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

Feature: Templates

  Scenario: I fill registration form:
    When I type '<name>' to 'Form > Name'
    When I type '<position>' to 'Form > Position'
0.8.2

9 months ago

0.8.1

1 year ago

0.8.0

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.3

2 years ago

0.0.4

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago