Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wdio cucumber runner doesn't always show test results #1611

Closed
gsccheng opened this issue Sep 24, 2016 · 2 comments
Closed

Wdio cucumber runner doesn't always show test results #1611

gsccheng opened this issue Sep 24, 2016 · 2 comments
Labels
Needs Investigation Issues that require more information on the problem.

Comments

@gsccheng
Copy link

The problem

I'm not sure where to post this issue but I'll start here at the top level since I use the wdio test runner with Cucumber.

I think I may be getting a race condition where my spec reporter doesn't always show the test result because the runner is ending prematurely. It seems to only occur when there are multiple browser commands, whether they are in the same step definition or not.

Environment

  • WebdriverIO version: 4.2.8
  • Node.js version: 4.4.7
  • Standalone mode or wdio testrunner: wdio testrunner
  • if wdio testrunner, running synchronous or asynchronous tests: Synchronous
  • Additional wdio packages used (if applicable):
    wdio-spec-reporter: 0.0.3
    wdio-cucumber-framework: 0.2.4
    chai: 3.3.0

Code To Reproduce Issue

I simplified my code into these code snippets. I'm wondering if anyone can reproduce this.

Here's my gist to the config file

// features/auth.feature
 Feature: Auth
   Some description

  Scenario: Google Auth
   Given this should work
// features/step_definitions/auth.js
import { expect } from 'chai';
[...]
  this.Given(/^this should work$/, function () {
    browser.url('https://google.com');
    browser.getSource();
    expect('foo').to.exist;
  });
// Output: 
myApp [testing] :> npm run ui-test

> react-redux-universal-hot-example@0.9.0 ui-test /Users/GabbAHH/Desktop/Dev/myApp
> better-npm-run ui-test

running better-npm-run in /Users/GabbAHH/Desktop/Dev/myApp
Executing script: ui-test

to be executed: ./node_modules/.bin/wdio wdio.conf.js

=======================================================================================
Selenium 2.0 / webdriver protocol bindings implementation with helper commands in nodejs.
For a complete list of commands, visit http://webdriver.io/api.html.
=======================================================================================

[16:02:15]  COMMAND POST     "/wd/hub/session"
[16:02:15]  DATA        {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":6,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.2.8","name":"webdriverio"}}}
[16:02:17]  INFO    SET SESSION ID 42e1e89c-0bbb-4553-b7d7-bce852f847cf
[16:02:17]  RESULT      {"applicationCacheEnabled":false,"rotatable":false,"mobileEmulationEnabled":false,"networkConnectionEnabled":false,"chrome":{"chromedriverVersion":"2.23.409710 (0c4084804897ac45b5ff65a690ec6583b97225c0)","userDataDir":"/var/folders/59/6pd62vqn20j5qx2hv1l1w9_r0000gn/T/.org.chromium.Chromium.FUqeyq"},"takesHeapSnapshot":true,"pageLoadStrategy":"normal","databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"version":"53.0.2785.116","platform":"MAC","browserConnectionEnabled":false,"nativeEvents":true,"acceptSslCerts":true,"webdriver.remote.sessionid":"42e1e89c-0bbb-4553-b7d7-bce852f847cf","locationContextEnabled":true,"webStorageEnabled":true,"browserName":"chrome","takesScreenshot":true,"javascriptEnabled":true,"cssSelectorsEnabled":true}
[16:02:18]  COMMAND POST     "/wd/hub/session/42e1e89c-0bbb-4553-b7d7-bce852f847cf/url"
[16:02:18]  DATA        {"url":"https://google.com"}
[16:02:25]  RESULT      null
[16:02:25]  COMMAND GET      "/wd/hub/session/42e1e89c-0bbb-4553-b7d7-bce852f847cf/source"
[16:02:25]  DATA        {}
[16:02:25]  RESULT      "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\" itemscope=\"\" itemtype=\"http://schema.org/WebPage\" lang=\"en\"><head><meta content=\"Search the world's information, including webpages, ... (230174 more bytes)
[16:02:25]  COMMAND DELETE   "/wd/hub/session/42e1e89c-0bbb-4553-b7d7-bce852f847cf"
[16:02:25]  DATA        {}
[16:02:25]  RESULT      null

Now if I remove the second command of browser.getSource(), I am able to complete the test properly:
So,

// features/step_definitions/auth.js
  this.Given(/^this should work$/, function () {
    browser.url('https://google.com');
    expect('foo').to.exist;
  });

gives:

myApp [testing] :> npm run ui-test

> react-redux-universal-hot-example@0.9.0 ui-test /Users/GabbAHH/Desktop/Dev/myApp
> better-npm-run ui-test

running better-npm-run in /Users/GabbAHH/Desktop/Dev/myApp
Executing script: ui-test

to be executed: ./node_modules/.bin/wdio wdio.conf.js

=======================================================================================
Selenium 2.0 / webdriver protocol bindings implementation with helper commands in nodejs.
For a complete list of commands, visit http://webdriver.io/api.html.
=======================================================================================

[16:02:41]  COMMAND POST     "/wd/hub/session"
[16:02:41]  DATA        {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":6,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.2.8","name":"webdriverio"}}}
[16:02:44]  INFO    SET SESSION ID 2ef670fe-d842-4052-8d24-260e48fcb376
[16:02:44]  RESULT      {"applicationCacheEnabled":false,"rotatable":false,"mobileEmulationEnabled":false,"networkConnectionEnabled":false,"chrome":{"chromedriverVersion":"2.23.409710 (0c4084804897ac45b5ff65a690ec6583b97225c0)","userDataDir":"/var/folders/59/6pd62vqn20j5qx2hv1l1w9_r0000gn/T/.org.chromium.Chromium.GidKiN"},"takesHeapSnapshot":true,"pageLoadStrategy":"normal","databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"version":"53.0.2785.116","platform":"MAC","browserConnectionEnabled":false,"nativeEvents":true,"acceptSslCerts":true,"webdriver.remote.sessionid":"2ef670fe-d842-4052-8d24-260e48fcb376","locationContextEnabled":true,"webStorageEnabled":true,"browserName":"chrome","takesScreenshot":true,"javascriptEnabled":true,"cssSelectorsEnabled":true}
[16:02:45]  COMMAND POST     "/wd/hub/session/2ef670fe-d842-4052-8d24-260e48fcb376/url"
[16:02:45]  DATA        {"url":"https://google.com"}
[16:02:50]  RESULT      null
[16:02:50]  COMMAND DELETE   "/wd/hub/session/2ef670fe-d842-4052-8d24-260e48fcb376"
[16:02:50]  DATA        {}
[16:02:50]  RESULT      null
------------------------------------------------------------------
[chrome #0a] Session ID: 2ef670fe-d842-4052-8d24-260e48fcb376
[chrome #0a] Spec: /Users/GabbAHH/Desktop/Dev/myApp/features/auth.feature
[chrome #0a] Running: chrome
[chrome #0a]
[chrome #0a]   Auth
[chrome #0a]
[chrome #0a]     Google Auth
[chrome #0a]         ✓ this should work
[chrome #0a]
[chrome #0a]
[chrome #0a] 1 passing (9s)
[chrome #0a]
@christian-bromann christian-bromann added the Needs Investigation Issues that require more information on the problem. label Sep 25, 2016
@msegado
Copy link

msegado commented Oct 6, 2016

@gsccheng, do you have screenshots enabled? I'm wondering if this is the same underlying issue as #1591.

@christian-bromann
Copy link
Member

This issue was moved to webdriverio-boneyard/wdio-cucumber-framework#38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation Issues that require more information on the problem.
Projects
None yet
Development

No branches or pull requests

3 participants