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

Improve testing around joining a section LP-1688 #38570

Merged
merged 7 commits into from Jan 21, 2021

Conversation

drew-beckmen
Copy link
Contributor

@drew-beckmen drew-beckmen commented Jan 14, 2021

Additional unit and integration tests to expand test coverage around joining sections. A follow up to #38225 - while #38225 focused on adding an integration test for joining a section through /join/:section_code, this PR focuses on joining sections through the JoinSection component on the student and teacher dashboard.

I also added a test for a new type of JoinSectionNotification introduced in #38493

Links

Testing story

Ran tests locally

Resolved: Still having an issue getting React state to update based on form changes made in the UI test starting on line 225 in teacher_dashboad.feature. Hopefully I'll get that resolved shortly -- posted a question to the group in Slack.

For future UI test writers, if you are writing a UI test that interacts with a responsive form (ie. not just filling out inputs and pressing a button), make sure to use the step with press keys and add the @no_ie tag to your test since the press keys step is not supported in IE.

Reviewer Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@drew-beckmen drew-beckmen requested a review from a team January 19, 2021 20:34
Copy link
Contributor

@jamescodeorg jamescodeorg left a comment

Choose a reason for hiding this comment

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

Very nice, thanks for adding these!

@@ -1448,6 +1456,13 @@ def create_user(name, url: '/users.json', code: 201, **user_opts)
}
end

# press keys allows React to pick up on the changes
And(/I press the keys of the section code into "([^"]*)"$/) do |selector|
Copy link
Contributor

Choose a reason for hiding this comment

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

I think calling this "I enter the section code ____ into ____" might be a little bit more readable when it's used. (Also, where is this used?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used on line 240 of the UI test file. Since the section code is randomly generated in the Ruby file (steps.rb), I have no way of accessing that info from the UI test unless I create this additional step that parses the section URL for the section code and uses "press keys" to enter it into the React form.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. I might still use "enter the section code into" instead of "press the keys of the section code into" for better readability where it's used? Up to you.

@@ -1402,6 +1402,14 @@ def create_user(name, url: '/users.json', code: 201, **user_opts)
end
end

And(/^I join the section I already own$/) do
page_load(true) do
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this differ from "I attempt to join the section" only by this page_load? If so, why is having this page_load important?

And I press the keys of the section code into "input.ui-test-join-section"
And I click selector "div.ui-test-join-section"
Then I wait until element ".announcement-notification" is visible
And element ".announcement-notification" contains text matching "You are already the owner of section"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add newline at end of line

@drew-beckmen drew-beckmen merged commit d8685f5 into staging Jan 21, 2021
@drew-beckmen drew-beckmen deleted the join-section-component-ui-test branch January 21, 2021 04:32
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.

None yet

2 participants