Skip to content

Increase viewport width #1870

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

karelhala
Copy link
Contributor

@karelhala karelhala commented Jul 11, 2025

Description

When we are running tests cypress defaults to smaller screen, that breaks our flow since some elements are hidden or changed. This PR fixes such issue by setting direct width to 1300px. There's also flaky test in users table where it tries to access ouiaId which is not present on the screen that's because we are using users table at one test and in other we are using users and groups. This PR changes from ouia ID to aria-label so we are testing directly what user can see and interact with.

Summary by Sourcery

Improve Cypress test stability by expanding the viewport size and updating selectors for consistency with user-facing attributes.

Enhancements:

  • Standardize aria-label on UsersTable and UserGroupsTable components to "users table"

Tests:

  • Set Cypress viewportWidth to 1300px in configuration
  • Update create-workspace spec to use cy.login(true)
  • Replace OUIA-based table selectors with aria-label="users table" in user-access tests

@karelhala karelhala requested a review from a team as a code owner July 11, 2025 11:51
Copy link
Contributor

sourcery-ai bot commented Jul 11, 2025

Reviewer's Guide

Enhance Cypress test stability by setting the viewport width to 1300px, adding an authentication flag to the workspace test login, and switching users table selectors from OUIA IDs to accessible aria-labels in both tests and component code.

Class diagram for updated DataViewTable usage in UsersTable and UserGroupsTable

classDiagram
  class UsersTable {
    - aria-label: string (changed from "Users Table" to "users table")
    - ouiaId: string
    - columns
    - rows
  }
  class UserGroupsTable {
    - aria-label: string (changed from "Users Table" to "users table")
    - ouiaId: string
    - columns
    - rows
  }
  UsersTable --> DataViewTable
  UserGroupsTable --> DataViewTable
Loading

File-Level Changes

Change Details Files
Set default Cypress viewport width to 1300px
  • Add viewportWidth: 1300 to Cypress configuration
cypress.config.ts
Pass authentication flag to cy.login() in workspace test
  • Update cy.login() call to cy.login(true)
cypress/e2e/create-workspace.cy.ts
Replace OUIA table selector with aria-label in user access test
  • Switch from data-ouia-component-id to aria-label in waitForUsersTable
cypress/e2e/user-access.cy.ts
Normalize aria-label on DataViewTable components to 'users table'
  • Update aria-label in UserGroupsTable to 'users table'
  • Update aria-label in UsersTable to 'users table'
src/smart-components/access-management/users-and-user-groups/user-groups/UserGroupsTable.tsx
src/smart-components/access-management/users-and-user-groups/users/UsersTable.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @karelhala - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@karelhala
Copy link
Contributor Author

/retest

Copy link
Contributor

@CodyWMitchell CodyWMitchell left a comment

Choose a reason for hiding this comment

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

Looks like it's still using that non-admin user and unable to find the users table

14:27:23 
14:27:23   1) Make user an org admin
14:27:23        "before each" hook for "Grants org admin status to a user":
14:27:23      AssertionError: Timed out retrying after 100000ms: Expected to find element: `table[aria-label="users table"]`, but never found it.
14:27:23 
14:27:23 Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `Make user an org admin`
14:27:23       at waitForUsersTable (webpack://insights-****/./cypress/e2e/user-access.cy.ts:5:65)
14:27:23       at navigateToUsersTable (webpack://insights-****/./cypress/e2e/user-access.cy.ts:10:0)
14:27:23       at Context.eval (webpack://insights-****/./cypress/e2e/user-access.cy.ts:58:0)
14:27:23 
14:27:23   2) Activate/deactivate users from users table
14:27:23        Single user action via toggle
14:27:23          "before each" hook for "activates an inactive user":
14:27:23      AssertionError: Timed out retrying after 100000ms: Expected to find element: `table[aria-label="users table"]`, but never found it.```

@karelhala karelhala force-pushed the increase-viewport-width branch from 7986d05 to 3a9f776 Compare July 11, 2025 14:37
@karelhala
Copy link
Contributor Author

/retest

@karelhala karelhala force-pushed the increase-viewport-width branch from 3a9f776 to 3a39c1b Compare July 18, 2025 13:55
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.

2 participants