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

Homepage Tests #2591

Merged
merged 11 commits into from
Feb 12, 2020
Merged

Homepage Tests #2591

merged 11 commits into from
Feb 12, 2020

Conversation

ioedeveloper
Copy link
Member

No description provided.

browser.waitForElementVisible('#side-panel')
.assert.containsText('#side-panel h6[class^="swapitTitle"]', 'FILE EXPLORERS')
.waitForElementVisible('#side-panel div[class^="treeview"]')
.waitForElementVisible('#side-panel ul[key="browser"] > li:nth-child(4)')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we had some discussions a while ago about how we should target elements from the e2e tests. The outcome was that we should target with id as much as possible so we don't rely so much in the html structure of the page. Not that you should do this now, but i'd like to open this discussion again
What do you think?
cc @LianaHus

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, using id is the right way to target element as long as id is unique, this is why we prepend a 'location of the element' to the element id. for example "remixHomePageOpenFile'". We still change the UI a lot, and if we use the element type we should change the test each time we change an element type, which will never be the case with id.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the drawback of this is that with all the tests we'll have, if you have to put an unique id each time for all the tested elements, the html might be spammed.
@ioedeveloper are there some best practices we can refer too?

Copy link
Member Author

@ioedeveloper ioedeveloper Feb 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making your browser tests less fragile and more resilient is considered a best practice, and this can be achieved by using a unique identifier (not necessarily an ID due to spamming as stated by @yann300 ). A data-attribute can be used as a better alternative. Here are a few articles to support my claim selecting elements best practices, making-your-ui-tests-resilient-to-change . I'm not so sure how well nightwatch works with data-attributes but it is something i'm willing to look into.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good let's do that then

@ioedeveloper ioedeveloper mentioned this pull request Feb 12, 2020
@yann300 yann300 merged commit c62d2d3 into master Feb 12, 2020
@yann300 yann300 deleted the e2e-tests branch February 12, 2020 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants