Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create integration test script #810

Closed
antross opened this issue Sep 5, 2019 · 5 comments · Fixed by #843
Closed

Create integration test script #810

antross opened this issue Sep 5, 2019 · 5 comments · Fixed by #843

Comments

@antross
Copy link
Member

antross commented Sep 5, 2019

Currently CI runs webhint against the site, but doesn't verify a scan can actually be performed. We've had this result in bad builds being promoted to production in the past. Using something like puppeteer to actually drive the website in a more comprehensive integration test before the swap to production should help avoid repeating this problem in the future.

@molant
Copy link
Member

molant commented Sep 26, 2019

We can probably create a script that uses puppeteer to open a browser, go to the staging website, navigate to different pages and verify we receive a 200 for all of them and finally performs a scan and a search.

We will be calling that script from the pipelines once it is done.

@LeoSL
Copy link
Contributor

LeoSL commented Oct 3, 2019

Hi guys, I was planning to dive into this issue since I like CI/CD integrations and it says that the difficulty is easy and also has the good first issue.

However, after a few minutes investigating the repo and executing the setup process I started to have some questions:

  • Which CI @antross is making reference to?
  • I'm also lost on which staging website @molant is making reference to - to run the integration test. Besides that, where exactly the puppeteer script will perform before the CI runs
  • gulp issues on npm run build (detailed below).
  • the issue requires at least some basic puppeteer knowledge and from what I saw on the repo there's no puppeteer configured.

That said, I'd argue that this is not a good first issue and in my opinion, not so easy. Making the change could be straightforward to someone familiar with wehint.io current architecture and test suite. However, for someone that is just coming here from scratch, it's kind of tricky.

  • gulp issue
[18:59:00] Error in plugin "gulp-imagemin"
Message:
    spawn /Users/leosl/src/webhint.io/node_modules/optipng-bin/vendor/optipng ENOENT
Details:
    errno: ENOENT
    code: ENOENT
    syscall: spawn /Users/leosl/src/webhint.io/node_modules/optipng-bin/vendor/optipng
    path: /Users/leosl/src/webhint.io/node_modules/optipng-bin/vendor/optipng
    spawnargs: -strip,all,-clobber,-o,3,-out,/private/var/folders/z_/rcyh1f793y7d3k6w5wvrzg0c0000gn/T/a369bbd5-57f6-4cb1-9292-4910ec8241d7,-fix,/private/var/folders/z_/rcyh1f793y7d3k6w5wvrzg0c0000gn/T/88702354-471a-49f5-b5a9-f5a3c075dbc8
    killed: false
    stdout:
    stderr:
    failed: true
    signal: null
    cmd: /Users/leosl/src/webhint.io/node_modules/optipng-bin/vendor/optipng -strip all -clobber -o 3 -out /private/var/folders/z_/rcyh1f793y7d3k6w5wvrzg0c0000gn/T/a369bbd5-57f6-4cb1-9292-4910ec8241d7 -fix /private/var/folders/z_/rcyh1f793y7d3k6w5wvrzg0c0000gn/T/88702354-471a-49f5-b5a9-f5a3c075dbc8
    timedOut: false
    fileName: /Users/leosl/src/webhint.io/src/webhint-theme-optimized/formatter/images/json-output.png
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false

[18:59:00] 'optimize:images' errored after 421 ms

@molant molant changed the title Add integration test as part of CI before promoting to production Create integration test script Oct 4, 2019
@molant
Copy link
Member

molant commented Oct 4, 2019

Hi @LeoSL

I'm sorry you are having issues with this one. We assumed some experience with puppeteer when we tagged it but you are right that could be a bit misleading.

The CI server we are using is Azure Pipelines. You can see the builds for all the webhint projects in here.

The file that decides what is run in Azure DevOps is azure-pipelines.yml

The staging environment is https://sonarwhal-staging.azurewebsites.net. It should look almost the same than the official website.

So this is what I'm thinking as a breakdown:

  1. Add puppeteer to the project
  2. Create /helpers/integration-tests.js. This is the script with the integration tests. This script should:

I've split this issue into 2 so the integration with Azure Pipelines is done at a different moment (#842).

Thanks for looking into this @LeoSL !

@molant
Copy link
Member

molant commented Oct 4, 2019

Also re the gulp issues you are seeing I have no idea why. What version of node and in what platform are you working? Also, this should not be a blocker as you don't need to build the website to test https://sonarwhal-staging.azurewebsites.net

@LeoSL
Copy link
Contributor

LeoSL commented Oct 4, 2019

Thank you for the detailed explanation and quick reply @molant ! I really appreciate it!

I will work on that later today.

antross pushed a commit that referenced this issue Oct 14, 2019
- Install Puppeteer as a dev dependency on package.json.
- Request a collection of webhint.io staging URLs and save the response in a
Map() object.
- Iterate over the Map and check if there is any status different from 200 or
another unknown error.
- If there is any error, throw it to interrupt the test execution.

- - - - - - - - - -

Fix #810 
Close #843
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants