codeceptjs / CodeceptJS

Supercharged End 2 End Testing Framework for NodeJS
http://codecept.io
MIT License
4.1k stars 722 forks source link

Test fails on Safari start with selenium-standalone #1241

Closed alexTimosh closed 5 years ago

alexTimosh commented 5 years ago

such error appeared Immediately after startup and session was stopped. At the same time test works perfectly on a earlier codeceptjs versions (i.e. ˜0.6).

    [1] Starting recording promises
    Emitted | suite.before ([object Object])
  Check Sign In form
    Emitted | test.before ([object Object])
    [1] Error | Error: Unknown timeout type in 'timeouts': 'type'
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'Alexeys-MacBook-Pro.local', ip: '', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '10.0.2'
Driver info: driver.version: unknown
    Emitted | test.failed ([object Object])
  ✖ "before each" hook: codeceptjs.before for "Check Sign In form" in 20853ms
    [1] Error | Error: Unknown timeout type in 'timeouts': 'type'
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'Alexeys-MacBook-Pro.local', ip: '', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '10.0.2'
Driver info: driver.version: unknown
Error: Unknown timeout type in 'timeouts': 'type'
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'Alexeys-MacBook-Pro.local', ip: '', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '10.0.2'
Driver info: driver.version: unknown
    Emitted | test.after ([object Object])
    Emitted | suite.after ([object Object])

-- FAILURES:

  1) Suite 1
       "before each" hook: codeceptjs.before for "Check Sign In form":
     Unknown timeout type in 'timeouts': 'type'
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
System info: host: 'Alexeys-MacBook-Pro.local', ip: '', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '10.0.2'
Driver info: driver.version: unknown
  rror: Unknown timeout type in 'timeouts': 'type'
  Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z'
  System info: host: 'Alexeys-MacBook-Pro.local', ip: ', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '10.0.2'
  Driver info: driver.version: unknown
      at new RuntimeError (node_modules/webdriverio/build/lib/utils/ErrorHandler.js:143:12)
      at Request._callback (node_modules/webdriverio/build/lib/utils/RequestHandler.js:316:39)
      at Request.self.callback (node_modules/request/request.js:185:22)
      at Request.EventEmitter.emit (domain.js:442:20)
      at Request.<anonymous> (node_modules/request/request.js:1161:10)
      at Request.EventEmitter.emit (domain.js:442:20)
      at IncomingMessage.<anonymous> (node_modules/request/request.js:1083:12)

  FAIL  | 0 passed, 1 failed   // 21s
    Emitted | global.result ([object Object])
    Emitted | global.after ([object Object])

Provide test source code if related

Feature('Suite 1');

Scenario('Check Sign In form', (I) => {
    I.amOnPage('https://any.test.page.com')

})

Details

alexTimosh commented 5 years ago

UPD: This bug appeared at 1.0.1. Version 1.0.0 could play tests in Safari.

elukoyanov commented 5 years ago

This looks like webdriverio integration compatability problem.

Safari uses W3C only spec, so defineTimeouts should use await this.browser.timeouts(timeouts);

But Codecept uses await this.browser.timeouts('<name of timeout>', timeouts["<name of timeout>"]); It's not supported by Safari.

Chrome uses second type of assignments, and gets error "unknown error: 'ms' must be a double", if use first type. Cause it should get {type: type, ms: ms} object instead of {type: ms}

We should search how to fix this error.

p.s Safari 11- support JsonWire Protocol. Safari 12 use W3C without JsonWire protocol Others browsers are backward compatible, as I know This is a problem.

alexTimosh commented 5 years ago

Fixed. @LukoyanovE Thanks a lot!

lokesh-rj commented 5 years ago

Tests are failing on Safari and the same are getting executed successfully on other browsers like Chrome and firefox.

CodeceptJS - 2.0.7 Helper being used - WebDriver 5.7.5

elukoyanov commented 5 years ago

Safri version please

lokesh-rj commented 5 years ago

Hi @LukoyanovE , Mac - 10.14 and Safari - 12.

And, I am executing my tests on Sauce Labs.