Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates a failing test so that it will pass. Update selector in test so only the expected button is returned.
While this should fix the test, I see some improvements that can be made to make the test more robust and less likely to fail in the future. Currently, the selector is getting two buttons and checking if the text matches the first. The changes the selector to only get the first button so when it checks the button text it will find a match.
Ideally, we should add a unique id attribute (or better yet, a data-cy attribute) to the elements on the components so that we can select them easily in the test. Here's more on this: https://docs.cypress.io/guides/references/best-practices#Selecting-Elements
In this case, we should probably just check that the button exists, since the text is translatable. We don't want to be locked into content for the test to pass.
To implement it all we'd add the data-cy attribute 'view-site' to the button in question and then
Becomes
There are a lot of places this can be implemented to help the tests be more robust and reliable over time.