gemini
gemini copied to clipboard
Test in Chrome (--headless) with puppeteer
Task: run the tests locally, without installing browser. Config:
const puppeteer = require('puppeteer');
const pathChrome = puppeteer.executablePath();
module.exports = {
rootUrl: 'http://localhost:3001/',
gridUrl: 'http://127.0.0.1:4444/wd/hub',
browsers: {
chrome: {
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--headless'],
binary: pathChrome,
},
},
},
},
sets: {
chrome: {
files: [
'./tests'
],
browsers: [
'chrome',
],
}
},
system: {
exclude: [
'**/stand/**/*.js',
'**/reports/*.js',
],
plugins: {
'html-reporter': {
enabled: true,
path: '../reports',
errorsOnly: true
},
...
},
projectRoot: '.'
}
}
Error in selenium:
INFO - To downstream: {"sessionId":"0af5e47f170acadc87d5322eedf145b4","status":13,"value":{"message":"unknown error: call function result missing 'value'\n (Session info: headless chrome=65.0.3312.0)\n (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.16299 x86_64)"}}
In the report instead of screenshots be text:
Error: [execute("(function e(t,n,r)... {},[1]);\n")] Error response status: 13, ,
UnknownError - An unknown server-side error occurred while processing the command.
Selenium error: unknown error: call function result missing 'value'
(Session info: headless chrome=65.0.3312.0)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.16299 x86_64)
at exports.newError (C:\work\pleeco-fluent-kelp-autotests\test\node_modules\wd\lib\utils.js:139:13)
at C:\work\pleeco-fluent-kelp-autotests\test\node_modules\wd\lib\callbacks.js:75:19
at C:\work\pleeco-fluent-kelp-autotests\test\node_modules\wd\lib\webdriver.js:192:5
at Request._callback (C:\work\pleeco-fluent-kelp-autotests\test\node_modules\wd\lib\http-utils.js:87:7)
at Request.self.callback (C:\work\pleeco-fluent-kelp-autotests\test\node_modules\wd\node_modules\request\request.js:368:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (C:\work\pleeco-fluent-kelp-autotests\test\node_modules\wd\node_modules\request\request.js:1219:14)
at emitOne (events.js:121:20)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (C:\work\pleeco-fluent-kelp-autotests\test\node_modules\wd\node_modules\request\request.js:1167:12)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
I think, this is after the call scripts:
C:\work\pleeco-fluent-kelp-autotests\test\node_modules\gemini\lib\browser\client-scripts\gemini.js
If I change this request in wd:
\node_modules\wd\lib\webdriver.js line: 185
let temp = JSON.parse(data);
temp.status = 0
data = JSON.stringify(temp);
The test will pass successfully. Screenshots will appear.
If I change path for full Chrome
module.exports = {
rootUrl: 'http://localhost:3001/',
gridUrl: 'http://127.0.0.1:4444/wd/hub',
browsers: {
chrome: {
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--headless'],
binary: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
},
The test will pass successfully. Screenshots will appear.