Skip to content
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 for button on frame player that copies the current frame's filename #9081

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

archibald1418
Copy link
Contributor

@archibald1418 archibald1418 commented Feb 10, 2025

This checks that the frame filename displayed in the annotation view UI is copied to clipboard correctly
Regression test for #8989

How has this been tested?

Use the existing Main task to trigger UI events that change clipboard contents.

Prepartion

before the test suite
  • Create main task
  • Open main task job
before each test case
  • Add a spy on the window's clipboard (has to be new every case).
    Note: Unlike mocks, spies call the real function to gain information on how this function was called

Cases

Case 1: Check that frame filename can be copied to clipboard

  • Scrape active filename
  • Press on button, confirm that both filenames are equal

Case 2: Check clipboard after switching frames

  • Switch to next frame
  • Repeat actions from Case 1

Case 3: Check clipboard after deleting frame and after Undo

  • Repeat actions from Case 1, store the current filename
  • Delete a frame and save the job
  • Repeat actions from Case 1 (validates that the name has changed)
  • Click 'Undo' button to cancel deletion. Save the job
  • Validate that current filename is the same as old filename stored previously

Case 4: Check clipboard after deleting and restoring frame

Same as Case 3 but with frame visibility enabled in user settings. The assertion is that the filename and the clipboard shouldn't change after deletion and after restoration

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.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.92%. Comparing base (fb3bde4) to head (8a2d873).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9081   +/-   ##
========================================
  Coverage    73.91%   73.92%           
========================================
  Files          428      428           
  Lines        44530    44530           
  Branches      3881     3881           
========================================
+ Hits         32915    32917    +2     
+ Misses       11615    11613    -2     
Components Coverage Δ
cvat-ui 77.45% <ø> (+<0.01%) ⬆️
cvat-server 71.00% <ø> (ø)

return cy.get('.cvat-player-filename-wrapper').invoke('text');
}

function clipboard() {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to name this copyToClipboard since it not only retrieves the clipboard contents but also triggers the action by pressing the button.

});
});

it('Check clipboard after deleting frame, after Undo', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not entirely sure if we need tests that mix copying and deleting, as these are separate functionalities. Deleting a frame shouldn't affect copying. If treated separately, we are essentially repeating the same operations as in the previous two tests: copy → change frame → copy again. Even if there were a potential intersection, it would be considered a regression and should be covered by a dedicated regression test. Since we haven't encountered such a regression, I suggest we remove these test cases for now.

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.

3 participants