Skip to content

misc: Assertion dropdown UI update #31598

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

Merged
merged 15 commits into from
May 5, 2025

Conversation

jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Apr 28, 2025

Additional details

This PR updates the assertions dropdown to match our 'dark mode' styles in the rest of the App.

Additionally this PR:

  • Adds tests for previously untested assertions logic
  • Improves accessibility of assertions dropdown (it's now tabbable and has aria labels)

Steps to test

  • yarn cypress:open
  • Select a project that has experimentalStudio: true set in the e2e config of the cypress.config.ts file.
  • Run a test that is visiting a URL
  • Click to 'add test commands' to Studio
  • Right click anywhere in the AUT to see the Assert dropdown.

How has the user experience changed?

Before

Screenshot 2025-04-29 at 2 14 59 PM

After

Screenshot 2025-04-29 at 2 14 40 PM

PR Tasks

@jennifer-shehane jennifer-shehane self-assigned this Apr 28, 2025
Copy link
Contributor

@Copilot 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 updates the assertion dropdown UI by refactoring the types, improving the menu mounting logic, and enhancing accessibility and styling in the studio components.

  • Refactored assertion types to use an interface for better clarity.
  • Improved event handling and throttling logic in the mounter.
  • Enhanced accessibility features and styling in the AssertionsMenu and related components.

Reviewed Changes

Copilot reviewed 7 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/app/src/runner/studio/types.ts Refactored assertion types and updated function type signatures.
packages/app/src/runner/studio/mounter.ts Introduced event throttling and helper functions for mounting.
packages/app/src/runner/studio/AssertionsMenu.cy.tsx Added tests to validate UI behavior and assertions functionality.
packages/app/src/runner/studio/AssertionsMenu.ce.vue Updated header, styling, and accessibility attributes.
packages/app/src/runner/studio/AssertionType.ce.vue Enhanced accessibility through ARIA attributes and keyboard events.
packages/app/src/runner/studio/AssertionOptions.ce.vue Improved option handling with key generation and truncation logic.
Files not reviewed (4)
  • packages/app/package.json: Language not supported
  • packages/app/src/runner/studio/assertions-style.scss: Language not supported
  • packages/frontend-shared/package.json: Language not supported
  • packages/reporter/src/lib/variables.scss: Language not supported
Comments suppressed due to low confidence (1)

packages/app/src/runner/studio/mounter.ts:44

  • The throttling logic subtracts the event time from the last timestamp, which can result in a negative value. Consider using 'e.timeStamp - lastTimeStamp' to accurately throttle repeated events.
function shouldThrottleEvent (e: MouseEvent): boolean { return lastTarget === e.target && lastTimeStamp - e.timeStamp < EVENT_THROTTLE_MS }

@jennifer-shehane jennifer-shehane changed the title [WIP] Assertion dropdown UI update [WIP] misc: Assertion dropdown UI update Apr 28, 2025
Copy link

cypress bot commented Apr 28, 2025

cypress    Run #62151

Run Properties:  status check passed Passed #62151  •  git commit 48794b7d2d: Merge branch 'develop' into assertion-dropdown-ui-update
Project cypress
Branch Review assertion-dropdown-ui-update
Run status status check passed Passed #62151
Run duration 18m 54s
Commit git commit 48794b7d2d: Merge branch 'develop' into assertion-dropdown-ui-update
Committer Jennifer Shehane
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 12
Tests that did not run due to a developer annotating a test with .skip  Pending 1232
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 32156
View all changes introduced in this branch ↗︎
UI Coverage  46.24%
  Untested elements 188  
  Tested elements 166  
Accessibility  92.73%
  Failed rules  3 critical   9 serious   2 moderate   2 minor
  Failed elements 888  

@@ -0,0 +1,58 @@
import { getOrCreateHelperDom } from './dom'
Copy link
Member Author

Choose a reason for hiding this comment

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

This function seemed to be completely untested, so I added a test for this. Many of these runner 'helper' files are untested actually so not a lot of conventions to pull from.

@@ -5,14 +5,7 @@ import AssertionOptions from './AssertionOptions.ce.vue'
import { getOrCreateHelperDom, getSelectorHighlightStyles } from '../dom'
Copy link
Member Author

Choose a reason for hiding this comment

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

This is just a straight refactor + adding types. None of the logic should be changed here.

@jennifer-shehane jennifer-shehane changed the title [WIP] misc: Assertion dropdown UI update misc: Assertion dropdown UI update Apr 29, 2025
@jennifer-shehane jennifer-shehane requested a review from mschile May 1, 2025 15:54
@jennifer-shehane jennifer-shehane merged commit 53f7aae into develop May 5, 2025
85 of 90 checks passed
@jennifer-shehane jennifer-shehane deleted the assertion-dropdown-ui-update branch May 5, 2025 13:03
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 6, 2025

Released in 14.3.3.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v14.3.3, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators May 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants