-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Test reorg: Clients, Mirage, General selectors #26260
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
131e1b0
Add readme
hashishaw fdba7e6
Rename general selectors export
hashishaw 2e68dd4
reorg clients helper -- all clients tests pass
hashishaw dcf40c3
Update custom messages & dashboard selectors
hashishaw d8ce0f9
Rename client count selector export
hashishaw c92e61f
clean up .CodeMirror selectors to use helper instead
hashishaw 2cc755d
move secret-edit-toolbar helper
hashishaw 0e0e40c
remove helper used only once
hashishaw 8dfbe45
replace noop-all-api-requests with mirage
hashishaw 4607bd1
move policy generators into their respective folders
hashishaw 4148300
Move LDAP helpers
hashishaw 5568ce0
Move overrideResponse to stubs helper, rename clients helper
hashishaw 0242c4b
replace oidc-specific mirage & capabilities overrides
hashishaw fc06682
add secretTab and checkboxByAttr to general selectors
hashishaw fe7317d
general-selectors are TS
hashishaw cd3c028
fix merge conflict import
hashishaw b5392d4
Bump message wait time for oidc auth method test
hashishaw cf1b31b
Refactor auth methods mgmt test so we don't run into a timeout
hashishaw 3c4e0e4
Update comment
hashishaw 6a162ec
revert acceptance tests only
hashishaw e831a39
don't allow mutability of array returned by supportedAuthBackends
hashishaw 60fad68
unrevert -- remove noop-all-api-requests
hashishaw fea667e
remove hardcoded ?with param
hashishaw 9483c46
Merge branch 'ui/test-reorg-base' into ui/hackweek-test-reorg
hashishaw 007d766
Update ui/tests/_README.md
hashishaw 867946e
Update ui/tests/acceptance/auth-list-test.js
hashishaw 9c061fa
Update ui/tests/acceptance/auth-test.js
hashishaw cf6349a
Update ui/tests/acceptance/settings/auth/configure/section-test.js
hashishaw 4839315
Update ui/tests/unit/adapters/identity/entity-test.js
hashishaw a8a538b
Update ui/tests/unit/adapters/identity/entity-alias-test.js
hashishaw 1bc3047
replace CLIENT_COUNT as ts in tests
hashishaw b10ed46
update assertions
hashishaw 48aec94
move readme to docs
hashishaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,35 @@ | ||
# Test Helpers Organization | ||
|
||
Our test are constantly evolving, but here's a general overview of how we set up and organize tests. | ||
|
||
## Folder organization | ||
|
||
### /acceptance | ||
|
||
Acceptance tests should test the overall workflows and navigation within Vault. When possible, they should use the real API instead of mocked so that breaking changes from the backend can be caught. Reasons you may opt to use a mocked backend instead of the real one: | ||
|
||
- Using the real backend would cause instability in concurrently-running tests (eg. seal/unseal flow) | ||
- There isn't a way to set up a 3rd party dependency that the backend needs to run correctly (Database Secrets Engine, Sync Secrets) | ||
|
||
### /helpers | ||
|
||
Shared helpers such as selectors, common interactions, WebREPL commands, and API response stubs live in this folder. When selectors are only used for a single test, they should be defined on the same file where they are used for the test. Once the selectors are being used for multiple tests, they should be moved to this folder so they can be defined in a single place and shared to wherever they are needed. | ||
|
||
Often we will need a set of selectors for "workflow" tests, or acceptance tests that navigate through an area of the app. For these, the helpers should be organized as such: | ||
|
||
- `/helpers/<area>/<area>-selectors.ts` - exports selector consts (never default) for each page -- eg. for PKI we would have PKI_OVERVIEW, PKI_ROLE, etc. | ||
- `/helpers/<area>/<area>-interactions.js` - exports methods and consts which are otherwise helpful in the tests -- eg. example API responses, common interactions (eg. writeVersionedSecret for KV v2) | ||
|
||
Whenever possible we should try to use the general selectors exported from `/helpers/general-selectors.ts`. | ||
|
||
### integration | ||
|
||
Integration tests are most often used to test specific components out of context from the rest of the app. Be sure to mock anything that the component needs to work correctly -- for example, if the component has a certain behavior in enterprise than community edition, in your tests for each scenario it should not assume that the underlying Vault binary is in one state or the other, and mock the enterprise/community state in all the scenarios. The exports in `helpers/stubs.js` might be helpful for these tests, particularly when the component uses a model which fetches capabilities. | ||
|
||
### pages | ||
|
||
[DEPRECATED] This file should be removed in favor of selectors within the "helpers" folder. We are moving away from ember-page-object selectors toward simple strings | ||
|
||
### unit | ||
|
||
Unit tests are most often used to test utils, adapters, serializers, routes, and services functionality. |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice improvement adding the loop here!