christian-bromann on v8
start rewriting webdriverio tes… (compare)
Hi guys, need help with wdio 6 mocha with opt delay
. I can't make it work.
This code works in pure mocha:
var assert = require('assert');
async function returnArr() {
return [2, 2, 1];
}
setTimeout(async function() {
const arr = await returnArr();
describe('my suite', function() {
for (let el of arr) {
it(`Is element ${el} has index 1`, async function() {
assert.equal(arr.indexOf(el), 1);
});
}
});
run();
}, 500);
But skips it in wdio mocha 'Spec Files: 0 passed, 1 skipped, 1 total (100% completed) in 00:00:03 '
Thats set up for mocha frmaework in the config:
mochaOpts: {
ui: 'bdd',
timeout: 3600000,
delay: true
},
Also synchronous version works in wdio(with deleted delay option)
function returnArr() {
return [2, 2, 1];
}
const arr = returnArr();
describe('my suite', function() {
for (let el of arr) {
it(`Is element ${el} has index 1`, async function() {
assert.equal(arr.indexOf(el), 1);
});
}
});
Hello. I've just started using WDIO - it is really cool. Thank you for the job you've done guys!
And, of course, I have a question - I'm extending browser commands and adding new ones, but Typescript compiler is not really happy. Here is example from the documentation
browser.overwriteCommand('click', function (origClickFunction, { force = false } = {}) { ... });
$('..').click({ force: true })
result is compile error Argument of type '{ force: boolean; }' is not assignable to parameter of type 'ClickOptions'
one more example:
browser.addCommand('isDisplayedAndBlurred', function () { ... });
$('..').isDisplayedAndBlurred()
result is "Property 'clickIfCollapsed' does not exist on type 'Element'."
with ts-ignore everything works like a charm. However there are still compile errors and autocomplete in IDE (WebStorm) doesn't work.
I there any way to fix it?
Thank you in advance.
@krishna-auto there's a blog about that right here https://webdriver.io/blog/2019/06/25/file-upload.html
Hi @erwinheitzman , this worked for me on chrome, but its failing on headless chrome execution and as well as non-headless/headless mode in firefox, same failure "element is not interactable" error, In the above given link its given that "that is currently only supported when running Chrome", anyway to make it work on firefox && chrome headless? Thanks!
Hi, any idea how to make this work on firefox? Thanks!
Hi guys, need help with wdio 6 mocha with opt delay
. I can't make it work.
This code works in pure mocha:
var assert = require('assert');
async function returnArr() {
return [2, 2, 1];
}
setTimeout(async function() {
const arr = await returnArr();
describe('my suite', function() {
for (let el of arr) {
it(`Is element ${el} has index 1`, async function() {
assert.equal(arr.indexOf(el), 1);
});
}
});
run();
}, 500);
But skips it in wdio mocha 'Spec Files: 0 passed, 1 skipped, 1 total (100% completed) in 00:00:03 '
Thats set up for mocha frmaework in the config:
mochaOpts: {
ui: 'bdd',
timeout: 3600000,
delay: true
},
Also synchronous version works in wdio(with deleted delay option)
function returnArr() {
return [2, 2, 1];
}
const arr = returnArr();
describe('my suite', function() {
for (let el of arr) {
it(`Is element ${el} has index 1`, async function() {
assert.equal(arr.indexOf(el), 1);
});
}
});
Seams like a bug
Getting following error when running webdriverIO docker image (alpine-based) with selenium-standalone service & firefox while the same works with ubuntu based docker image -
[0-0] 2020-05-27T13:16:43.803Z DEBUG webdriver: request failed due to status 13
[0-0] 2020-05-27T13:16:43.803Z ERROR webdriver: Request failed with status 500 due to unknown error: invalid argument: can't kill an exited process
Build info: version: '3.141.5', revision: 'd54ebd709a', time: '2018-11-06T11:58:47'
System info: host: 'a8560b87fab4', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '11.0.7'
Driver info: driver.version: unknown
remote stacktrace:
[0-0] 2020-05-27T13:16:43.803Z ERROR webdriver: unknown error: invalid argument: can't kill an exited process
Build info: version: '3.141.5', revision: 'd54ebd709a', time: '2018-11-06T11:58:47'
System info: host: 'a8560b87fab4', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '11.0.7'
Driver info: driver.version: unknown
remote stacktrace:
at getErrorFromResponseBody (/airbnb-wdio-poc/node_modules/webdriver/build/utils.js:124:10)
at WebDriverRequest._request (/airbnb-wdio-poc/node_modules/webdriver/build/request.js:148:56)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async startWebDriverSession (/airbnb-wdio-poc/node_modules/webdriver/build/utils.js:44:16)
at async Function.newSession (/airbnb-wdio-poc/node_modules/webdriver/build/index.js:46:23)
at async remote (/airbnb-wdio-poc/node_modules/webdriverio/build/index.js:66:20)
at async Runner._startSession (/airbnb-wdio-poc/node_modules/@wdio/runner/build/index.js:219:50)
at async Runner._initSession (/airbnb-wdio-poc/node_modules/@wdio/runner/build/index.js:175:21)
at async Runner.run (/airbnb-wdio-poc/node_modules/@wdio/runner/build/index.js:93:15)
Dockerfile -
FROM node:12.16-alpine
ENV NODE_PATH /airbnb-wdio-poc/node_modules/
ENV PATH /airbnb-wdio-poc/node_modules/.bin:$PATH
COPY airbnb-wdio-poc/*.json /airbnb-wdio-poc/
COPY airbnb-wdio-poc/*.js /airbnb-wdio-poc/
COPY airbnb-wdio-poc/pages/ /airbnb-wdio-poc/pages/
COPY airbnb-wdio-poc/tests/ /airbnb-wdio-poc/tests/
WORKDIR /airbnb-wdio-poc/
RUN pwd
RUN apk --no-cache add --virtual native-deps g++ gcc libstdc++ linux-headers make python
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk update
RUN apk add openjdk11
RUN apk add firefox-esr
RUN npm install --silent
RUN npm audit fix
RUN ls -l
RUN apk del native-deps g++ gcc linux-headers make python
some contents from wdio.conf.js -
capabilities: [{
maxInstances: 1,
browserName: 'firefox',
"moz:firefoxOptions": {
args: ["-headless"],
},
}]
services: [['selenium-standalone']]