-
Notifications
You must be signed in to change notification settings - Fork 11
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
e2e test for organization users page #1467
e2e test for organization users page #1467
Conversation
WalkthroughThis pull request introduces several modifications primarily focused on enhancing the testability of various components within the application. Key changes include the addition of Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (12)
🚧 Files skipped from review as they are similar to previous changes (12)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Deploying irenestaging with Cloudflare Pages
|
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.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (14)
app/components/organization-member/list/add-to-team/add-user-action/index.hbs (1)
5-7
: Consider removing the redundantdata-test-addToTeam-btn
attribute.The newly added
data-test-cy='add-to-team-btn'
attribute serves the same purpose as the existingdata-test-addToTeam-btn
attribute. Having both might lead to confusion during testing and maintenance.Consider removing the redundant attribute:
<AkIconButton - data-test-addToTeam-btn data-test-cy='add-to-team-btn' class='mr-1'
cypress/support/application.routes.ts (1)
8-9
: LGTM! Consider alphabetizing the route definitions.The additions of
organizationUsers
andorganizationTeams
routes are appropriate and align well with the PR objective of implementing e2e tests for the organization users page. These new routes follow the existing pattern and are consistent with other organization-related routes.For improved readability and easier maintenance, consider alphabetizing the route definitions within the
APPLICATION_ROUTES
object. This would make it easier to locate specific routes as the list grows. Here's a suggested order:export const APPLICATION_ROUTES = { file: '/dashboard/file', login: '/login', organizationTeams: '/dashboard/organization/teams', organizationUsers: '/dashboard/organization/users', projects: '/projects', register: '/register', sbom: '/dashboard/sbom/apps', serviceAccount: '/dashboard/organization/settings/service-account', } as const;app/components/organization-member/list/member-details/remove-action/index.hbs (1)
Line range hint
11-19
: Consider adding a data-test-cy attribute to ConfirmBoxWhile the changes look good, to further enhance testability for e2e tests, consider adding a
data-test-cy
attribute to theConfirmBox
component as well. This would allow easier selection and interaction with the confirmation dialog in your e2e tests.Here's a suggested addition:
<ConfirmBox data-test-cy="remove-user-confirm-box" @isActive={{this.showRemoveMemberPrompt}} @confirmText={{this.confirmText}} @confirmAction={{perform this.removeMember}} @title={{t 'removeFromTeam'}} @cancelAction={{this.closeRemoveMemberPrompt}} @blurOverlay={{true}} @description={{t 'confirmBox.removeUser'}} />This change would be consistent with the e2e testing enhancements made to the
AkIconButton
component.app/components/organization-invitation-list/invite-delete/index.hbs (1)
4-4
: LGTM: Addition of Cypress test selectorThe addition of
data-test-cy='invite-delete-btn'
is appropriate for e2e testing purposes. It aligns well with the PR objective of adding e2e tests for the organization users page. This attribute will make it easier to select and interact with this button in Cypress tests.A couple of observations:
- The new attribute coexists with
data-test-invitation-delete-btn
. While not an issue, it's worth noting that we now have two test-related attributes on this button.- The naming convention used (
invite-delete-btn
) is consistent with Cypress best practices for selecting elements.Consider standardizing on either
data-test-cy
ordata-test-
prefixes for test selectors across the application to maintain consistency. Ifdata-test-cy
is the new standard, you might want to updatedata-test-invitation-delete-btn
in a future PR for consistency.app/components/organization-member/list/member-role/index.hbs (1)
Line range hint
1-20
: Overall, good addition for testability. Consider adding test attributes consistently.The addition of the
data-test-cy
attribute enhances the testability of the component without affecting its functionality. This is a positive change that aligns with good testing practices.For consistency, consider adding similar
data-test-cy
attributes to other interactive elements in this template, such as the<AkTypography>
component in theelse
block. This would provide comprehensive test coverage for all possible states of this component.app/components/organization-member/list/member-drawer/index.hbs (1)
20-20
: Consider aligning test attribute naming for consistency.While the addition of the test attribute is beneficial, I noticed a slight inconsistency in the naming convention. The new attribute uses
data-test-cy
, while other elements in this component usedata-test-*
(e.g.,data-test-member-drawer
,data-test-member-drawer-title
).For better consistency, consider using either:
data-test-member-drawer-close-btn
to match the existing convention in this file, or- Update all test attributes to use the
data-test-cy-*
format if that's the preferred convention for e2e tests in your project.Consistency in naming will make it easier for developers and QA engineers to work with these attributes in the future.
app/components/organization-invitation-list/index.hbs (2)
30-34
: LGTM! Consider consolidating test attributes.The addition of the
data-test-cy='invite-list-row'
attribute is a good practice for e2e testing, particularly with Cypress. This change aligns well with the PR objective of adding e2e tests for the organization users page.Consider consolidating the test attributes to avoid redundancy:
<b.row data-test-cy='invite-list-row' - data-test-invitation-list-row as |r| >
If you need to keep both attributes for compatibility reasons, please disregard this suggestion.
Line range hint
1-69
: Overall, well-structured component. Consider adding data-test-cy attributes consistently.The organization-invitation-list component is well-structured and follows good practices. It handles different states appropriately and uses pagination effectively. The use of yield and block params suggests a flexible and reusable design.
For consistency with the newly added
data-test-cy
attribute, consider adding similar attributes to other key elements in the template, such as:<AkTable data-test-cy="invitation-list" data-test-invitation-list> <t.head data-test-cy="invitation-list-thead" data-test-invitation-list-thead @columns={{this.columns}} /> ... <AkPagination data-test-cy="invitation-list-pagination" ... />This would further enhance the testability of the component and maintain consistency across the template.
cypress/support/api.routes.ts (1)
96-99
: LGTM with a minor suggestion for consistency.The addition of the
teamsList
route is appropriate and aligns with the PR objective of adding an e2e test for the organization users page. The route structure is consistent with other routes in the file.For better consistency, consider changing the
alias
to match the key name:teamsList: { route: '/api/organizations/*/teams*', - alias: 'teamList', + alias: 'teamsList', },This change would make the alias consistent with the key name, following the pattern used in other routes like
organizationList
andprojectList
.app/components/organization-member/list/add-to-team/index.hbs (1)
9-9
: LGTM! Consider standardizing test attribute naming.The addition of
data-test-cy='add-to-team-back-btn'
enhances the component's testability, particularly for Cypress e2e tests. This is a positive change that aligns with the PR's objective.For consistency, consider standardizing the naming convention for test attributes. You could either:
- Update the existing
data-test-addToTeam-titleBtn
to follow thedata-test-cy
pattern, or- Use a consistent prefix for all test attributes (e.g.,
data-test-
ordata-test-cy-
).This would improve maintainability and reduce potential confusion for developers working on tests.
app/components/organization-member/list/index.hbs (2)
77-82
: Improved testability, but consider cleanupThe addition of the
data-test-cy='org-user-table'
attribute enhances the component's testability, particularly for end-to-end testing with Cypress. This is a good improvement.However, there are two points to consider:
- The
data-test-org-user-table
attribute seems redundant now. Consider removing it to maintain a single, consistent testing attribute.- The indentation of these lines has changed. Ensure consistent indentation throughout the file.
Consider applying this change:
- <AkTable - data-test-cy='org-user-table' - data-test-org-user-table - @hoverable={{true}} - as |t| - > + <AkTable + data-test-cy='org-user-table' + @hoverable={{true}} + as |t| + >
87-87
: Improved testability, but consider attribute consolidationThe addition of the
data-test-cy='org-user-row'
attribute enhances the component's testability, which is a positive change.However, the
data-test-org-user-row
attribute seems redundant now. Consider removing it to maintain a single, consistent testing attribute.Consider applying this change:
- data-test-org-user-row - data-test-cy='org-user-row' + data-test-cy='org-user-row'cypress/tests/organization-users.spec.ts (2)
97-98
: Remove redundant success message verificationThe success message
cyTranslate('userRoleUpdated')
is already verified within the conditional blocks above. This additional check is redundant and can be removed to streamline the test.Apply this diff to remove the redundant assertion:
- // Verify the success message - cy.document().findByText(cyTranslate('userRoleUpdated')).should('exist');
245-245
: UsecyTranslate
function for consistent localizationTo maintain consistency and support localization, use
cyTranslate('remove')
instead of hardcoding the string'Remove'
.Apply this diff to use the translation function:
- cy.findByRole('button', { name: 'Remove' }).click(); + cy.findByRole('button', { name: cyTranslate('remove') }).click();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (12)
- app/components/organization-invitation-list/index.hbs (1 hunks)
- app/components/organization-invitation-list/invite-delete/index.hbs (1 hunks)
- app/components/organization-member/list/add-to-team/add-user-action/index.hbs (1 hunks)
- app/components/organization-member/list/add-to-team/index.hbs (2 hunks)
- app/components/organization-member/list/index.hbs (2 hunks)
- app/components/organization-member/list/member-details/index.hbs (1 hunks)
- app/components/organization-member/list/member-details/remove-action/index.hbs (1 hunks)
- app/components/organization-member/list/member-drawer/index.hbs (1 hunks)
- app/components/organization-member/list/member-role/index.hbs (1 hunks)
- cypress/support/api.routes.ts (1 hunks)
- cypress/support/application.routes.ts (1 hunks)
- cypress/tests/organization-users.spec.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
- app/components/organization-member/list/member-details/index.hbs
🧰 Additional context used
🔇 Additional comments (9)
app/components/organization-member/list/add-to-team/add-user-action/index.hbs (1)
2-2
: LGTM! Improved code consistency and testability.The changes improve code consistency by using single quotes for attribute values and enhance testability by adding the
data-test-cy
attribute. These modifications align well with the PR objective of implementing e2e tests for the organization users page.Also applies to: 6-7
cypress/support/application.routes.ts (1)
8-9
: Verify the usage of new routes in e2e tests.To ensure that the newly added routes are being utilized effectively in the e2e tests, it would be beneficial to verify their usage across the codebase.
Let's run a script to check for the usage of these new routes:
This script will help us confirm that the new routes are being used appropriately in the e2e tests and identify any hardcoded URLs that might need to be replaced with these new route constants.
✅ Verification successful
New routes are correctly utilized in e2e tests, and no hardcoded URLs detected.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of new routes in e2e tests and other relevant files. echo "Searching for usage of organizationUsers route:" rg --type typescript --type javascript "organizationUsers" cypress echo "\nSearching for usage of organizationTeams route:" rg --type typescript --type javascript "organizationTeams" cypress echo "\nSearching for any hardcoded URLs that might need to be replaced with these new routes:" rg --type typescript --type javascript "/dashboard/organization/users|/dashboard/organization/teams" cypressLength of output: 750
Script:
#!/bin/bash # Description: Verify the usage of new routes in e2e tests and other relevant files. echo "Searching for usage of organizationUsers route in .ts and .js files:" rg "organizationUsers" --glob "*.ts" --glob "*.js" cypress echo "\nSearching for usage of organizationTeams route in .ts and .js files:" rg "organizationTeams" --glob "*.ts" --glob "*.js" cypress echo "\nSearching for any hardcoded URLs that might need to be replaced with these new routes in .ts and .js files:" rg "/dashboard/organization/users|/dashboard/organization/teams" --glob "*.ts" --glob "*.js" cypressLength of output: 1208
app/components/organization-member/list/member-details/remove-action/index.hbs (1)
3-5
: LGTM! Enhancement for e2e testing.The changes to the
AkIconButton
component look good and align with the PR objective of implementing e2e tests for the organization users page. The addition of thedata-test-cy='remove-user'
attribute will facilitate automated testing, making it easier to select this element in Cypress tests.A minor style change was made to the
class
attribute, switching from double quotes to single quotes. This change is consistent with the coding style used in the rest of the file.app/components/organization-member/list/member-role/index.hbs (1)
4-4
: LGTM! Enhances component testability.The addition of the
data-test-cy='user-role-select'
attribute to the<AkSelect>
component is a good practice. It provides a specific selector for end-to-end tests, making it easier to target this element in automated tests. This change aligns well with the PR objective of adding e2e tests for the organization users page.app/components/organization-member/list/member-drawer/index.hbs (1)
20-20
: LGTM! The added test attribute enhances testability.The addition of
data-test-cy='member-drawer-close-btn'
to theAkIconButton
component is a good practice for improving the testability of the UI. This attribute will make it easier to select and interact with this specific button in end-to-end tests, which aligns well with the PR objective of adding e2e tests for the organization users page.app/components/organization-member/list/add-to-team/index.hbs (2)
24-24
: LGTM! Improved code consistency.The change from double quotes to single quotes for the class attribute improves consistency with the surrounding code. This enhances the overall readability and maintainability of the template.
Line range hint
1-138
: Summary: Changes align well with PR objectives.The modifications in this file, namely the addition of a Cypress-specific test attribute and the standardization of quote usage, contribute positively to the PR's goal of implementing e2e tests for the organization users page. These changes enhance testability without altering the component's functionality, which is a best practice in preparing code for automated testing.
app/components/organization-member/list/index.hbs (2)
5-5
: LGTM: Improved internationalizationThe change from a static string to a translation helper (
{{t 'searchUser'}}
) for the placeholder text is a good improvement. This enhances the component's internationalization capabilities, making it easier to localize the user interface.
Line range hint
1-138
: Summary: Improved testability and internationalizationOverall, the changes in this file enhance the component's testability and internationalization capabilities:
- The search input placeholder now uses a translation helper, improving localization.
- Data-test-cy attributes have been added to key elements, facilitating end-to-end testing.
These modifications align well with the PR objective of adding e2e tests for the organization users page. They improve the component's maintainability and testability without altering its core functionality.
Consider consolidating the testing attributes to use only
data-test-cy
for consistency across the codebase.
93d1064
to
f1cf699
Compare
f1cf699
to
121da2f
Compare
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
cypress/support/api.routes.ts (3)
100-103
: LGTM: New route for retrieving organization members list.The
membersList
route is well-defined for fetching organization members. The use of wildcards allows for dynamic organization IDs and potential query parameters.Consider adding a comment to clarify the purpose of the trailing asterisk in the route, e.g.:
membersList: { route: '/api/organizations/*/members*', // Trailing * allows for query parameters alias: 'membersList', },
104-107
: LGTM: New route for individual member operations.The
member
route is well-defined for operations on specific organization members. The use of wildcards allows for dynamic organization and member IDs.Consider using a more specific alias to differentiate it from the
membersList
route, e.g.:member: { route: '/api/organizations/*/members/*', alias: 'singleMember', },This makes it clearer that this route deals with a single member rather than a list.
108-111
: LGTM: New route for retrieving organization teams list.The
teamsList
route is well-defined for fetching organization teams. The use of wildcards allows for dynamic organization IDs and potential query parameters.There's a minor inconsistency between the key name 'teamsList' and the alias 'teamList'. Consider making them consistent:
teamsList: { route: '/api/organizations/*/teams*', alias: 'teamsList', },This ensures consistency with the
membersList
route naming convention.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (12)
- app/components/organization-invitation-list/index.hbs (1 hunks)
- app/components/organization-invitation-list/invite-delete/index.hbs (1 hunks)
- app/components/organization-member/list/add-to-team/add-user-action/index.hbs (1 hunks)
- app/components/organization-member/list/add-to-team/index.hbs (3 hunks)
- app/components/organization-member/list/index.hbs (2 hunks)
- app/components/organization-member/list/member-details/index.hbs (1 hunks)
- app/components/organization-member/list/member-details/remove-action/index.hbs (1 hunks)
- app/components/organization-member/list/member-drawer/index.hbs (1 hunks)
- app/components/organization-member/list/member-role/index.hbs (1 hunks)
- cypress/support/api.routes.ts (1 hunks)
- cypress/support/application.routes.ts (1 hunks)
- cypress/tests/organization-users.spec.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
- app/components/organization-member/list/add-to-team/add-user-action/index.hbs
🚧 Files skipped from review as they are similar to previous changes (10)
- app/components/organization-invitation-list/index.hbs
- app/components/organization-invitation-list/invite-delete/index.hbs
- app/components/organization-member/list/add-to-team/index.hbs
- app/components/organization-member/list/index.hbs
- app/components/organization-member/list/member-details/index.hbs
- app/components/organization-member/list/member-details/remove-action/index.hbs
- app/components/organization-member/list/member-drawer/index.hbs
- app/components/organization-member/list/member-role/index.hbs
- cypress/support/application.routes.ts
- cypress/tests/organization-users.spec.ts
🧰 Additional context used
🔇 Additional comments (3)
cypress/support/api.routes.ts (3)
96-99
: LGTM: New route for editing user information.The
editUserInfo
route is well-defined with a clear purpose. The use of wildcards in the route allows for dynamic handling of different organization and user IDs, which is appropriate for this type of operation.
112-115
: LGTM: New route for team member operations.The
teamMembers
route is well-defined for operations on specific members within a team in an organization. The use of multiple wildcards allows for dynamic organization, team, and member IDs, providing flexibility for various scenarios.
96-115
: Summary: New routes added for organization user and team management.The changes in this file align well with the PR objective of adding e2e tests for the organization users page. Five new routes have been added to support various operations:
- Editing user information
- Retrieving a list of organization members
- Operations on individual members
- Retrieving a list of teams
- Operations on team members
These additions follow the existing pattern and naming conventions in the file, with minor suggestions for improvement noted in previous comments. Overall, these changes provide the necessary API route definitions to support comprehensive e2e testing of the organization users page.
Irene Run #505
Run Properties:
|
Project |
Irene
|
Run status |
Failed #505
|
Run duration | 06m 15s |
Commit |
1fa2c50dce: e2e test for organization users
|
Committer | Avi Shah |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
1
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
26
|
Tests for review
cypress/tests/dynamic-scan.spec.ts • 1 failed test
Test | Artifacts | |
---|---|---|
Dynamic Scan > it tests dynamic scan for an apk file: 58062 |
Test Replay
Screenshots
|
121da2f
to
bd24477
Compare
bd24477
to
88e5090
Compare
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
cypress/support/api.routes.ts (2)
108-111
: LGTM with suggestion: New route for teams excluding a user added.The
teamExcludesUser
route has been correctly added, following the existing pattern. This route appears to fetch teams that exclude a specific user, which is a useful addition.However, consider using a more generic route structure and moving the query parameter to the actual API call. This would make the route more flexible:
teamExcludesUser: { route: '/api/organizations/*/teams', alias: 'teamExcludesUser', },Then in the API call, you can add the query parameter:
cy.intercept('GET', `${API_ROUTES.teamExcludesUser.route}?exclude_user=*`).as(API_ROUTES.teamExcludesUser.alias)This approach would allow for easier addition of other query parameters in the future if needed.
112-115
: LGTM with suggestion: New route for teams including a user added.The
teamIncludesUser
route has been correctly added, mirroring the structure ofteamExcludesUser
. This route appears to fetch teams that include a specific user, which is a logical counterpart to the exclude route.As with the
teamExcludesUser
route, consider using a more generic route structure:teamIncludesUser: { route: '/api/organizations/*/teams', alias: 'teamIncludesUser', },Then add the query parameter in the API call:
cy.intercept('GET', `${API_ROUTES.teamIncludesUser.route}?include_user=*`).as(API_ROUTES.teamIncludesUser.alias)This approach maintains consistency with the suggested change for
teamExcludesUser
and allows for more flexibility in future API calls.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (12)
- app/components/organization-invitation-list/index.hbs (1 hunks)
- app/components/organization-invitation-list/invite-delete/index.hbs (1 hunks)
- app/components/organization-member/list/add-to-team/add-user-action/index.hbs (1 hunks)
- app/components/organization-member/list/add-to-team/index.hbs (3 hunks)
- app/components/organization-member/list/index.hbs (2 hunks)
- app/components/organization-member/list/member-details/index.hbs (1 hunks)
- app/components/organization-member/list/member-details/remove-action/index.hbs (1 hunks)
- app/components/organization-member/list/member-drawer/index.hbs (1 hunks)
- app/components/organization-member/list/member-role/index.hbs (1 hunks)
- cypress/support/api.routes.ts (1 hunks)
- cypress/support/application.routes.ts (1 hunks)
- cypress/tests/organization-users.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
- app/components/organization-invitation-list/index.hbs
- app/components/organization-invitation-list/invite-delete/index.hbs
- app/components/organization-member/list/add-to-team/add-user-action/index.hbs
- app/components/organization-member/list/add-to-team/index.hbs
- app/components/organization-member/list/index.hbs
- app/components/organization-member/list/member-details/index.hbs
- app/components/organization-member/list/member-details/remove-action/index.hbs
- app/components/organization-member/list/member-drawer/index.hbs
- app/components/organization-member/list/member-role/index.hbs
- cypress/support/application.routes.ts
- cypress/tests/organization-users.spec.ts
🧰 Additional context used
🔇 Additional comments (6)
cypress/support/api.routes.ts (6)
96-99
: LGTM: New route for editing user info added.The
editUserInfo
route has been correctly added, following the existing pattern in the file. The route and alias are appropriately named, making their purpose clear.
100-103
: LGTM: New route for fetching members list added.The
membersList
route has been correctly added, consistent with the existing pattern. The route and alias are descriptive and appropriate for fetching a list of organization members.
104-107
: LGTM: New route for specific member operations added.The
member
route has been correctly added, following the existing pattern. This route appears to be for operations on a specific member within an organization, which is a logical addition alongside themembersList
route.
116-119
: LGTM: New route for team members operations added.The
teamMembers
route has been correctly added, following the existing pattern in the file. This route appears to be for operations on members of a specific team within an organization, which is a logical addition to the API routes.
120-123
: LGTM: New route for user invitations added.The
inviteUser
route has been correctly added, following the existing pattern in the file. This route is clearly for creating invitations for users to join an organization, which is a valuable addition to the API routes.
96-123
: Overall assessment: Excellent additions to support e2e testing.The new routes added to
API_ROUTES
are well-structured and provide the necessary endpoints for e2e testing of the organization users page. They follow the existing patterns in the file and enhance the API routes for user and team management functionalities.Consider the suggestions for
teamExcludesUser
andteamIncludesUser
routes to improve flexibility. Otherwise, these additions are ready for implementation and testing.
88e5090
to
bf10be3
Compare
bf10be3
to
9ea90b8
Compare
9ea90b8
to
8069851
Compare
8069851
to
1fa2c50
Compare
Quality Gate passedIssues Measures |
No description provided.