-
Notifications
You must be signed in to change notification settings - Fork 3.4k
e2e test user page: personal info and tokens #9975
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
Conversation
c3d48f9 to
d8fba7d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #9975 +/- ##
===========================================
- Coverage 81.35% 73.73% -7.63%
===========================================
Files 483 427 -56
Lines 49322 46243 -3079
Branches 4132 4132
===========================================
- Hits 40124 34095 -6029
- Misses 9198 12148 +2950
🚀 New features to boost your workflow:
|
cvat-ui/src/components/profile-page/security-content/api-tokens-card.tsx
Outdated
Show resolved
Hide resolved
cvat-ui/src/components/profile-page/security-content/api-tokens-card.tsx
Outdated
Show resolved
Hide resolved
cvat-ui/src/components/profile-page/security-content/api-tokens-card.tsx
Outdated
Show resolved
Hide resolved
| <Button type='text' icon={<MoreOutlined />} /> | ||
| </Dropdown> | ||
| ), | ||
| className: 'cvat-api-token-action', |
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.
| className: 'cvat-api-token-action', |
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.
why? I didn't find a class name I could use here to press on actions
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.
got it, it's an extra class, all passes
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.
This classname is still not used anywhere. I suggest to remove it.
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.
sorry, stashed it somewhere, now removed
tests/cypress/support/commands.js
Outdated
| req.continue((response) => { | ||
| delete response.headers['set-cookie']; | ||
| expect(response.statusCode).to.eq(201, response.statusMessage); | ||
| expect(response.statusCode).to.eq(201, response.body.username); // contains msg |
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.
| expect(response.statusCode).to.eq(201, response.body.username); // contains msg | |
| expect(response.statusCode).to.eq(201, response.body.username); |
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.
done
on that note, that error message was hard to find.
Is there a reason that the error message is returned in the body's username instead of something like this?
{
body: {
"statusCode": 409,
"message": "This username is already present"
}
}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.
I believe thats because of django validation logic. If its an error in serializer validator it will print error in body for each errored field(it does it because there can be several fields with error)
tests/cypress/e2e/actions_users/registration_involved/case_2_user_profile_page.js
Outdated
Show resolved
Hide resolved
tests/cypress/e2e/actions_users/registration_involved/case_2_user_profile_page.js
Outdated
Show resolved
Hide resolved
tests/cypress/e2e/actions_users/registration_involved/case_2_user_profile_page.js
Outdated
Show resolved
Hide resolved
tests/cypress/e2e/actions_users/registration_involved/case_2_user_profile_page.js
Outdated
Show resolved
Hide resolved
tests/cypress/e2e/actions_users/registration_involved/case_2_user_profile_page.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Kirill Lakhov <[email protected]>
Co-authored-by: Kirill Lakhov <[email protected]>
Co-authored-by: Kirill Lakhov <[email protected]>
Co-authored-by: Kirill Lakhov <[email protected]>
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.
Pull Request Overview
This PR adds comprehensive end-to-end tests for user profile page functionality, specifically focusing on password changes and API token management. The old test file for password changes has been replaced with a more thorough test suite.
- Adds new test file
case_2_user_profile_page.jscovering profile updates, password changes, and API token operations - Introduces utility functions and classes for test helpers (clipboard interaction, date manipulation, snake case conversion)
- Adds
cypress-repeatpackage as a dev dependency - Enhances UI components with CSS class names for better test targeting
- Updates the date format for API token expiration to DD/MM/YYYY for consistency
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/cypress/e2e/actions_users/registration_involved/case_2_user_profile_page.js | New comprehensive test file replacing the old password change test, covering profile updates, password changes, and API token CRUD operations |
| tests/cypress/e2e/actions_users/registration_involved/case_2_register_user_change_pass.js | Removed old test file that is replaced by the more comprehensive case_2_user_profile_page.js |
| tests/cypress/support/utils.js | Added utility functions for date manipulation (aYearFrom, aMonthFrom, parseDatetime, format) and object transformation (toSnakeCase) |
| tests/cypress/support/const.js | Added ClipboardCtx class for managing clipboard interactions in tests and CLIPBOARD_ALIAS constant |
| tests/cypress/support/commands.js | Added new Cypress commands for user management (headlessDeleteUserByUsername, headlessGetSelfId, headlessGetUserId) and updated headlessCreateUser to use snake_case conversion |
| tests/cypress/e2e/actions_objects2/case_copy_frame_filename.js | Refactored to use new ClipboardCtx class for cleaner clipboard testing |
| tests/cypress/e2e/features/case_113_new_organization_pipeline.js | Simplified capitalizeEmail function to use Cypress._.capitalize utility |
| tests/package.json | Added cypress-repeat as a devDependency |
| tests/yarn.lock | Updated with dependencies for cypress-repeat and its transitive dependencies |
| cvat-ui/src/components/profile-page/security-content/api-tokens-card.tsx | Added CSS class names to table columns and modal for test targeting |
| cvat-ui/src/components/profile-page/security-content/api-token-form.tsx | Added DD/MM/YYYY format to date picker for consistency with token table display |
| cvat-ui/src/components/profile-page/security-content/api-token-created-modal.tsx | Added CSS class name to confirmation button for test targeting |
| cvat-ui/src/components/profile-page/profile-page.tsx | Added CSS class names to welcome message and menu items for test targeting |
| cvat-ui/src/reducers/notifications-reducer.ts | Added CSS class name to password change success notification for test targeting |
| changelog.d/20251104_154354_oleg.valiulin_test_e2e_user_page_tokens.md | Added changelog entry documenting the date format change |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <Button type='text' icon={<MoreOutlined />} /> | ||
| </Dropdown> | ||
| ), | ||
| className: 'cvat-api-token-action', |
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.
This classname is still not used anywhere. I suggest to remove it.
klakhov
left a comment
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.
LGTM, just a couple minor comments
| }); | ||
|
|
||
| context('Security tab', () => { | ||
| before('open security tab', () => { |
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.
| before('open security tab', () => { | |
| before('Open security tab', () => { |
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.
applied
| openProfileTab('Security'); | ||
| }); | ||
|
|
||
| it('Change password unsuccessful, error notif appears. Cancel button works', () => { |
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.
| it('Change password unsuccessful, error notif appears. Cancel button works', () => { | |
| it('Change password unsuccessful, error notification appears. Cancel button works', () => { |
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.
applied
|
Motivation and context
Coverage for #9789 and #9829
Checklist
developbranchLicense
Feel free to contact the maintainers if that's a concern.