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

Fix and improve acceptance testing attributes #665

Merged
merged 10 commits into from
Jan 18, 2024

Conversation

Cruikshanks
Copy link
Member

https://eaflood.atlassian.net/browse/WATER-4336

In WATER-4070 we logged that the Billing & Data team struggled because they could not access the larger bill runs. The service would appear to be busy for a while and then eventually error.

We figured out it was simply that the service could not return all the data needed using the current design, which listed out all the transactions in a bill run. We also knew the data could be collected in a more performant way.

So, we ended up rebuilding the whole journey of viewing a bill run, the bills in it and the transaction details.

This also allowed us to add attributes to elements likely referenced in our acceptance tests. A recognised best practice in selecting elements in tests is to avoid brittle, complex selectors and to use data-* attributes instead.

For reference we have opted for data-test as our convention

The legacy pages had none of this, and often didn't even bother with IDs. This means a common battle with the acceptance tests we inherited is finding suitable selectors for the elements we needed.

We now need to update those tests we broke because of our new pages. Doing this has allowed us to spot a few places where we've made mistakes and others where data-test would help. This change is us making those tweaks to the billing templates.

https://eaflood.atlassian.net/browse/WATER-4336

In WATER-4070 we logged that the Billing & Data team were struggling because they could not access the larger bill runs. The service would appear to be busy for a while and then eventually error.

We were able to figure out it was simply that the service was not able to return all the data needed using the current design, which listed out all the transactions in a bill run. We also knew the data could be collected in a more performant way.

So, we ended up rebuilding the whole journey of viewing a bill run, the bills in it and the transaction details.

This also gave us the opportunity to add attributes to elements likely to be referenced in our acceptance tests. A [recognised best practice in selecting elements in tests](https://docs.cypress.io/guides/references/best-practices#Selecting-Elements) is to avoid brittle, complex selectors and to use `data-*` attributes instead.

> For reference we have opted for `data-test` as our convention

The legacy pages had none of this, and often didn't even bother with ID's. This means a common battle with the acceptance tests we inherited is finding suitable selectors for the elements we needed.

We now need to [update those tests we broke](DEFRA/water-abstraction-acceptance-tests#78) because of our new pages. Doing this has allowed us to spot a few places where we've made mistakes and others where `data-test` would help. This change is us making those tweaks to the billing templates.
@Cruikshanks Cruikshanks added the bug Something isn't working label Jan 17, 2024
@Cruikshanks Cruikshanks self-assigned this Jan 17, 2024
@Cruikshanks Cruikshanks marked this pull request as ready for review January 18, 2024 08:33
@Cruikshanks Cruikshanks merged commit d45e4ad into main Jan 18, 2024
6 checks passed
@Cruikshanks Cruikshanks deleted the fix-and-improve-acp-test-attributes branch January 18, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants