webdriverio-boneyard / wdio-mocha-framework Goto Github PK
View Code? Open in Web Editor NEWA WebdriverIO v4 plugin. Adapter for Mocha testing framework.
License: MIT License
A WebdriverIO v4 plugin. Adapter for Mocha testing framework.
License: MIT License
I just use async functions in my describe
and it
and have no use for wdio-sync
. I would prefer not to have fibers
lurking around in my subdeps. It's not 100% necessary for using mocha, is it?
Alternatively I'm thinking of looking into making a wdio-async-mocha-framework
(and a corresponding wdio-async
with the equivalent wrapCommands
etc.)
I am unable to get the require file to transpile before being used as shown in the README.md example for this repo. I get the following exception when trying to add a module written in the es2015 syntax:
SyntaxError: Unexpected reserved word
This is my mocha setup:
mochaOpts: {
ui: 'bdd',
compilers: ['js:babel-register'],
require: './wdio-mocha-setup.js'
}
An example wdio-mocha-setup.js
file:
import chai from 'chai';
Branch | Build failing π¨ |
---|---|
Dependency | babel-preset-stage-0 |
Current Version | 6.22.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-preset-stage-0 is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
I tried run with wdio-conf.js where wdio-mocha-framework not getting installed successfully.
I tried windows with node 8.1.3, 7.10, and 6.11.1
most of the nodejs version seems to be not supporting it.
please let me know what's the workaround.
I'm trying to get a wdio environment set up and ran across this message after switching from Jasmine to Mocha.
I don't think it has anything to do with the wdio reporter output - I got the same TypeError
when using both spec
and dot
reporters. It might be related to the screenshot output, but I'm really not certain.
[01:10:45] Saved screenshot: ERROR_firefox_2017-06-25T05-10-45.083Z.png
TypeError: Converting circular structure to JSON
at Object.stringify (native)
at process.target._send (internal/child_process.js:635:23)
at process.target.send (internal/child_process.js:547:19)
at /usr/local/lib/node_modules/webdriverio/build/lib/runner.js:484:25
at execHook (/usr/local/lib/node_modules/wdio-mocha-framework/node_modules/wdio-sync/build/index.js:157:35)
F
0 passing (5.20s)
1 failing
1) Login form should reject bad credentials:
An element could not be located on the page using the given search parameters ("span.help-block").
running firefox
Error: An element could not be located on the page using the given search parameters ("span.help-block").
at Promise.F (/usr/local/lib/node_modules/wdio-mocha-framework/node_modules/core-js/library/modules/_export.js:35:28)
at elements([object Object]) - setValue.js:29:17
at setValue([object Object], "foo") - at Context.<anonymous> (test/specs/basic.spec.js:13:17)
Let me know if there's anything else I can supply that might help debug this. Thanks!
I think the problem line is https://github.com/webdriverio/wdio-mocha-framework/blob/master/lib/adapter.js#L69. The ...requires, ...compilers
should be switched to ...compilers, ...requires
so that the compilers are included first. This would allow the requires to be written using whatever compiler you are using, instead of forcing the requires to be written using the language level that your version of node supports.
getting this error while attempting to use this module with webdriverio
Error: no such session
at Object.Future.wait (/path/to/node_modules/wdio-mocha-framework/node_modules/wdio-sync/node_modules/fibers/future.js:449:15)
at Object.close (/path/to/node_modules/wdio-mocha-framework/node_modules/wdio-sync/build/index.js:353:31)
at Object.exports.config.after (/path/to/wdio.conf.js:190:15)
at /path/to/node_modules/wdio-mocha-framework/node_modules/wdio-sync/build/index.js:251:34
using 0.3.5, with webdriverio 4.2.1
It appears the mocha test files aren't passing the "done" callback parameter in the frame work. Example below:
package.json
"dependencies": {
"wdio-mocha-framework": "^0.3.1",
"wdio-selenium-standalone-service": "0.0.5",
"webdriverio": "^4.0.9"
}
sample.conf.js
exports.config = {
specs: [
'./tests/login.js'
],
maxInstances: 10,
capabilities: [{
maxInstances: 1,
browserName: 'chrome'
}],
sync:true,
services: ['selenium-standalone'],
reporters: ['spec'],
mochaOpts: {
ui: 'bdd'
}
}
tests/login.js
var assert = require('assert');
describe('sample login page', function() {
it('Should load the correct page', function () {
browser.url('https://www.sample.com');
assert.equal(browser.getTitle(), 'Sample Title');
});
it('Log in to sample.com', function() {
browser
.setValue('input#Username', 'sample')
.setValue('input#Password', 'sample')
.submitForm('form[name=sample]')
.waitForVisible('input[name=somethingOnNextPage]', 10000);
assert.equal(browser.getTitle(), 'Sample Title');
});
it('Send slack notification if error', function(done) {
//webhook(channel, message, cb)
slack_api.webhook('@sampleuser', 'Sample Message', function(err, resp){
if (err) return assert(false, 'Slack notification failed: '+err);
done();
});
});
});
But the slack notification (and several other attempted variants with page interaction) error out with the following:
TypeError: done is not a function
at Context.<anonymous> (/Sample/Path/App_Repo/tests/login.js:26:13)
at Context.executeSync (/Sample/Path/App_Repo/node_modules/wdio-sync/build/index.js:620:12)
at /Sample/Path/App_Repo/node_modules/wdio-sync/build/index.js:814:34
Running these tests directly with Mocha runs fine, so something is happening in the wdio import of the test files. I should note I've tried setting the sample.conf.js sync value to false
as well, but this just means that it finishes without waiting for anything and the mocha tests still don't have a defined done
function. Similar results setting the async-only: true
mochaOpts in the sample.conf.js
From the command line, mocha supports an '--exit' parameter that kills the process on exit. This is important to avoid having the process hanging: https://mochajs.org/#--exit----no-exit
When this happens with wdio, mocha hangs and the test run never completes. We should either allow the caller to configure a callback function on Mocha.run to simulate that, orhave an exit configuration and handle the force exit process on this library.
This is rather future-improvement than critical bug...
Description of the situation:
I have a project where I use wdio-mocha-framework to run functional tests...but I also have mocha installed for my unit tests in the same project. The problem was that I had mocha in version ^3.x.x in my package.json and after last upadate I've got an error:
[chrome #0-0] Resolution method is overspecified. Specify a callback *or* return a Promise; not both. [chrome #0-0] Error: Resolution method is overspecified. Specify a callback *or* return a Promise; not both. [chrome #0-0] at /home/przemuh/project/tests/functional/node_modules/mocha/lib/runnable.js:380:21 [chrome #0-0] at /home/przemuh/project/tests/functional/node_modules/wdio-mocha-framework/build/adapter.js:311:28 [chrome #0-0] at process._tickDomainCallback (internal/process/next_tick.js:129:7)
Linked mocha issue: mochajs/mocha#2407
So my question is: Do you plan to increase mocha version in wdio-mocha-framework package.json ?
Branch | Build failing π¨ |
---|---|
Dependency | eslint-plugin-standard |
Current Version | 2.2.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint-plugin-standard is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
The mighty 'Mochawesome' reporter adds a context
key to the test object:
https://github.com/adamgruber/mochawesome/blob/master/src/addContext.js#L85
However, the wdio-mochawesome-reporter
is not currently receiving this information:
webdriverio-community/wdio-mochawesome-reporter#3 (comment)
I think this might be because wdio-mocha-framework
is forwarding just the keys it is interested in:
If my guess is correct, would it be possible for wdio-mocha-framework
to pass on these keys too?
Thanks.
Hello, I'm facing a similar issue as described in mochajs/mocha#1014 thread. I have a test suite with 100+ scenarios, and also I have beforeEach hook. But sometimes something may go wrong and 'beforeEach' hook can be failed. I don't need to stop the whole test suite execution, instead, I need to continue execution of the following test scenarios. But it looks like mocha just exits and test execution is stopped. I tried the solution from mochajs/mocha#1014, changed some parts of the code and it works as I need. Could someone add this fix to wdio-mocha-framework? Thanks!
@christian-bromann could you please make a new release of wdio-sync
(fibers
update
webdriverio-boneyard/wdio-sync@dce97e0) and use this release for an updated release here?
Out tests are failing for node v12: maplibre/maputnik#514
I'm getting the error below when I run wdio wdio.conf.js
on circleci.com.
[0] Running on http://10.0.4.1:4001 [copied to clipboard]
[1] ## There is an issue with `node-fibers` ##
[1] `/home/ubuntu/myproject/node_modules/wdio-mocha-framework/node_modules/wdio-sync/node_modules/fibers/bin/linux-x64-51/fibers.node` is missing.
[1]
[1] Try running this to fix the issue: /opt/circleci/nodejs/v7.5.0/bin/node /home/ubuntu/myproject/node_modules/wdio-mocha-framework/node_modules/wdio-sync/node_modules/fibers/build
[1] ERROR: Couldn't initialise framework "wdio-mocha-framework".
[1] Error: Missing binary. See message above.
[1] at Object.<anonymous> (/home/ubuntu/myproject/node_modules/wdio-mocha-framework/node_modules/wdio-sync/node_modules/fibers/fibers.js:20:8)
[1] at Module._compile (module.js:571:32)
[1] at Object.Module._extensions..js (module.js:580:10)
[1] at Module.load (module.js:488:32)
[1] at tryModuleLoad (module.js:447:12)
[1] at Function.Module._load (module.js:439:3)
[1] at Module.require (module.js:498:17)
[1] at require (internal/module.js:20:19)
[1] at Object.<anonymous> (/home/ubuntu/myproject/node_modules/wdio-mocha-framework/node_modules/wdio-sync/node_modules/fibers/future.js:2:13)
[1] at Module._compile (module.js:571:32)
[1]
[1] at Runner.initialiseFramework (/home/ubuntu/myproject/node_modules/webdriverio/build/lib/runner.js:561:27)
[1] at Runner._callee3$ (/home/ubuntu/myproject/node_modules/webdriverio/build/lib/runner.js:120:55)
[1] at tryCatch (/home/ubuntu/myproject/node_modules/webdriverio/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:64:40)
[1] at Generator.invoke [as _invoke] (/home/ubuntu/myproject/node_modules/webdriverio/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:355:22)
[1] at Generator.prototype.(anonymous function) [as next] (/home/ubuntu/myproject/node_modules/webdriverio/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:116:21)
[1] at step (/home/ubuntu/myproject/node_modules/webdriverio/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
[1] at /home/ubuntu/myproject/node_modules/webdriverio/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
[1] at F (/home/ubuntu/myproject/node_modules/webdriverio/node_modules/babel-runtime/node_modules/core-js/library/modules/_export.js:35:28)
[1] at Runner.<anonymous> (/home/ubuntu/myproject/node_modules/webdriverio/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)
[1] at Runner.run (/home/ubuntu/myproject/node_modules/webdriverio/build/lib/runner.js:351:29)
It would be nice if wdio-mocha-framwork supported custom mocha interfaces.
My use case is rather complex and I wanted to "extend" describe to handle some logic for the user (setting up the connection to our benchmarking service and closing the session after the test is done). The reason why I didn't want to use beforeSuite/afterSuite is because I didn't want all suites to create sessions.
My problem is that wdio-mocha-framwork rejects my interface because it is not in the INTERFACES object. I was not sure what the wrapping commands in fiber context is for (though it looks need) and I haven't looked into it too much. However I did try adding my interface to the INTERFACES object as a hack and it seemed to work.
Does this seem like a reasonable request?
Branch | Build failing π¨ |
---|---|
Dependency | babel-runtime |
Current Version | 6.25.0 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
babel-runtime is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you itβs very likely also breaking them.
I recommend you give this issue a very high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
It seems like there's a problem with ES6 imports, can i somehow fix this?
When running mocha independend from wdio i can pass some compilers7transpilers to enable ES6 syntax.
mocha
had a major update to 5, and GreenKeeper followed it well.
Could you please release to npm to update dependencies?
I'm not able to install wdio-mocha-framework (there is the same problem with wdio-cucumber-framework and wdio-jasmine-framework) on node 7.4.0, 7.10.1, 8.2.0, so I suppose that this is a problem with all node verisons starting from 7.4.0.
On the last LTS node version - 6.11.1 everything works fine.
Probably there is some problem with node-gyp (or fibers?), but I was not sure where I should report this issue. I've tried all installation instructions from https://github.com/nodejs/node-gyp, but it doesn't help. On node 6.11.1 it's installing fine, without any additional work needed, but on any newer node version nothing helps.
Error log from, for example, node 8.2.0:1
PS C:\Users\me\Desktop\webdrivertests> npm install wdio-mocha-framework --save-dev
[email protected] install C:\Users\me\Desktop\webdrivertests\node_modules\wdio-sync\node_modules\fibers
node build.js || nodejs build.js
C:\Users\me\Desktop\webdrivertests\node_modules\wdio-sync\node_modules\fibers>if not defined npm_config_node_gyp
node "C:\Users\me\AppData\Roaming\nvm\v8.2.0\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\n
de-gyp.js" rebuild --release ) else (node "" rebuild --release )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "/path/to/executable/python2.7", you can set the PYTHON env variable
gyp ERR! stack at PythonFinder.failNoPython (C:\Users\me\AppData\Roaming\nvm\v8.2.0\node_modules\npm\node_mod
les\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Users\me\AppData\Roaming\nvm\v8.2.0\node_modules\npm\node_modu
es\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Users\me\AppData\Roaming\nvm\v8.2.0\node_modules\npm\node_modules\graceful-fs\polyfills.
s:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\me\AppData\Roaming\nvm\v8.2.0\node_module
\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd C:\Users\me\Desktop\webdrivertests\node_modules\wdio-sync\node_modules\fibers
gyp ERR! node -v v8.2.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: sudo apt-get install g++ build-essential
Alpine users please run: sudo apk add python make g++
'nodejs' is not recognized as an internal or external command,
operable program or batch file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node build.js || nodejs build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\me\AppData\Roaming\npm-cache_logs\2017-07-21T07_57_47_662Z-debug.log
If you donβt have suite defined (via describe
), error is thrown:
/Users/niksy/Projects/example-project/node_modules/wdio-mocha-framework/build/adapter.js:288
message.parent = params.payload.parent.suites[0].title;
^
TypeError: Cannot read property 'title' of undefined
at MochaAdapter.formatMessage (/Users/niksy/Projects/example-project/node_modules/wdio-mocha-framework/build/adapter.js:288:69)
at MochaAdapter.emit (/Users/niksy/Projects/example-project/node_modules/wdio-mocha-framework/build/adapter.js:335:32)
at emitTwo (events.js:87:13)
at Runner.emit (events.js:172:7)
at Runner.fail (/Users/niksy/Projects/example-project/node_modules/mocha/lib/runner.js:244:8)
at Runner.uncaught (/Users/niksy/Projects/example-project/node_modules/mocha/lib/runner.js:717:8)
at process.uncaught (/Users/niksy/Projects/example-project/node_modules/mocha/lib/runner.js:805:10)
at emitOne (events.js:77:13)
at process.emit (events.js:169:7)
at process._fatalException (node.js:219:26)
Not having describe
is valid in Mocha land, so I suppose this should also be valid with WebdriverIO?
Branch | Build failing π¨ |
---|---|
Dependency | babel-eslint |
Current Version | 7.2.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-eslint is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 6 commits .
3cda62e
7.2.1
5626de1
Remove left over eslint 2 estraverse code (#452)
b5fb53b
Fix type param and interface declaration scoping (#449)
f1cee0f
Remove lodash dependency (#450)
eb05812
Format non-regression errors for legibility (#451)
7972a05
Update README.md with codeFrame option (#448)
See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | babel-core |
Current Version | 6.24.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-core is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
In the beforeTest
/afterTest
hooks, the first parameter passed (named test
in the docs) is an object that looks a lot like the this.currentTest
object that you normally have access to, but it is missing some parts that are useful.
For instance in mocha you can write
afterEach(function() {
console.log('just finished ', this.currentTest.fullTitle());
});
But in the wdio-mocha-framework
hook afterTest
, it looks like
afterTest(test) {
console.log('just finished ', test.fullTitle);
}
But it would be nice to just have access to the actual mocha test here.
My specific use case is that I want to report an error to mocha. (I'm using a tool called Applitools Eyes that does screenshot testing) My existing afterEach()
looks like:
afterEach(function() => {
try {
// This can fail
eyes.close();
} catch(ex) {
// report the error for this test, but do not bail on the whole suite
this.test.error(ex)
}
};
but this is impossible with the wdio
afterTest hook, because there is no equivalent of this.test.error
something similar to this:
https://github.com/webdriverio/webdriverio/blob/master/CHANGELOG.md
Branch | Build failing π¨ |
---|---|
Dependency | babel-preset-es2015 |
Current Version | 6.24.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-preset-es2015 is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Using wdio-mocha-framework 0.3.10, I get the following error when using this.skip()
in tests:
TypeError: Cannot read property 'split' of undefined
at foo/node_modules/wdio-sync/build/index.js:649:30
at Context.executeSync (/foo/node_modules/wdio-sync/build/index.js:640:12)
at /foo/node_modules/wdio-sync/build/index.js:877:34
This works in older versions of wdio-mocha-framework (<3.0). (The error messages varies in versions from 0.3.0 and up.)
For some reason, describe.only()
and it.only()
are being ignored and I can't run isolated tests.
In my test, i get
Typerror done is not a function
which happens only in with the wdio-mocha-framework, not with mocha (3.5.0) itself:
it('can clear the DB on demand', function(done) {
new Dummy({
a: 5
}).save(function(err, model) {
if (err) return done(err);
clearDB(function(err) {
if (err) return done(err);
Dummy.find({}, function(err, docs) {
if (err) return done(err);
console.log(docs);
docs.length.should.equal(0);
done(); //error is thrown here
});
});
let assert = require('assert');
describe('test', () => {
it('case', () => {
assert.equal(1, 2, 'some text');
});
});
{
framework: 'mocha',
mochaOpts: {
'ui': 'bdd',
'trace': true,
'full-trace': true
}
}
[chrome #0a] Running: chrome
[chrome #0a]
[chrome #0a] test
[chrome #0a] 1) case
[chrome #0a]
[chrome #0a]
[chrome #0a] 1 failing (2s)
[chrome #0a]
[chrome #0a] 1) 1 case:
[chrome #0a] some text
[chrome #0a] AssertionError: some text
[chrome #0a] at Context.it (/tests/cases/login/TESTMAIL-8674.js:11:21)
[chrome #0a]
let assert = require('assert');
describe('test', () => {
it('case', () => {
try {
assert.equal(1, 2, 'some text');
}
catch (error) {
console.log(error)
throw new Error(error);
}
});
});
{ AssertionError: some text
at Context.error (/tests/cases/login/TESTMAIL-8674.js:12:21)
at /tests/node_modules/wdio-sync/build/index.js:659:26
at Context.executeSync (/tests/node_modules/wdio-sync/build/index.js:657:12)
at /tests/node_modules/wdio-sync/build/index.js:883:34
name: 'AssertionError',
actual: 1,
expected: 2,
operator: '==',
message: 'some text',
generatedMessage: false }
------------------------------------------------------------------
[chrome #0a] Session ID: 8b836530-2d16-48b0-a8a5-ad8c5aec9170
[chrome #0a] Spec: /tests/cases/login/TESTMAIL-8674.js
[chrome #0a] Running: chrome
[chrome #0a]
[chrome #0a] test
[chrome #0a] 1) case
[chrome #0a]
[chrome #0a]
[chrome #0a] 1 failing (1s)
[chrome #0a]
[chrome #0a] 1) test case:
[chrome #0a] AssertionError: some text
[chrome #0a] Error: AssertionError: some text
[chrome #0a] at Context.error (/tests/cases/login/TESTMAIL-8674.js:16:10)
[chrome #0a]
1) test
0 passing (13ms)
1 failing
1) test:
AssertionError: some text
+ expected - actual
-1
+2
at Context.<anonymous> (test.js:4:12)
I don't like using try / catch everywhere. Is there any way how to see more info about fails?
PS: The problem actual for wdio exceptions as well.
In my test.spec.js file, I want to call the play method from the react-native-sound module from the playAudio function
import Sound from 'react-native-sound';
function playAudio()
{
_player = new Sound('my.wav', Sound.DOCUMENT, (error) => {
.....
_player.play((success) => {
.....
if (_player && _player.release) {
_player.release();
}
});
});
}
module.exports = () => {
describe('Voice input test at Main Page', function() {
it('should able to speak show me basf and go to Main Page', function () {
if(Main.mic.waitForExist()) {
browser
.touchAction('~f', 'longPress')
.call(playAudio)
.touchAction('~f', 'release');
however, when I run my test, I got the ERROR: Cannot find module 'react-native'
how do I setup mocha to enable me to call method from react-native-module.
I'm doing some api rest test with wdio, mocha, chai and chai-http async mode. When i run the test it show me via console the error in white letters (should be red) but the mocha test pass (green check). It should throw me a bad test, what could be happening here?
This is the code:
var chai = require('chai');
var chaiHttp = require('chai-http');
global.expect = chai.expect;
chai.Should();
chai.use(chaiHttp);
var username = '[email protected]';
var token = 'a5ff7f1063582fd0140d';
describe('Se consulta a la lista de contactos a traves de la API rest', function(){
it('Se hace un request GET al endpoint /contacts', function(){
chai.request('https://app.alegra.com/api/v1/contacts')
.get('/')
.set('Accept','application/json')
.query({limit:'10', order_direction: 'DESC', order_field: 'id'})
//.auth(username,token)
.then(function(res) {
console.log(res);
expect(res).to.have.status(200);
//res.body.should.be.a.json;
})
.catch(function (err){
console.log(err.rawResponse);
throw new Error('Error');
})
});
});
This is the package.json:
"devDependencies": {
"chai": "^4.1.1",
"chai-http": "^3.0.0",
"wdio-dot-reporter": "0.0.8",
"wdio-mocha-framework": "^0.5.11",
"wdio-selenium-standalone-service": "0.0.8",
"wdio-spec-reporter": "^0.1.2",
"webdriverio": "^4.8.0"
}
Branch | Build failing π¨ |
---|---|
Dependency | mocha |
Current Version | 3.5.0 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
mocha is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you itβs very likely also breaking them.
I recommend you give this issue a very high priority. Iβm sure you can resolve this πͺ
xit
export for "require" interface (@solodynamo)--compilers
coverage (@ScottFreeCode)The new version differs by 14 commits.
4070a44
Release v3.5.1
466ba73
update CHANGELOG.md for v3.5.1 [ci skip]
1cc0fc0
import/require xit, fixes #2972
74fa66f
update nyc to latest; remove workaround in travis script
aa52933
update coveralls strategy; closes #2984
73a5338
Spelling (#2981)
9f403bf
Add utils.escape
tests and fix unicode escaping
800acbc
whitelist "developer-experience" tag for stalebot [ci skip]
5895671
Added issue, pull request templates. (#2869)
075bd51
Merge pull request #2918 from mochajs/no-shell-test
8710438
Work around Node 0.10 Windows flake when testing
13b8340
Ensure that compiler lookup works and not just that transpilation works (#2922)
26d337a
Add tests for double-star behavior
c0e6b68
Eliminate glob.sh
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Node 12 has build issue with fibers, looks it is fixed in V4+ but no release of wdio-mocha-framework support fibers V4+. Can we make a change to upgrade to fibers V4
I'd like to be able to perform async actions when tests fail, like taking screenshots, saving browser logs and the DOM contents, etc. See webdriverio/webdriverio#810
C:\Users\smarigowda\SAN\gitLab\wdioPOC (master -> origin) ([email protected])
Ξ» yarn add wdio-mocha-framework
yarn add v1.12.3
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error C:\Users\smarigowda\SAN\gitLab\wdioPOC\node_modules\fibers: Command failed.
Exit code: 1
Command: node build.js || nodejs build.js
Arguments:
Directory: C:\Users\smarigowda\SAN\gitLab\wdioPOC\node_modules\fibers
Output:
C:\Users\smarigowda\SAN\gitLab\wdioPOC\node_modules\fibers>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild --release ) else (node "" rebuild --release )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\smarigowda\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd C:\Users\smarigowda\SAN\gitLab\wdioPOC\node_modules\fibers
gyp ERR! node -v v11.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: sudo apt-get install g++ build-essential
RHEL users please run: yum install gcc-c++
and yum groupinstall 'Development Tools'
Alpine users please run: sudo apk add python make g++
'nodejs' is not recognized as an internal or external command,
operable program or batch file.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Hi,
Mocha's retries doesn't seem to work.
Using [email protected] and [email protected]
So in my wdio.conf I have:
mochaOpts: {
ui: 'bdd',
timeout: config.get('timeout'),
retries: 3
}
And have a basic test:
it('Retry working?', function () {
var a = 1
expect(a).to.equal(2)
}
It only runs once - even if I place the line this.retries(3)
in the it block it doesnt work.
Any ideas?
Branch | Build failing π¨ |
---|---|
Dependency | babel-cli |
Current Version | 6.24.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-cli is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
See this example project:
https://github.com/graingert/wdio-mocha-root-suite-hook
hooks defined putside of any define in any spec file should be run before anything else:
before(function () {
global.didRunBeforeHook = true;
});
var expect = require('chai').expect;
describe('test suite', function() {
it('test case', function (){
expect(global.didRunBeforeHook).to.be.true
});
});
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If youβre interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didnβt already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didnβt touch job or matrix configurations because these tend to be quite specific and complex, and itβs difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what youβre doing it may require additional work or may not be applicable at all. Weβre also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, Iβm a humble robot and wonβt feel rejected π€
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
I have a test with a page that takes fairly long to fully load (for example: http://www.saksfifthavenue.com/). It oftentimes takes more than 10 seconds to get all the widgets, pop-ups and everything fully loaded. In these cases, I get the following error message (just on trying to load the page - I have not started interacting with the page):
Blablabla test suite "before all" hook:
timeout of 10000ms exceeded. Ensure the done() callback is being called in this test.
running chrome
Error: timeout of 10000ms exceeded. Ensure the done() callback is being called in this test.
at Timeout. (/usr/local/lib/node_modules/wdio-mocha-framework/node_modules/mocha/lib/runnable.js:226:19)
at tryOnTimeout (timers.js:224:11)
at Timer.listOnTimeout (timers.js:198:5)
I tried changing the mocha timeout in wdio.conf.js as described in the http://webdriver.io/guide/testrunner/timeouts.html page:
framework: 'mocha',
mochaOpts: {
timeout: 99999999
},
But no matter which value is given to timeout (I tried 20000, 0 and other big numbers), it still times out after 10 seconds.
I switched to using Jasmine instead, changed the Jasmine timeout to 20 seconds (as it still fails occasionally if I keep the 10 seconds default value) and everything works fine.
It looks to me like the mocha timeout value in wdio.conf.js is not being passed correctly to mocha itself.
I think I am using the latest version of all components:
mocha: 2.5.3
wdio-mocha-framework: 0.3.5
webdriverio: 4.2.1
Branch | Build failing π¨ |
---|---|
Dependency | sinon |
Current Version | 2.3.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As sinon is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 24 commits.
bade318
Update docs/changelog.md and set new release id in docs/_config.yml
65d4e88
Add release documentation for v2.3.3
2204e72
2.3.3
64034ee
Update Changelog.txt and AUTHORS for new release
1ece07c
Merge pull request #1450 from raulmatei/fix-1445-sandbox-stubbing-static-function-property-throws-error
452981c
Fix 1445: make stubbing of static function properties possible
25f3eeb
Update sandbox configuration docs. (#1443)
c76fa2e
Merge pull request #1444 from piperchester/patch-1
6539d94
Update README.md
c6d01d8
Add missing function name (#1440)
5f989a8
Remove confusing .withArgs from spy documentation (#1438)
9ca272e
Remove superfluous calls in example (#1437)
9e3eac3
Merge pull request #1436 from sinonjs/feature-detect-name-property
65d3d7b
Feature detect function name property in issue 950
e0c75bd
Add test for #950, show that it has been fixed (#1435)
There are 24 commits in total.
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
We've been seeing an issue with the reporter failing to show a report at the end of a test run.
At the moment, this only happens when using a remote selenium server with the test code running on the local machine.
The cause of the issue seems to be the timeout setting in function:
waitUntilSettled () {
return new Promise((resolve) => {
const start = (new Date()).getTime()
const interval = setInterval(() => {
const now = (new Date()).getTime()
if (this.sentMessages !== this.receivedMessages && now - start < SETTLE_TIMEOUT) return
clearInterval(interval)
resolve()
}, 100)
})
}
The child process fires all of its test run messages to the parent in quick succession, but because of the 5sec timeout, never has a chance to get a response from the parent which means no test results in the console. Raising the timeout to 30sec didn't help. Screenshot of a test run with no output.
Removing the timeout completely does solve the issue, but doesn't address the underlying problem that the parent process takes a very long time to respond to the messages.
Debugging this a little further, we noticed that this line returns false
when firing messages to the parent.
https://github.com/webdriverio/wdio-mocha-framework/blob/master/lib/adapter.js#L239
Node docs indicate this happens when the IPC backlog exceeds a threshold, or parent has exited. Since messages are processed given enough time, points to the IPC backlog being full.
For the moment we're simply going to remove the timeout from local code, but a long term solution is needed.
P.S
For reference, I found this after writing the issue. I understand the timeout was explicit, but in that case it means the parent shouldn't exit until all received messages have been handled and displayed.
e4000cf
Just saw you implemented the passthrough of .only for mocha specs. Any plans to publish this version to NPM in the near future?
Hi,
I pulled the code on a Raspberry and I have node version 7.8.0.
I have problems with Fibers.
The problem is as follows:
root@raspberrypi:~/appium-hbbtv-driver# npm install /root/wdio-mocha-framework
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts will run only for `npm publish`.
npm WARN prepublish-on-install (In npm@4 and previous versions, it also runs for `npm install`.)
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
npm WARN lifecycle [email protected]~prepublish: cannot run in wd %s %s (wd=%s) [email protected] npm prune && run-s build test /root/wdio-mocha-framework
> [email protected] install /root/appium-hbbtv-driver/node_modules/fibers
> node build.js || nodejs build.js
module.js:327
throw err;
^
Error: Cannot find module '/root/appium-hbbtv-driver/node_modules/fibers/build.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:140:18)
at node.js:1043:3
module.js:327
throw err;
^
Error: Cannot find module '/root/appium-hbbtv-driver/node_modules/fibers/build.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:140:18)
at node.js:1043:3
[email protected] /root/appium-hbbtv-driver
βββ [email protected] extraneous
βββ UNMET PEER DEPENDENCY [email protected] extraneous
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.2 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.2 (node_modules/watchpack/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN [email protected] requires a peer of webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc but none was installed.
npm ERR! Linux 4.14.34-v7+
npm ERR! argv "/root/.nvm/versions/node/v7.8.0/bin/node" "/root/.nvm/versions/node/v7.8.0/bin/npm" "install" "/root/wdio-mocha-framework"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node build.js || nodejs build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js || nodejs build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs fibers
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/.npm/_logs/2018-04-25T15_23_03_498Z-debug.log
Do you know how can I fix it?
I keep getting this error in 0.3.6, but not in 0.3.5. Broke my build this morning.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.