Automattic / wp-e2e-tests

Automated end-to-end tests for WordPress.com

Home Page:https://github.com/Automattic/wp-calypso

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Selecting wrong menu items

alisterscott opened this issue · comments

If you run the tests without retrying it's common to see the tests selecting the wrong item in the menu sidebar and then failing as the incorrect screen is shown

Something is funky with how we click these sidebar items - we should investigate why

To reproduce change "max_test_attempts": 3, to "max_test_attempts": 1, in magellan.json and commit the change to see the failures in CircleCI for a branch

This happened recently for 'People' page when I ran tests locally. It was failing randomly.
@alisterscott What do you think to change the way how we are getting these elements? Instead of '.sites-navigation [data-tip-target="people"] a' to add data-e2e attribute to class menu-link-text for every item in sidebar?

screen shot 2018-10-18 at 14 39 02

We can pass .menu-link-text as a selector and item name from the sidebar to selectElementByText()

I think we should try to avoid selecting menu items by text since they're translated and won't work in other languages, eg for i18n tests, and also menu text is more likely to change than a specific attribute. Or do I misunderstand something?

We can pass .menu-link-text as a selector and item name from the sidebar to selectElementByText()

I think we should try to avoid selecting menu items by text since they're translated and won't work in other languages, eg for i18n tests, and also menu text is more likely to change than a specific attribute. Or do I misunderstand something?

@alisterscott I replied to this comment here. So yes, data e2e attribute would be more stable solution.