Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@archibald1418
Copy link
Contributor

@archibald1418 archibald1418 commented Nov 5, 2025

Motivation and context

Coverage for #9789 and #9829

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@archibald1418 archibald1418 requested a review from klakhov November 6, 2025 20:23
@codecov-commenter
Copy link

codecov-commenter commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.73%. Comparing base (98c0a2a) to head (12d133b).
⚠️ Report is 1 commits behind head on develop.

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     
Components Coverage Δ
cvat-ui 77.50% <ø> (+0.58%) ⬆️
cvat-server 70.54% <ø> (-14.16%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

<Button type='text' icon={<MoreOutlined />} />
</Dropdown>
),
className: 'cvat-api-token-action',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
className: 'cvat-api-token-action',

Copy link
Contributor Author

@archibald1418 archibald1418 Nov 7, 2025

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

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
expect(response.statusCode).to.eq(201, response.body.username); // contains msg
expect(response.statusCode).to.eq(201, response.body.username);

Copy link
Contributor Author

@archibald1418 archibald1418 Nov 7, 2025

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"
  }
}

Copy link
Contributor

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)

@archibald1418 archibald1418 requested a review from Copilot November 7, 2025 14:03
Copy link

Copilot AI left a 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.js covering 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-repeat package 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.

@archibald1418 archibald1418 requested a review from klakhov November 7, 2025 15:45
<Button type='text' icon={<MoreOutlined />} />
</Dropdown>
),
className: 'cvat-api-token-action',
Copy link
Contributor

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.

Copy link
Contributor

@klakhov klakhov left a 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', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
before('open security tab', () => {
before('Open security tab', () => {

Copy link
Contributor Author

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', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
it('Change password unsuccessful, error notif appears. Cancel button works', () => {
it('Change password unsuccessful, error notification appears. Cancel button works', () => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applied

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4 Security Hotspots

See analysis details on SonarQube Cloud

@archibald1418 archibald1418 merged commit 5d62475 into develop Nov 12, 2025
36 of 37 checks passed
@archibald1418 archibald1418 deleted the ov/test-e2e-user-page-tokens branch November 12, 2025 13:23
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.

4 participants