fixmystreet icon indicating copy to clipboard operation
fixmystreet copied to clipboard

[Oxfordshire] Query Oxfordshire Highways wfs feed and add message to roadworks page

Open nephila-nacrea opened this issue 2 years ago • 4 comments

  • Add a WFS layer for Oxfordshire Highway Schemes
  • Layer visible only on category selection (any category)
  • Merges Oxfordhsire Highways message with standard roadworks message if it exists
  • Adds tests

Closes https://github.com/mysociety/societyworks/issues/2965.

[skip changelog]

nephila-nacrea avatar Jul 22 '22 18:07 nephila-nacrea

Codecov Report

Merging #4025 (36fb31f) into master (1696d0f) will decrease coverage by 12.54%. The diff coverage is 89.65%.

:exclamation: Current head 36fb31f differs from pull request most recent head 8bbdbdd. Consider uploading reports for the commit 8bbdbdd to get more accurate results

@@             Coverage Diff             @@
##           master    #4025       +/-   ##
===========================================
- Coverage   82.40%   69.87%   -12.54%     
===========================================
  Files         371       41      -330     
  Lines       28053     4936    -23117     
  Branches     4382        0     -4382     
===========================================
- Hits        23117     3449    -19668     
+ Misses       3621     1487     -2134     
+ Partials     1315        0     -1315     
Impacted Files Coverage Δ
web/cobrands/fixmystreet-uk-councils/roadworks.js 89.28% <50.00%> (-4.72%) :arrow_down:
web/cobrands/oxfordshire/assets.js 77.92% <94.23%> (+21.92%) :arrow_up:

... and 343 files with indirect coverage changes

codecov[bot] avatar Jul 22 '22 18:07 codecov[bot]

I'm seeing an intermittent error in the Cypress test:

  1) Oxfordshire highways messages displays nearby roadworks when no highways messages:
     CypressError: Timed out retrying: cy.click() failed because this element is detached from the DOM.

<label class="govuk-label govuk-radios__label" for="category_5">Flytipping</label>

Cypress requires elements be attached in the DOM to interact with them.

The previous command that ran was:

  > cy.contains()

This DOM element likely became detached somewhere between the previous and current command.

Common situations why this happens:
  - Your JS framework re-rendered asynchronously
  - Your app code reacted to an event firing and removed the element

You typically need to re-query for the element or add 'guards' which delay Cypress from running new commands.

https://on.cypress.io/element-has-detached-from-dom
      at Object.cypressErr (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:86207:11)
      at Object.throwErr (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:86162:18)
      at Object.throwErrByPath (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:86194:17)
      at Object.retry (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:76849:16)
      at retryActionability (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:65238:19)
      at tryCatcher (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:120203:23)
      at Function.Promise.attempt.Promise.try (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:117478:29)
      at tryFn (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:77307:21)
      at whenStable (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:77342:12)
      at http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:76892:16
      at tryCatcher (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:120203:23)
      at Promise._settlePromiseFromHandler (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:118139:31)
      at Promise._settlePromise (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:118196:18)
      at Promise._settlePromise0 (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:118241:10)
      at Promise._settlePromises (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:118320:18)
      at Promise._fulfill (http://oxfordshire.localhost:3001/__cypress/runner/cypress_runner.js:118265:18)

davea avatar Nov 09 '22 22:11 davea

I'm not getting the error, but hopefully a few waits might "delay Cypress from running new commands". Let me know if that works for you and seems like a viable solution.

MorayMySoc avatar Nov 21 '22 17:11 MorayMySoc

I've rebased this, removed the fixture() lines (they weren't doing anything), and removed the wait(1000)s and replaced them with waits for report-ajax which matches other tests and should resolve any flapping caused by that fetch on page load. And added a couple of scrolls into view to fix issues where the roadworks were further down than the tests expected.

dracos avatar Jan 27 '23 16:01 dracos