Skip to content

Error while running .executeScript() protocol action: Invalid Command #33

@lunayui

Description

@lunayui

I'm starting the BrowserStackLocal process via local.runner.js. and Nightwatch coverage code

But the build-in Jenkins is still failing and shows the error :

Response 500 POST https://hub-cloud.browserstack.com/wd/hub/execute (163ms)
{ value: { message: 'Invalid Command', error: [] } }
Error while running .executeScript() protocol action: Invalid Command
{ status: -1,
state: '',
value: { message: 'Invalid Command', error: [] },
errorStatus: '',
error: 'Invalid Command',
httpStatusCode: 500 }
Error: Error while running "execute" command: An error occurred while gathering coverage information
at
at process._tickCallback (internal/process/next_tick.js:189:7)
nightwatch.conf.js

globals_path: path.resolve(constants.NIGHTWATCH_CONFIGS_PATH, 'globals.js'), custom_commands_path: [ 'node_modules/nightwatch-coverage/commands' ],

global.js
`const path = require('path');
const { createCoverageReporter } = require('nightwatch-coverage');

const coverageReporter = createCoverageReporter({
coverageDirectory: path.join(process.cwd(), 'tests/colosseum/coverage'),
});

module.exports = {

coverageReporter,
abortOnAssertionFailure: true,
waitForConditionPollInterval: 500,
waitForConditionTimeout: 5000,

// executed after every test suite has ended
afterEach(browser,done) {
console.log("Nigthwach Browser " + browser.collectCoverage());
browser.collectCoverage(function () {
client.end(done);
});
},

//executed after the test run has finished

after(done) {
console.log("coverage report "+coverageReporter);
coverageReporter.save();
done();
}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions