node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

cucumber-test

Cucumber Test

Made easy - Cucumber testing using webdriver.io, instead of writing complicated test code that only developers can understand, Cucumber maps an ordinary language to code and allows to start with the test process in the early stages of your product development. cucumber-test is a fork of cucumber-boilerplate.

Quick start

  1. npm install -g cucumber-test selenium-standalone
  2. selenium-standalone install
  3. selenium-standalone start
  4. create folder features
  5. add file features/simple.feature
  6. run cct (or cct -b chrome,firefox,safari --timeout 40000 -i 3)

if step 2,3 show some warnings, might be behind proxy / VPN, please check section Behind Proxy / VPN: below.

@simple
Feature:
    Search on Google
 
Scenario: Navigate to Google
    Given I open the url "https://www.google.com"
    Then I expect that the title is "Google"
 
Scenario: Search cucumber-test
    When I set "cucumber-test" to the inputfield "[name=q]"
    And I expect that element "[name=q]" becomes visible
    When I click on the button "input.lsb"
    Then I expect that element "a[href='https://cucumber.io/']" becomes visible

Extended tags

Extended tags will simplify how to write cucumber with different browser & environment, those information are available on the browser object, utilize during execution of the cucumber file:

// Browsers
@__chrome            ><  @__non_chrome
@__safari            ><  @__non_safari
@__firefox           ><  @__non_firefox
@__microsoftedge     ><  @__non_microsoftedge
@__internetexplorer  ><  @__non_internetexplorer
 
// Mobile specific
@__android           ><  @__non_android
@__mobile            ><  @__non_mobile
@__ios               ><  @__non_ios

Sample usage can be seen on the example below Search on Google, when it get executed on the desktop browser like chrome, firefox or IE, it will pickup scenario with:

@__non_safari @__non_mobile and the @__mobile will be filtered

and viceversa will happened when it get executed on mobile.

Appium

Android Device

please check the developer tools security options, ensure them to be checked.

  • USB debugging
  • USB debugging(Security settings)
@simple
Feature: Search on Google
    Search should be on the google website
    and the first should be cucumber.io
 
Scenario: Navigate to Google
    Given I open the url "https://www.google.com"
    Then I expect that the title is "Google"
 
@__non_safari @__non_mobile
Scenario: Search cucumber-test on desktop browser
    When I set "cucumber-test" to the inputfield "[name=q]"
    And I expect that element "[name=q]" becomes visible
    When I click on the button "input.lsb"
    Then I expect that element "a[href='https://cucumber.io/']" becomes visible
 
@__mobile
Scenario: Search cucumber-test on mobile browser
    When I set "cucumber-test" to the inputfield "[name=q]"
    And I expect that element "[name=q]" becomes visible
    When I click on the button "[name=btnG]"
    Then I expect that element "a[href='https://cucumber.io/']" becomes visible
# Install appium server 
npm install -g appium appium-doctor
# run appium & connect your android device using USB 
appium
# check deviceName - adb devices & pass to deviceName:android version 
cct --android f344ee26:7.0

Integration with: BrowserStack

Add these env variables from your BrowserStack user & key:

export BROWSERSTACK_ACCESS_KEY=xxXXXxXxXxXxxXxXXXxx
export BROWSERSTACK_USERNAME=cucumber-test
cct -c browserstack

alt #D Saucelabs

Integration with: Sauce Labs

Add these env variables from your SauceLabs user & key:

export SAUCE_ACCESS_KEY=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SAUCE_USERNAME=cucumber-test
cct -c saucelabs:connect
cct -c saucelabs

alt #D Saucelabs

Behind Proxy / VPN:

npm install -g selenium-standalone@latest
NODE_TLS_REJECT_UNAUTHORIZED=0 selenium-standalone install
NODE_TLS_REJECT_UNAUTHORIZED=0 selenium-standalone start
NODE_TLS_REJECT_UNAUTHORIZED=0 cct -t '@simple or @smoke'

Dev Mode

cd ~/.nvm/versions/node/v8.8.1/lib/node_modules
ln -s /Users/wharsojo/Dev/cucumber-test cucumber-test

License

MIT