Skip to content

Conversation

@tbiethman
Copy link
Contributor

@tbiethman tbiethman commented Mar 29, 2022

When a new browser is selected from the app's top navigation, the current browser instance is destroyed and the new browser is opened. As part of this lifecycle, the currentBrowser field is updated, and the browserStatus field is changed ('closed' -> 'opening' -> 'open'), with each change being broadcast through the browserStatusChange subscription event.

The launchpad remains open throughout this process and should be updated by its subscription to the 'browserStatusChange` event. However, because we are not using the currentBrowser field in the subscription definition, we are not getting notified that its value has changed and thus continue to show the previous browser as selected/open.

I updated the subscription to include the currentBrowser so that any changes to browserStatus will include any relevant corresponding changes to the currentBrowser. This ensures that the currentBrowser is always synchronized properly.

I also cleaned up a few things around this logic and updated tests where necessary.

User facing changelog

  • Fixes an issue where changing the browser from the app does not reflect in the launchpad

Additional details

How has the user experience changed?

browser_sync.mov

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@tbiethman tbiethman requested a review from ZachJW34 March 29, 2022 19:07
@tbiethman tbiethman self-assigned this Mar 29, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 29, 2022

Thanks for taking the time to open a PR!

}
}
`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This mutation is no longer used.

<div
class="font-medium pt-2 text-indigo-600 text-18px leading-28px"
:class="{ 'text-jade-600': browser.isSelected, 'text-gray-500': browser.disabled || !browser.isVersionSupported }"
:class="{ 'text-jade-600': browser.id === selectedBrowserId, 'text-gray-500': browser.disabled || !browser.isVersionSupported }"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this to ensure we're always reflecting the currentBrowser value in our selections.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we not have used the checked slot prop? We've got so many conditionals in this template 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good call, that works great. I'll have to do some reading on how the slot props work.

// NOTE: The currentBrowser is set to the first detected browser
// found during project initialization. It should always be defined.
return props.gql.currentBrowser?.id
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think the defaulting value logic was ever executed outside of component tests, as we always default the currentBrowser to the first browser detected on the user's system, which would always at least include Electron. So I removed that bit.

I also updated the markup so that if we end up in a scenario where we don't have a currentBrowser, we do not show the action buttons and allow the user to open a browser when nothing is actually selected.

name
displayName
path
version
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed fields that weren't being used anymore

@cypress
Copy link

cypress bot commented Mar 29, 2022



Test summary

4333 0 48 0Flakiness 0


Run details

Project cypress
Status Passed
Commit 5d0adfe
Started Mar 31, 2022 3:14 PM
Ended Mar 31, 2022 3:26 PM
Duration 12:11 💡
OS Linux Debian - 10.10
Browser Electron 94

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

ZachJW34
ZachJW34 previously approved these changes Mar 29, 2022
Copy link
Contributor

@ZachJW34 ZachJW34 left a comment

Choose a reason for hiding this comment

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

Awesome PR description, tested and it works great!

<div
class="font-medium pt-2 text-indigo-600 text-18px leading-28px"
:class="{ 'text-jade-600': browser.isSelected, 'text-gray-500': browser.disabled || !browser.isVersionSupported }"
:class="{ 'text-jade-600': browser.id === selectedBrowserId, 'text-gray-500': browser.disabled || !browser.isVersionSupported }"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we not have used the checked slot prop? We've got so many conditionals in this template 😅

@flotwig flotwig self-requested a review March 30, 2022 15:33
@tbiethman tbiethman merged commit c4adc8c into 10.0-release Mar 31, 2022
@tbiethman tbiethman deleted the tbiethman/UNIFY-1395-active-browser branch March 31, 2022 15:25
tgriesser added a commit that referenced this pull request Apr 1, 2022
* 10.0-release:
  fix: add index.mjs to the published files of cli (#20884)
  refactor: lift indexHtmlFile up to component, add validation (#20870)
  fix: allow migration of pluginsFile using `env` properties (#20770)
  fix: viewport from CLI on CT (#20849)
  fix: git data source unit test failure (#20875)
  fix: Ensuring current browser is synchronized between app and launchpad (#20830)
  Fix missed await on merge conflict resolution
  test(unification): move record keys to contexts (#20860)
  test: move record keys to contexts (#20859)
  make alerts more responsive
  chore: Update Chrome (stable) to 100.0.4896.60 (#20841)
  Revise test.
  fix: cy.root respect timeout option.
  fix(deps): update dependency ansi-regex to v4.1.1 [security] (#20836)
  chore(deps): update dependency ansi-regex to 4.1.1 [security] (#20807)
  chore: Refactor cri-client to use async/await (#20825)
  remove automationId from runnerStore
  fix firefox automation and adress feedback
  feat: add automation warning/disconnected states in app
tgriesser added a commit that referenced this pull request Apr 5, 2022
* 10.0-release: (92 commits)
  chore: remove dependency-tree dep (#20905)
  chore(launchpad): work on infra for scaffold tests (#20818)
  fix: build mjs in the cli (#20889)
  fix(unify): Cypress version link should point to Cypress doc's changelog (#20869)
  fix: windows build (#20854)
  fix: add index.mjs to the published files of cli (#20884)
  refactor: lift indexHtmlFile up to component, add validation (#20870)
  fix: allow migration of pluginsFile using `env` properties (#20770)
  fix: viewport from CLI on CT (#20849)
  Don't communicate if process isn't connected
  Remove config.get
  Update packages/data-context/src/data/ProjectLifecycleManager.ts
  fix: git data source unit test failure (#20875)
  add comment for autoBindDebug
  fix: Ensuring current browser is synchronized between app and launchpad (#20830)
  Fix missed await on merge conflict resolution
  test(unification): move record keys to contexts (#20860)
  test: move record keys to contexts (#20859)
  PR comments
  Fix tests that visit app without a configured testing type
  ...
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