Closed jamime closed 3 years ago
Seems to be not moving on from this beforeEach
/ it
definition in the tests in the case you linked to (shown below).
Does it always fail on this same specfile?
If there's something intermittent, then there's likely some asynchronous that gets into this loop sometimes if the timing of the run is slightly different sometimes. It's going to be hard to track down without the full code base.
You may want to try some of the recommendations on troubleshooting why tests fail in CI but pass locally: https://on.cypress.io/using-cypress-faq#Why-do-my-Cypress-tests-pass-locally-but-not-in-CI
beforeEach(() => {
window.testState = testState;
const failHandler = err => {
Cypress.off("fail", failHandler);
testState.onFail(err);
throw err;
};
Cypress.on("fail", failHandler);
})
it('I enable showPageSizeSelection', () => {
const state = window.testState;
return cy
.then(() => state.onStartScenario(scenario, indexedSteps))
.then(() =>
resolveAndRunBeforeHooks.call(this, scenario.tags, state.feature.name)
.then(() =>
indexedSteps.forEach(step => stepTest.call(this, state, step, rowData)))
.then(() =>
resolveAndRunAfterHooks.call(this, scenario.tags, state.feature.name))
.then(() =>
state.onFinishScenario(scenario)
);
})
Hi Jennifer, thanks for the reply.
Does it always fail on this same specfile?
yes
If there's something intermittent, then there's likely some asynchronous that gets into this loop sometimes if the timing of the run is slightly different sometimes. It's going to be hard to track down without the full code base.
You can access the full codebase here if it helps https://github.com/Sage/carbon/tree/6116e86b19145bba6d702434afb06ab4621c784c
Seems to be not moving on from this beforeEach / it
How did you work out that it was this test that it was hanging on? I saw a mocha
start event for I disable showPageSizeSelection
after that but maybe I'm reading the logs wrong?
2020-07-08T08:28:03.5335163Z [34;1mcypress:server:project [0monMocha test end [34m+29ms[0m
2020-07-08T08:28:03.5341199Z [31;1mcypress:server:reporter [0mgot mocha event 'test end' with args: [ { id: [32m'r3'[39m, order: [33m1[39m, title: [32m'I enable showPageSizeSelection'[39m, state: [32m'passed'[39m, body: [32m'function() {\n'[39m + [32m' const state = window.testState;\n'[39m + [32m' return cy\n'[39m + [32m' .then(() => state.onStartScenario(scenario, indexedSteps))\n'[39m + [32m' .then(() =>\n'[39m + [32m' resolveAndRunBeforeHooks.call(this, scenario.tags, state.feature.name)\n'[39m + [32m' )\n'[39m + [32m' .then(() =>\n'[39m + [32m' indexedSteps.forEach(step =>\n'[39m + [32m' stepTest.call(this, state, step, rowData)\n'[39m + [32m' )\n'[39m + [32m' )\n'[39m + [32m' .then(() =>\n'[39m + [32m' resolveAndRunAfterHooks.call(this, scenario.tags, state.feature.name)\n'[39m + [32m' )\n'[39m + [32m' .then(() => state.onFinishScenario(scenario));\n'[39m + [32m' }'[39m, type: [32m'test'[39m, duration: [33m10929[39m, wallClockStartedAt: [32m'2020-07-08T08:27:52.537Z'[39m, timings: { lifecycle: [33m73[39m, [32m'before all'[39m: [36m[Array][39m, [32m'before each'[39m: [36m[Array][39m, test: [36m[Object][39m }, file: [1mnull[22m } ] [31m+29ms[0m
2020-07-08T08:28:03.5372002Z [34;1mcypress:server:project [0monMocha test:after:run [34m+3ms[0m
2020-07-08T08:28:03.5373796Z [31;1mcypress:server:reporter [0mgot mocha event 'test:after:run' with args: [ { id: [32m'r3'[39m, order: [33m1[39m, title: [32m'I enable showPageSizeSelection'[39m, state: [32m'passed'[39m, body: [32m'function() {\n'[39m + [32m' const state = window.testState;\n'[39m + [32m' return cy\n'[39m + [32m' .then(() => state.onStartScenario(scenario, indexedSteps))\n'[39m + [32m' .then(() =>\n'[39m + [32m' resolveAndRunBeforeHooks.call(this, scenario.tags, state.feature.name)\n'[39m + [32m' )\n'[39m + [32m' .then(() =>\n'[39m + [32m' indexedSteps.forEach(step =>\n'[39m + [32m' stepTest.call(this, state, step, rowData)\n'[39m + [32m' )\n'[39m + [32m' )\n'[39m + [32m' .then(() =>\n'[39m + [32m' resolveAndRunAfterHooks.call(this, scenario.tags, state.feature.name)\n'[39m + [32m' )\n'[39m + [32m' .then(() => state.onFinishScenario(scenario));\n'[39m + [32m' }'[39m, type: [32m'test'[39m, duration: [33m10929[39m, wallClockStartedAt: [32m'2020-07-08T08:27:52.537Z'[39m, wallClockDuration: [33m10939[39m, timings: { lifecycle: [33m73[39m, [32m'before all'[39m: [36m[Array][39m, [32m'before each'[39m: [36m[Array][39m, test: [36m[Object][39m }, file: [1mnull[22m } ] [31m+3ms[0m
2020-07-08T08:28:03.5448662Z [34;1mcypress:server:project [0monMocha test [34m+3ms[0m
2020-07-08T08:28:03.5449987Z [31;1mcypress:server:reporter [0mgot mocha event 'test' with args: [ { id: [32m'r4'[39m, order: [33m2[39m, title: [32m'I disable showPageSizeSelection'[39m, body: [32m'function() {\n'[39m + [32m' const state = window.testState;\n'[39m + [32m' return cy\n'[39m + [32m' .then(() => state.onStartScenario(scenario, indexedSteps))\n'[39m + [32m' .then(() =>\n'[39m + [32m' resolveAndRunBeforeHooks.call(this, scenario.tags, state.feature.name)\n'[39m + [32m' )\n'[39m + [32m' .then(() =>\n'[39m + [32m' indexedSteps.forEach(step =>\n'[39m + [32m' stepTest.call(this, state, step, rowData)\n'[39m + [32m' )\n'[39m + [32m' )\n'[39m + [32m' .then(() =>\n'[39m + [32m' resolveAndRunAfterHooks.call(this, scenario.tags, state.feature.name)\n'[39m + [32m' )\n'[39m + [32m' .then(() => state.onFinishScenario(scenario));\n'[39m + [32m' }'[39m, type: [32m'test'[39m, file: [1mnull[22m } ] [31m+4ms[0m
I thought this looked suspect
2020-07-08T08:28:08.8114061Z [32;1mcypress:server:browsers:electron [0mconsole message: { column: [33m26[39m, level: [32m'debug'[39m, line: [33m18393[39m, source: [32m'console-api'[39m, text: [32m'message arrived at manager storybookjs/knobs/set [object Object]'[39m, url: [32m'http://127.0.0.1:9001/vendors~main.acb06a633f95331e0a72.bundle.js'[39m } [32m+264ms[0m
2020-07-08T08:28:09.2812071Z [32;1mcypress:server:util:socket_whitelist [0mwhitelisted socket closed, removing { localPort: [33m50336[39m } [32m+5s[0m
followed by
2020-07-08T08:28:25.3187687Z [32;1mcypress:https-proxy [0mreceived error on client browserSocket { err: Error: read ECONNRESET [90m at TCP.onStreamRead (internal/stream_base_commons.js:201:27)[39m { errno: [32m'ECONNRESET'[39m, code: [32m'ECONNRESET'[39m, syscall: [32m'read'[39m }, url: [32m'127.0.0.1:9001'[39m } [32m+21s[0m
in full
2020-07-08T08:28:08.8114061Z [32;1mcypress:server:browsers:electron [0mconsole message: { column: [33m26[39m, level: [32m'debug'[39m, line: [33m18393[39m, source: [32m'console-api'[39m, text: [32m'message arrived at manager storybookjs/knobs/set [object Object]'[39m, url: [32m'http://127.0.0.1:9001/vendors~main.acb06a633f95331e0a72.bundle.js'[39m } [32m+264ms[0m
2020-07-08T08:28:09.2812071Z [32;1mcypress:server:util:socket_whitelist [0mwhitelisted socket closed, removing { localPort: [33m50336[39m } [32m+5s[0m
2020-07-08T08:28:14.8397120Z [32;1mcypress:server:util:process_profiler [0mcurrent & mean memory and CPU usage by process group:
2020-07-08T08:28:14.8398254Z [32;1mcypress:server:util:process_profiler [0m┌─────────┬───────────────────┬──────────────┬────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
2020-07-08T08:28:14.8398964Z [32;1mcypress:server:util:process_profiler [0m│ (index) │ group │ processCount │ pids │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
2020-07-08T08:28:14.8399674Z [32;1mcypress:server:util:process_profiler [0m├─────────┼───────────────────┼──────────────┼────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
2020-07-08T08:28:14.8400292Z [32;1mcypress:server:util:process_profiler [0m│ 0 │ 'Electron' │ 1 │ '4016' │ 54.19 │ 28.28 │ 550.83 │ 406.94 │ 550.83 │
2020-07-08T08:28:14.8400921Z [32;1mcypress:server:util:process_profiler [0m│ 1 │ 'cypress' │ 1 │ '3601' │ 21.99 │ 18.6 │ 330.51 │ 291.68 │ 330.51 │
2020-07-08T08:28:14.8401530Z [32;1mcypress:server:util:process_profiler [0m│ 2 │ 'plugin' │ 1 │ '3976' │ 0 │ 9.31 │ 281.42 │ 255.36 │ 281.42 │
2020-07-08T08:28:14.8402470Z [32;1mcypress:server:util:process_profiler [0m│ 3 │ 'electron-shared' │ 3 │ '3607, 3760, 3928' │ 3.34 │ 1.89 │ 180.24 │ 149.23 │ 182.36 │
2020-07-08T08:28:14.8403085Z [32;1mcypress:server:util:process_profiler [0m│ 4 │ 'other' │ 2 │ '4697, 4698' │ 0 │ 0 │ 3.87 │ 3.88 │ 3.99 │
2020-07-08T08:28:14.8403698Z [32;1mcypress:server:util:process_profiler [0m│ 5 │ 'TOTAL' │ 8 │ '-' │ 79.52 │ 50.57 │ 1346.88 │ 974.63 │ 1346.88 │
2020-07-08T08:28:14.8404403Z [32;1mcypress:server:util:process_profiler [0m└─────────┴───────────────────┴──────────────┴────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ [32m+10s[0m
2020-07-08T08:28:25.3187687Z [32;1mcypress:https-proxy [0mreceived error on client browserSocket { err: Error: read ECONNRESET [90m at TCP.onStreamRead (internal/stream_base_commons.js:201:27)[39m { errno: [32m'ECONNRESET'[39m, code: [32m'ECONNRESET'[39m, syscall: [32m'read'[39m }, url: [32m'127.0.0.1:9001'[39m } [32m+21s[0m
2020-07-08T08:28:25.3220675Z [32;1mcypress:server:util:socket_whitelist [0mwhitelisted socket closed, removing { localPort: [33m39586[39m } [32m+16s[0m
2020-07-08T08:28:25.4247448Z [32;1mcypress:server:util:process_profiler [0mcurrent & mean memory and CPU usage by process group:
2020-07-08T08:28:25.4248559Z [32;1mcypress:server:util:process_profiler [0m┌─────────┬───────────────────┬──────────────┬────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
2020-07-08T08:28:25.4249193Z [32;1mcypress:server:util:process_profiler [0m│ (index) │ group │ processCount │ pids │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
2020-07-08T08:28:25.4250217Z [32;1mcypress:server:util:process_profiler [0m├─────────┼───────────────────┼──────────────┼────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
2020-07-08T08:28:25.4250843Z [32;1mcypress:server:util:process_profiler [0m│ 0 │ 'Electron' │ 1 │ '4016' │ 43.3 │ 31.29 │ 1453.55 │ 616.26 │ 1453.55 │
2020-07-08T08:28:25.4251464Z [32;1mcypress:server:util:process_profiler [0m│ 1 │ 'cypress' │ 1 │ '3601' │ 24.77 │ 19.63 │ 369.84 │ 304.7 │ 369.84 │
2020-07-08T08:28:25.4252081Z [32;1mcypress:server:util:process_profiler [0m│ 2 │ 'plugin' │ 1 │ '3976' │ 0.92 │ 7.63 │ 191.23 │ 242.53 │ 281.42 │
2020-07-08T08:28:25.4252706Z [32;1mcypress:server:util:process_profiler [0m│ 3 │ 'electron-shared' │ 3 │ '3607, 3760, 3928' │ 6.05 │ 2.58 │ 175.05 │ 153.53 │ 182.36 │
2020-07-08T08:28:25.4253887Z [32;1mcypress:server:util:process_profiler [0m│ 4 │ 'other' │ 2 │ '4905, 4906' │ 0 │ 0 │ 3.79 │ 3.87 │ 3.99 │
2020-07-08T08:28:25.4254343Z [32;1mcypress:server:util:process_profiler [0m│ 5 │ 'TOTAL' │ 8 │ '-' │ 75.04 │ 54.65 │ 2193.45 │ 1177.77 │ 2193.45 │
2020-07-08T08:28:25.4254885Z [32;1mcypress:server:util:process_profiler [0m└─────────┴───────────────────┴──────────────┴────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ [32m+11s[0m
2020-07-08T08:28:26.7905287Z [31;1mcypress:server:server [0mGot CONNECT request from 127.0.0.1:9001 [31m+18s[0m
2020-07-08T08:28:26.7922636Z [32;1mcypress:https-proxy [0mWriting browserSocket connection headers { url: [32m'127.0.0.1:9001'[39m, headLength: [33m0[39m, headers: { host: [32m'127.0.0.1:9001'[39m, [32m'proxy-connection'[39m: [32m'keep-alive'[39m, [32m'user-agent'[39m: [32m'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/4.9.0 Chrome/80.0.3987.165 Electron/8.3.1 Safari/537.36'[39m } } [32m+1s[0m
2020-07-08T08:28:26.8104154Z [32;1mcypress:https-proxy [0mGot first head bytes { url: [32m'127.0.0.1:9001'[39m, head: [32m'GET /__socket.io/?EIO=3&transport=websocket HTTP/1.1\r\nHost: 127.'[39m } [32m+16ms[0m
2020-07-08T08:28:26.8105604Z [35;1mcypress:network:cors [0mParsed URL { port: [32m'9001'[39m, tld: [32m'127.0.0.1'[39m, domain: [32m''[39m } [35m+22s[0m
2020-07-08T08:28:26.8106184Z [31;1mcypress:server:server [0mHTTPS request does match URL: https://127.0.0.1:9001 with props: { port: [32m'9001'[39m, tld: [32m'127.0.0.1'[39m, domain: [32m''[39m } [31m+19ms[0m
2020-07-08T08:28:26.8106592Z [32;1mcypress:https-proxy [0mNot making direct connection { url: [32m'127.0.0.1:9001'[39m } [32m+2ms[0m
2020-07-08T08:28:26.8107204Z [32;1mcypress:https-proxy [0mMaking intercepted connection to 35187 [32m+0ms[0m
2020-07-08T08:28:26.8107784Z [32;1mcypress:https-proxy [0mgetting proxy URL { port: [33m35187[39m, serverPort: [33m35187[39m, sniPort: [33m37111[39m, url: [32m'https://localhost:35187'[39m } [32m+1ms[0m
2020-07-08T08:28:26.8204338Z [32;1mcypress:network:connect [0msuccessfully connected { opts: { port: [33m35187[39m, host: [32m'localhost'[39m, getDelayMsForRetry: [36m[Function: getDelayForRetry][39m }, iteration: [33m0[39m } [32m+23s[0m
2020-07-08T08:28:26.8259715Z [32;1mcypress:https-proxy [0mreceived upstreamSocket callback for request { port: [33m35187[39m, hostname: [32m'localhost'[39m, err: [90mundefined[39m } [32m+16ms[0m
2020-07-08T08:28:26.8264929Z [32;1mcypress:server:util:socket_whitelist [0mwhitelisting socket { localPort: [33m39786[39m } [32m+2s[0m
2020-07-08T08:28:26.8274003Z [31;1mcypress:server:server [0mGot UPGRADE request from /__socket.io/?EIO=3&transport=websocket [31m+19ms[0m
2020-07-08T08:28:26.8282029Z [32;1mcypress:server:util:socket_whitelist [0mis incoming request whitelisted? { isWhitelisted: [33mtrue[39m, reqUrl: [32m'/__socket.io/?EIO=3&transport=websocket'[39m, remotePort: [33m39786[39m, remoteAddress: [32m'127.0.0.1'[39m } [32m+1ms[0m
2020-07-08T08:28:26.8394963Z [34;1mcypress:server:socket [0msocket connected [34m+23s[0m
The same in the second log
2020-07-06T12:11:55.0223534Z [32;1mcypress:server:browsers:electron [0mconsole message: { column: [33m26[39m, level: [32m'debug'[39m, line: [33m18393[39m, source: [32m'console-api'[39m, text: [32m'message arrived at manager storybookjs/knobs/set [object Object]'[39m, url: [32m'http://127.0.0.1:9001/vendors~main.acb06a633f95331e0a72.bundle.js'[39m } [32m+294ms[0m
2020-07-06T12:11:55.0912139Z [32;1mcypress:server:util:socket_whitelist [0mwhitelisted socket closed, removing { localPort: [33m58092[39m } [32m+5s[0m
but this time no error.
We're using https://www.npmjs.com/package/cypress-cucumber-preprocessor
@positive
Scenario: I disable showPageSizeSelection
Given I check paginate checkbox
And I check showPageSizeSelection checkbox
When I uncheck showPageSizeSelection checkbox
Then pageSize is not visible
This log entry
2020-07-08T08:28:08.8114061Z [32;1mcypress:server:browsers:electron [0mconsole message: { column: [33m26[39m, level: [32m'debug'[39m, line: [33m18393[39m, source: [32m'console-api'[39m, text: [32m'message arrived at manager storybookjs/knobs/set [object Object]'[39m, url: [32m'http://127.0.0.1:9001/vendors~main.acb06a633f95331e0a72.bundle.js'[39m } [32m+264ms[0m
relates to
Given I check paginate checkbox
then there is nothing logged after. Interestingly we use the same steps in a previous test and they succeed.
@positive
Scenario: I enable showPageSizeSelection
Given I check paginate checkbox
When I check showPageSizeSelection checkbox
Then pageSize is visible
I'm running it locally in a loop until it fails, but so far haven't been able to reproduce it.
You might want to turn off the ASCII characters to clean up the noise of the logs as explained here.
I just looked through the logs and saw that was the last hook/test definition logged, but yah I may have missed a later log.
I've seen some people mention setting --shm-size
for GitHub actions maybe resolving some hanging issues. https://github.com/cypress-io/cypress/issues/6695#issuecomment-627376828
I would say this is a duplciate of https://github.com/cypress-io/cypress/issues/6695 overall, which is a bit of a black hole on causes also.
Thanks for the tip for ASCII.
Unfortunately --shm-size
is a container option, we don't run our tests in a container, we run them on the host directly.
If you do not set a container, all steps will run directly on the host specified by runs-on unless a step refers to an action configured to run in a container.
Any other ideas we could investigate?
Duplicate of https://github.com/cypress-io/cypress/issues/6695
Current behavior:
Our builds are failing intermittently, restarting the build usually results in a successful build. We're using cypress dashboard to orchestrate 20 CI machines.
Here is an example of a build that ran for almost 2 hours without any progress. https://github.com/Sage/carbon/runs/848939252?check_suite_focus=true
The build typically takes ~10 mins.
Here is the log from the step that failed. Here is the log from a different PR that also failed.
Desired behavior:
Builds should consistently pass.
Test code to reproduce
Running the cypress build will intermittently fail on this commit.
https://github.com/Sage/carbon/tree/6116e86b19145bba6d702434afb06ab4621c784c
Versions
Cypress: 4.9.0 CI: GitHub Actions GitHub Action: cypress-io/github-action@v2.2.1