When I try to execute cypress test case in docker image,cypress opens new window of chrome and this command
cy.exec(`lighthouse https://www.google.com/ --preset desktop --output-path cypress/lighthouse-html-reports/google.html`)
also opens new window of chrome.
It throws error of chromelauncher with non-zero error code.
Getting this error.
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="0.0000" tests="1" failures="1">
<testsuite name="Root Suite" timestamp="2022-02-16T10:02:46" tests="0" file="cypress/integration/Performance/lighthouse.feature" time="0.0000" failures="0">
</testsuite>
<testsuite name="Performance Testing with Google Lighthouse" timestamp="2022-02-16T10:02:46" tests="1" time="0.0000" failures="1">
<testcase name="Performance Testing with Google Lighthouse Check application performance using Google Lighthouse" time="0.0000" classname="Check application performance using Google Lighthouse">
<failure message="`cy.exec('lighthouse https://www.google.com/ --preset desktop --output-path cypress/lighthouse-html-reports/google.html')` failed because the command exited with a non-zero code.
Pass `{failOnNonZeroExit: false}` to ignore exit code failures.
Information about the failure:
Code: 1
Stderr:
[36;1mLH:ChromeLauncher [0mWaiting for browser. [36m+0ms[0m
[36;1mLH:ChromeLauncher [0mWaiting for browser... [36m+1ms[0m
[36;1mLH:ChromeLauncher [0mWaiting for browser..... [36m+508...
https://on.cypress.io/exec" type="CypressError"><![CDATA[CypressError: `cy.exec('lighthouse https://www.google.com/ --preset desktop --output-path cypress/lighthouse-html-reports/google.html')` failed because the command exited with a non-zero code.
Pass `{failOnNonZeroExit: false}` to ignore exit code failures.
Information about the failure:
Code: 1
Stderr:
[36;1mLH:ChromeLauncher [0mWaiting for browser. [36m+0ms[0m
[36;1mLH:ChromeLauncher [0mWaiting for browser... [36m+1ms[0m
[36;1mLH:ChromeLauncher [0mWaiting for browser..... [36m+508...
https://on.cypress.io/exec
at https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:156418:85
at tryCatcher (https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:13196:23)
at Promise._settlePromiseFromHandler (https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:11131:31)
at Promise._settlePromise (https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:11188:18)
at Promise._settlePromise0 (https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:11233:10)
at Promise._settlePromises (https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:11313:18)
at _drainQueueStep (https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:7903:12)
at _drainQueue (https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:7896:9)
at Async.../../node_modules/bluebird/js/release/async.js.Async._drainQueues (https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:7912:5)
at Async.drainQueues (https://qagrc.kpmgsofy.com/__cypress/runner/cypress_runner.js:7782:14)
From Your Spec Code:
at Context.eval (https://qagrc.kpmgsofy.com/__cypress/tests?p=cypress/integration/Performance/lighthouse.feature:105:6)
at Context.resolveAndRunStepDefinition (https://qagrc.kpmgsofy.com/__cypress/tests?p=cypress/integration/Performance/lighthouse.feature:10707:29)
at Context.eval (https://qagrc.kpmgsofy.com/__cypress/tests?p=cypress/integration/Performance/lighthouse.feature:10028:35)]]></failure>
</testcase>
</testsuite>
</testsuites>
More about “How to Execute cypress exec command with lighthouse in docker?” related questions