Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Add verification step for pending invites section #1134

Merged
14 commits merged into from
Apr 25, 2018

Conversation

ghost
Copy link

@ghost ghost commented Apr 16, 2018

A quick verification step for the existence of pending invites after sending one and accepting it.

@ghost ghost requested a review from rachelmcr April 16, 2018 06:57
@ghost ghost mentioned this pull request Apr 16, 2018
Copy link
Member

@rachelmcr rachelmcr left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, Sofia! I have a few specific questions about the code changes, but I'm also seeing these linting failures in the CI run on the PR:

/home/circleci/wp-e2e-tests/lib/pages/invite-people-page.js
  69:20  warning  Missing space before opening brace  space-before-blocks

/home/circleci/wp-e2e-tests/lib/pages/people-page.js
   17:38  warning  There must be a space inside this paren  space-in-parens
   17:68  warning  There must be a space inside this paren  space-in-parens
  222:31  warning  Missing space before opening brace       space-before-blocks

/home/circleci/wp-e2e-tests/specs/wp-invite-users-spec.js
  27:8   warning  'SidebarComponent' is defined but never used          no-unused-vars
  27:70  warning  Missing semicolon                                     semi
  98:2   warning  Mixed spaces and tabs                                 no-mixed-spaces-and-tabs
  99:2   warning  Mixed spaces and tabs                                 no-mixed-spaces-and-tabs
  99:6   warning  Expected indentation of 5 tab characters but found 4  indent

Let me know if you have any questions about that!

@@ -63,4 +65,9 @@ export default class InvitePeoplePage extends BaseContainer {

return DriverHelper.isElementPresent( self.driver, self.noticeSelector );
}

backToPeopleMenu(){
Copy link
Member

Choose a reason for hiding this comment

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

Do we gain something by adding this method to this page object? Since it uses the sidebar component without modifications, what do you think of calling the sidebar component's selectPeople() method directly in the test spec?

Copy link
Author

Choose a reason for hiding this comment

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

I added a couple of lines more to the method so it does not break when attempting to return to the sidebar menu on mobiles. I usually store all selectors or specific methods that are unique for a certain page in a page object, just also to improve readability in the spec. Am I not seeing a potential downside?

Copy link
Member

Choose a reason for hiding this comment

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

With this change it's working for me on mobile as well. 👍

I don't think this method is really necessary, since we have a set of components (along with page objects) that we tend to use directly in the specs. Those components (like the top navbar and the sidebar) and their selectors/methods aren't specific to certain pages. I prefer using them directly (instead of wrapping them in a page-specific method) because it provides clarity in the spec about whether you're interacting with a page-specific element or another component, but this approach also works.

One example of a spec using the sidebar component directly:
https://github.com/Automattic/wp-e2e-tests/blob/master/specs/wp-view-site-spec.js

@@ -14,6 +14,7 @@ export default class PeoplePage extends BaseContainer {
this.searchResultsLoadingSelector = By.css( '.people-profile.is-placeholder' );
this.peopleListItemSelector = By.css( '.people-list-item' );
this.successNoticeSelector = By.css( '.people-notices__notice.notice.is-success' );
this.pendingInviteSelector = By.css('.section-header__label-text');
Copy link
Member

Choose a reason for hiding this comment

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

This is also the class on the "Accepted" label on the People > Invites tab, and I see it for example on the People > Team tab, so it isn't specific to the Invites tab either. Is there another label you can use that's specific to the pending invites section of the page?

Copy link
Member

@rachelmcr rachelmcr left a comment

Choose a reason for hiding this comment

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

With the latest changes this works for me. 👍 It's your call whether to make any further changes (e.g. the backToPeopleMenu() method we discussed) or keep it as it is, based on what you think will work best both here and thinking ahead to similar scenarios we may run into in the future. :)

@rachelmcr
Copy link
Member

As discussed in Slack, let's make sure this tests for the specific invite we just sent instead of any pending invite.

Copy link
Member

@rachelmcr rachelmcr left a comment

Choose a reason for hiding this comment

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

The update you made to the selector for the pending invite looks good (I appreciate how the naming is very clear about what you're testing here) and the test works well on multiple screen sizes. My only concern at this point is to clarify the error message for each Can see pending invite step, and then this should be ok to merge.

return assert.equal(
mostRecentPendingInviteEmail,
newInviteEmailAddress,
'The email address prefilled on the accept invite page is not correct' );
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how this message is related to this test step; could you update it to point to the exact error that might be encountered here?

@rachelmcr
Copy link
Member

The updated error message looks good! Go ahead and merge this PR when you're ready. :)

@ghost ghost merged commit 7465b55 into master Apr 25, 2018
@alisterscott alisterscott deleted the Add-test-step-to-verify-pending-invite branch July 20, 2018 05:54
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants