-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Integration tests for updating apps with many permissions
The tests in this file kept this DRY but were a little tricky to figure out at a glance what each test was doing. We've refactored them a fair bit to remove some of the abstractions and make them easier to read, while still looping over the two use cases of updating one's own permissions and updating those of another user. This refactor was prompted by the addition of a new Accessible Autocomplete component to the Organisations page. We've added a new AutocompleteHelper in this commit to perform some simple Autocomplete actions and prevent us needing to re-write a few lines of code to find and select an option. It's used here for updating permissions tests, and will be used in the next commit in inviting users tests when adding autocomplete to the organisation field. Apologies for multiple changes going on in this commit, it's essentially: - Adding a new Autocomplete Helper for reuse in other areas of the service that use the Accessible Autocomplete. - Refactoring the tests to use this new helper and to improve readability. Co-authored-by: Ynda Jas <yndajas@gmail.com>
- Loading branch information
Showing
3 changed files
with
120 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require "capybara/rails" | ||
|
||
class AutocompleteHelper | ||
include Capybara::DSL | ||
|
||
def select_autocomplete_option(string) | ||
autocomplete_input_element = find(".autocomplete__input") | ||
autocomplete_input_element.fill_in with: string | ||
autocomplete_option = find(".autocomplete__option") | ||
autocomplete_option.click | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters