Skip to content

Comments

internal: (studio) support creating new test in root suite#32024

Merged
mschile merged 12 commits intorelease/15.0.0from
mschile/studio/new_test_root_suite_2
Jul 17, 2025
Merged

internal: (studio) support creating new test in root suite#32024
mschile merged 12 commits intorelease/15.0.0from
mschile/studio/new_test_root_suite_2

Conversation

@mschile
Copy link
Contributor

@mschile mschile commented Jul 15, 2025

Additional details

  • When creating a new test, instead of reruning and entering Studio mode, we now set Studio to active, which causes the panel to be displayed but all of the tests are still displayed.
  • Instead of driving off the suiteId, we now look for the newTestLineNumber in the url. When found, we find the test that also starts on that line and call setOnlyTestId with the appropriate id.

Steps to test

  • Checkout the mschile/studio/new_test_root_suite services branch
  • Open up the Studio side panel and add a new test
  • Verify the new test is correctly added to the spec and we correctly re-enter Studio mode when the test is created.

How has the user experience changed?

PR Tasks

@mschile mschile requested a review from Copilot July 15, 2025 14:19
Copy link
Contributor

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 support for creating a new test in the root suite by tracking a newTestLineNumber instead of driving off suiteId, updates the runner normalization logic, and adjusts the Studio store and event flows to enter Studio mode without rerunning for new tests.

  • Runner now sets onlyTestId based on newTestLineNumber and removes createEmptyOnlyTest.
  • Studio store tracks newTestLineNumber, updates URL parameters, and introduces setActive(isActive) to control panel visibility.
  • Event manager and aut-iframe entry points are updated to avoid unnecessary reruns when starting Studio for a new test.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/driver/src/cypress/runner.ts Handle newTestLineNumber in normalizeAll/normalize and drop createEmptyOnlyTest.
packages/app/src/store/studio-store.ts Add newTestLineNumber state, update URL param logic, and rename setInactive to setActive.
packages/app/src/runner/event-manager.ts Replace legacy studioInit (rerun) with setActive(true) for new-test flows.
packages/app/src/runner/aut-iframe.ts Always call studioStore.start in startStudio, removing the loading check.
Comments suppressed due to low confidence (3)

packages/app/src/store/studio-store.ts:168

  • setSuiteId does not clear newTestLineNumber or include it in the URL parameters, which may leave stale line-number state when switching suites; consider resetting newTestLineNumber and updating the URL filter here.
      this._updateUrlParams(['testId', 'suiteId'])

packages/driver/src/cypress/runner.ts:789

  • This new branch handling newTestLineNumber should be covered by unit tests to verify that onlyTestId is correctly set when the line numbers match.
  if (getNewTestLineNumber() && runnable.invocationDetails?.line === getNewTestLineNumber()) {

packages/app/src/store/studio-store.ts:209

  • [nitpick] The method name setActive may be ambiguous for a boolean setter; consider renaming to setIsActive for clearer intent.
    setActive (isActive: boolean) {

@mschile mschile requested review from astone123 and mabela416 July 15, 2025 14:22
@cypress
Copy link

cypress bot commented Jul 15, 2025

cypress    Run #63865

Run Properties:  status check passed Passed #63865  •  git commit b6eb1d4a07: fixing tests
Project cypress
Branch Review mschile/studio/new_test_root_suite_2
Run status status check passed Passed #63865
Run duration 11m 25s
Commit git commit b6eb1d4a07: fixing tests
Committer Matthew Schile
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 692
View all changes introduced in this branch ↗︎
UI Coverage  37.91%
  Untested elements 131  
  Tested elements 80  
Accessibility  97.42%
  Failed rules  3 critical   7 serious   1 moderate   1 minor
  Failed elements 62  

cursor[bot]

This comment was marked as outdated.

getCypress().runner.setNewTestLineNumber(this.newTestLineNumber)
} else {
if (this.suiteId) {
getCypress().runner.setOnlySuiteId(this.suiteId)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be removed. It doesn't look like we're doing anything anymore when we set setOnlySuiteId

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed 0762b70

Copy link
Contributor

@mabela416 mabela416 left a comment

Choose a reason for hiding this comment

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

The page is not reloading for the test I just created and then if I exit out of the specs list and go back in, only the test i just created is loaded instead of all the tests in the spec

Screen.Recording.2025-07-16.at.10.49.36.AM.mov

@mschile
Copy link
Contributor Author

mschile commented Jul 16, 2025

The page is not reloading for the test I just created and then if I exit out of the specs list and go back in, only the test i just created is loaded instead of all the tests in the spec

Screen.Recording.2025-07-16.at.10.49.36.AM.mov

@mabela416, are you sure you're running all the correct code? I just tried and it worked for me.

Screen.Recording.2025-07-16.at.8.58.35.AM.mov

@mabela416
Copy link
Contributor

Yeah I double checked that I was on both branches for cypress-services and cypress and I rebuilt everything.
Also, I don't think the studio wand and the "create new" test controls should not be available when studio is open
image

@mabela416
Copy link
Contributor

I changed to another project and it worked but i'm not sure why it didn't work on my other project

@mschile
Copy link
Contributor Author

mschile commented Jul 16, 2025

I changed to another project and it worked but i'm not sure why it didn't work on my other project

Do you have watchForFileChanges set to false on the other project?

@mabela416
Copy link
Contributor

I changed to another project and it worked but i'm not sure why it didn't work on my other project

Do you have watchForFileChanges set to false on the other project?

I did! but it should work even if watchForFileChanges is set to false right?

@mschile
Copy link
Contributor Author

mschile commented Jul 16, 2025

Yes, it should, I'll have to look into it.

@mschile
Copy link
Contributor Author

mschile commented Jul 16, 2025

I changed to another project and it worked but i'm not sure why it didn't work on my other project

Do you have watchForFileChanges set to false on the other project?

I did! but it should work even if watchForFileChanges is set to false right?

This has been fixed.

@mschile
Copy link
Contributor Author

mschile commented Jul 16, 2025

Also, I don't think the studio wand and the "create new" test controls should not be available when studio is open image

I actually like the controls being available since someone might open the panel and then want to go to a specific test or change the suite.

@mabela416
Copy link
Contributor

Also, I don't think the studio wand and the "create new" test controls should not be available when studio is open image

I actually like the controls being available since someone might open the panel and then want to go to a specific test or change the suite.

can you check with @emilmilanov and @jennifer-shehane because the figma does not have them and I think there were other controls that they wanted to add in the future

@mschile
Copy link
Contributor Author

mschile commented Jul 16, 2025

Hmm, I see the New Test here and this design seems to elude to allowing the user to select a test from the list.

Regardless, I think it makes sense to merge this PR with the current behavior and then we can make changes if needed.

@mschile mschile self-assigned this Jul 16, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@mschile mschile merged commit 3b88383 into release/15.0.0 Jul 17, 2025
83 of 87 checks passed
@mschile mschile deleted the mschile/studio/new_test_root_suite_2 branch July 17, 2025 03:38
cypress-app-bot pushed a commit that referenced this pull request Jul 17, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 17, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 17, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 17, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 17, 2025
cypress-app-bot pushed a commit that referenced this pull request Jul 17, 2025
jennifer-shehane pushed a commit that referenced this pull request Jul 17, 2025
* chore: updating v8 snapshot cache

* index on release/15.0.0: 47bda54 fix: remove 'new' badge from Create from Component, fix parsing (#31457)

* index on release/15.0.0: 3b88383 internal: (studio) support creating new test in root suite (#32024)

---------

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
jennifer-shehane pushed a commit that referenced this pull request Jul 17, 2025
* chore: updating v8 snapshot cache

* index on release/15.0.0: 47bda54 fix: remove 'new' badge from Create from Component, fix parsing (#31457)

* index on release/15.0.0: 3b88383 internal: (studio) support creating new test in root suite (#32024)

---------

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
jennifer-shehane pushed a commit that referenced this pull request Jul 17, 2025
* chore: updating v8 snapshot cache

* index on release/15.0.0: 47bda54 fix: remove 'new' badge from Create from Component, fix parsing (#31457)

* index on release/15.0.0: 3b88383 internal: (studio) support creating new test in root suite (#32024)

---------

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 20, 2025

Released in 15.0.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 20, 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.

3 participants