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

Add Button functional tests. #168

Merged
merged 5 commits into from
May 30, 2017
Merged

Add Button functional tests. #168

merged 5 commits into from
May 30, 2017

Conversation

lzhoucs
Copy link
Contributor

@lzhoucs lzhoucs commented May 10, 2017

Type: functional tests

The following has been addressed in the PR:

  • There is a related issue
  • All code matches the style guide
  • Unit or Functional tests are included in the PR

Resolves #149

@codecov
Copy link

codecov bot commented May 10, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@29875b7). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #168   +/-   ##
=========================================
  Coverage          ?   99.24%           
=========================================
  Files             ?       18           
  Lines             ?      929           
  Branches          ?      279           
=========================================
  Hits              ?      922           
  Misses            ?        1           
  Partials          ?        6

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29875b7...b7874c1. Read the comment docs.

Copy link
Member

@dylans dylans left a comment

Choose a reason for hiding this comment

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

a couple of small nitpicks.

'button should be visible'(this: any) {
return getPage(this.remote)
.findByCssSelector('button:first-of-type')
// as per mwistrand, `isDisplayed` is broken in Safari 10, commented out for now
Copy link
Member

Choose a reason for hiding this comment

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

Could we add a link to a Selenium driver issue listed somewhere so we can come back and fix this later?

Copy link
Member

Choose a reason for hiding this comment

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

Also comment indentation is off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just added the Selenium issue link and fixed the indentation. Please let me know if there's any other issues. Thanks!

@dylans dylans added this to the 2017.05 milestone May 11, 2017
Copy link
Member

@dylans dylans left a comment

Choose a reason for hiding this comment

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

It looks fine to me, though now the CI is failing :(

@lzhoucs
Copy link
Contributor Author

lzhoucs commented May 11, 2017

Yeah. It is the known Safari issue on browserstack for today: NoSuchDriver.


'button should be visible'(this: any) {
return getPage(this.remote)
.findByCssSelector('button:first-of-type')
Copy link
Member

Choose a reason for hiding this comment

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

Please change all findByCssSelector calls to use the generate css-module class names by importing the appropriate m.css file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review Tom. I looked at 6612379 where we changed to use css-module class to access the internals of a widget, and this approach makes sense to me. However, in my case here where the widget structure is simple and I am not trying to exercise the internal components of the widget, but the widget itself - I am trying to locate the first widget on the page (there's several button widgets in the example), so I am not sure if css-module class would be any help locating what I am looking for. For example, by using css-module, it seems I still have to do something like this: .findByCssSelector(`button.${css.root}`:first-of-type). That said, the example page probably should have included ids for each widget for external tests like this one.

Copy link
Member

Choose a reason for hiding this comment

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

I see what you are saying @lzhoucs, however you are assuming that the tag will be button. This is not an assumption that you can make in all cases. More importantly, these tests are also to help with dojo 2 adopters and it's important that we consistently adopt the right way to deliver our code and tests. As per our css-modules approach, no css selector at any point should ever reference the tagname.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that tag name shouldn't be used. I've added a wrapper div with id for each widget in the example, together with css-module class to locate the widget. Please take another look when you get chance, @tomdye, thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Much better, although I'd have used a class over an id. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think id is not always bad. In the example page, each example is unique. There will always be one example-1 on the page. And I am not trying to consistently style multiple examples, but access each of them individually.

'button should be visible'(this: any) {
return getPage(this.remote)
.findByCssSelector('button:first-of-type')
// `isDisplayed` is broken in Safari 10, commented out for now. See https://github.com/SeleniumHQ/selenium/issues/3029
Copy link
Member

Choose a reason for hiding this comment

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

Rather than leaving this in, can we please remove it in a separate commit? Then it can be added back in again as and when it's appropriate to do so. I think it's better not to have commented out code in our master branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dylan suggested a slightly different approach: #168 (comment), so that's why the comment is there. I've removed the commented code, however I do have a concern that it might get lost over time once the issue with Safari is fixed.

@lzhoucs
Copy link
Contributor Author

lzhoucs commented May 12, 2017

@tomdye , thanks for the review. I've addressed your feedback. Please take another look when you get chance and let me know if there's any other issues. Thanks!

Copy link
Member

@tomdye tomdye left a comment

Choose a reason for hiding this comment

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

Needs to be rebased

@lzhoucs lzhoucs merged commit 4860dba into dojo:master May 30, 2017
@lzhoucs lzhoucs deleted the buttons-functional-tests branch May 30, 2017 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants