cfpb / development

A repository for the discussion and publication of the CFPB development team standards.
Creative Commons Zero v1.0 Universal
63 stars 32 forks source link

Automate Sauce Lab browser tests in Travis for PRs #131

Open cfarm opened 6 years ago

cfarm commented 6 years ago
cfarm commented 6 years ago
cfarm commented 6 years ago

short-term goal: run browser tests with Sauce Labs on push using Travis; get at least one browser working (latest IE) and see how this affects the time for builds

Scotchester commented 6 years ago
cfarm commented 6 years ago

@Scotchester and document it ✍️ 📓 📝

cfarm commented 6 years ago

Notes from Virginia's and my pairing session 7/19 testing Sauce Labs acceptance tests locally

Questions

Todos

Improvements

virginiacc commented 6 years ago

Test suite failures on Sauce labs

Scenario Failure Browser
Large Size, when mouse is over link (mega-menu.feature:13) ✖ Then the mega-menu organism shouldn't show the first link immediately
  • internet explorer 10.0 Windows 7 31-4
  • internet explorer Windows 10 21-4
  • chrome Windows 01
Large Size, when mouse is over link (mega-menu.feature:13) ✖ Then the mega-menu organism shouldn't show the first link immediately (UnsupportedOperationError: mouseMoveTo)
  • firefox Windows 10 11-4
State on page load (multi-select.feature:10) ✖ Then the multi-select should be rendered (multi-select.js:63)
  • internet explorer Windows 10
Navigate to the previous page (pagination.feature:14) ✖ Then the page url should contain "page=1"
  • internet explorer 10.0 Windows 7
Navigate to nth Page (pagination.feature:19) ✖ Then the page url should contain "page=2"
  • internet explorer Windows 10
Large Size, should navigate to search portal (global-search.feature:24) ✖ Then I should navigate to search portal
  • internet explorer 10.0 Windows 7
cfarm commented 5 years ago

Do we ever run all the browser tests in any environment, such as Jenkins? I'm going to dig around docs/JAC jobs to find out but if anyone knows the answer let us know. From what I remember when talking about it in the past, the answer was 'no.'

chosak commented 5 years ago

@cfarm afaik browser tests are never run on Jenkins, only on Travis.

cfarm commented 5 years ago

OK. The browser tests are run in Chrome with Travis, so it seems that none of the other browsers are tested automatically: https://github.com/cfpb/cfgov-refresh/blob/master/test/browser_tests/default-suites.js#L64

cfarm commented 5 years ago

For scheduling all the browser tests to run outside of the Travis PR queue, we looked at https://circleci.com/docs/2.0/workflows/#scheduling-a-workflow which allows us to schedule a specific time to run the browser tests every day. This wouldn't block our PRs since it'd be running through CircleCI instead of Travis. We could also use CircleCI eventually to run performance tests, visual regression tests, etc - other tests that we normally don't implement on Travis because we worry about blocking PRs.

Adam would have to approve CircleCI app on the cfpb organization for us to try this out.

Edited to add: can we also set up Sauce Labs to run these as a cron job? Something to investigate

cfarm commented 5 years ago

Plan for next Thursday 3/ 👍

Future discussions:

virginiacc commented 5 years ago

Travis cron jobs

We initially looked into the possibility of creating a Travis cron job to run the browser tests in Sauce at night so it wouldn't impact our Travis queue, but it appears that Travis only offers the option to set an interval (daily, weekly, monthly) for a cron job, not a specific start time. It does sound like jobs run at approximately the same time you first set them up, so a workaround could be to initially enable the job at night. Using something like CircleCI to completely bypass the Travis queue might be a cleaner option, though.

cfarm commented 5 years ago

Here's my WIP branch with changes to the browser tests documentation...added info on how to run tests against localhost, consumerfinance.gov, etc. I haven't fully tested some of the instructions I wrote here, so they are probably wrong in places (it's based on piecing together memories of last July's findings) https://github.com/cfpb/cfgov-refresh/pull/4859

cfarm commented 5 years ago

Cron jobs follow-up

Travis and CircleCI cron jobs for the cross-browser tests are now on hold. We may be able to use CircleCI, we need to talk to @marcesher about our use case and get a PUA going to be able to enable it on cfgov-refresh.

For now, we will continue our proof-of-concept for running cross-browser tests on Sauce Labs by using Jenkins - for reference we will use this technique https://github.com/cfpb/cfgov-refresh/pull/new/new-acceptance-tests-feedback

contolini commented 5 years ago

JAC the whats-in-a-name job to use node > 8