NCIOCPL / drug-dictionary-app

NCI Drug Dictionary Application
2 stars 0 forks source link

Pa11y tests can fail when running in Github Actions #108

Closed bryanpizzillo closed 3 years ago

bryanpizzillo commented 3 years ago

Issue description

A few of our app modules will fail from time to time during the pa11y tests due to the page crashing. This seems to be a known issue with puppet running inside of Docker. By default a container will use 64mb of shared memory, (/dev/shm) This is not enough memory for chrome at times when puppet runs. Pa11y uses puppet. The '--disable-dev-shm-usage' argument can be added to the chromeLaunchConfig in (I think) .pa11yci. From what I can see it looks like the options we want would actually be:

    "chromeLaunchConfig": {
        "args": [
            "--no-sandbox",
            "--disable-setuid-sandbox",
            "--disable-dev-shm-usage"
        ]
    }

ESTIMATE TBD

Steps to reproduce the issue

  1. Look at Github actions and see it fail and the the following error message:
    
    Running Pa11y on 15 URLs:
    > http://localhost:3000 - 0 errors
    > http://localhost:3000?cfg=1 - 0 errors
    > http://localhost:3000?cfg=2 - 0 errors
    > http://localhost:3000?cfg=3 - 0 errors
    > http://localhost:3000/expand/A - 0 errors
    > http://localhost:3000/expand/A?cfg=1 - 0 errors
    > http://localhost:3000/expand/K?cfg=2 - 0 errors
    > http://localhost:3000/expand/Y?cfg=3 - 0 errors
    (node:2130) UnhandledPromiseRejectionWarning: Error: Page crashed!
    at Page._onTargetCrashed (/home/runner/work/glossary-app/glossary-app/node_modules/puppeteer/lib/Page.js:215:24)
    at CDPSession.<anonymous> (/home/runner/work/glossary-app/glossary-app/node_modules/puppeteer/lib/Page.js:123:56)
    at CDPSession.emit (events.js:314:20)
    at CDPSession._onMessage (/home/runner/work/glossary-app/glossary-app/node_modules/puppeteer/lib/Connection.js:200:12)
    at Connection._onMessage (/home/runner/work/glossary-app/glossary-app/node_modules/puppeteer/lib/Connection.js:112:17)
    at WebSocket.<anonymous> (/home/runner/work/glossary-app/glossary-app/node_modules/puppeteer/lib/WebSocketTransport.js:44:24)
    at WebSocket.onMessage (/home/runner/work/glossary-app/glossary-app/node_modules/puppeteer/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:314:20)
    at Receiver.receiverOnMessage (/home/runner/work/glossary-app/glossary-app/node_modules/puppeteer/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:314:20)
    (node:2130) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
    (node:2130) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    > http://localhost:3000/def/a33 - 0 errors
    > http://localhost:3000/def/metastatic - 0 errors
    > http://localhost:3000/def/metastasico?cfg=1 - 0 errors
    > http://localhost:3000/def/acrochordon?cfg=2 - 0 errors
    > http://localhost:3000/def/acrochordon?cfg=3 - 0 errors
    > http://localhost:3000/def/antioncogen?cfg=3 - 0 errors
    > http://localhost:3000/def/a33?cfg=1 - Failed to run

Errors in http://localhost:3000/def/a33?cfg=1:

• Error: Pa11y timed out (30000ms)

✘ 14/15 URLs passed npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @nciocpl/glossary-app@1.2.2 pa11y: NODE_ENV=test pa11y-ci npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @nciocpl/glossary-app@1.2.2 pa11y script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2021-03-30T15_41_44_578Z-debug.log Error: Command failed with exit code 2: npm run pa11y at makeError (/home/runner/work/glossary-app/glossary-app/node_modules/start-server-and-test/node_modules/execa/lib/error.js:56:11) at handlePromise (/home/runner/work/glossary-app/glossary-app/node_modules/start-server-and-test/node_modules/execa/index.js:114:26) at processTicksAndRejections (internal/process/task_queues.js:97:5) { command: 'npm run pa11y', exitCode: 2, signal: undefined, signalDescription: undefined, stdout: undefined, stderr: undefined, failed: true, timedOut: false, isCanceled: false, killed: false } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @nciocpl/glossary-app@1.2.2 pa11y-tests: start-server-and-test start http://localhost:3000 pa11y npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @nciocpl/glossary-app@1.2.2 pa11y-tests script.



### What's the expected result?
- Github actions would not fail.

### What's the actual result?
- It fails from time to time