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

feat: add option to ignore chrome preferences #29447

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

Conversation

jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Apr 30, 2024

Additional details

Adds an IGNORE_CHROME_PREFERENCES option to ignore Chrome preferences paths.

Steps to test

How has the user experience changed?

PR Tasks

Copy link

cypress bot commented Apr 30, 2024

8 flaky tests on run #55512 ↗︎

0 29255 1328 0 Flakiness 8

Details:

Merge branch 'develop' into ignore-chrom-prefs
Project: cypress Commit: 517f77d2e2
Status: Passed Duration: 19:21 💡
Started: May 21, 2024 5:19 PM Ended: May 21, 2024 5:38 PM
Flakiness  e2e/origin/cookie_login.cy.ts • 1 flaky test • 5x-driver-firefox

View Output

Test Artifacts
... > past Max-Age, before Expires -> not logged in
    </td>
  </tr></table>
Flakiness  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-chrome

View Output

Test Artifacts
network stubbing > waiting and aliasing > yields the expected interception when two requests are raced Test Replay
Flakiness  e2e/origin/commands/waiting.cy.ts • 1 flaky test • 5x-driver-chrome

View Output

Test Artifacts
... > throws when foo cannot resolve Test Replay
Flakiness  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-electron

View Output

Test Artifacts
network stubbing > waiting and aliasing > yields the expected interception when two requests are raced Test Replay
Flakiness  commands/waiting.cy.js • 1 flaky test • 5x-driver-electron

View Output

Test Artifacts
... > errors > throws when waiting for 2nd response to route Test Replay

The first 5 flaky specs are shown, see all 6 specs in Cypress Cloud.

Review all test suite changes for PR #29447 ↗︎

@@ -501,13 +513,16 @@ export = {
launchOptions.preferences = _mergeChromePreferences(preferences, launchOptions.preferences as ChromePreferences)
}

const p = _disableRestorePagesPrompt(userDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason this was pulled out of the promise array below?

@@ -501,13 +513,16 @@ export = {
launchOptions.preferences = _mergeChromePreferences(preferences, launchOptions.preferences as ChromePreferences)
}

const p = _disableRestorePagesPrompt(userDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we keep this here, we'll want a more appropriately named variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was for debugging while running - I'll remove

Copy link
Contributor

Choose a reason for hiding this comment

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

addressed in c209969

* this effectively prevents Cypress from writing to the Chrome preferences files.
* See: _writeChromePreferences
*/
if (process.env.IGNORE_CHROME_PREFERENCES) {
Copy link
Contributor

@mschile mschile May 13, 2024

Choose a reason for hiding this comment

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

I wonder if this should be more specific, SKIP_RETRIEVING_CHROME_PREFERENCES or SKIP_READING_CHROME_PREFERENCE_PATHS

if (process.env.IGNORE_CHROME_PREFERENCES) {
debug('ignoring chrome preferences...')

return Bluebird.resolve(_.mapValues(CHROME_PREFERENCE_PATHS, () => ({})))
Copy link
Contributor

Choose a reason for hiding this comment

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

What if only one of the CHROME_PREFERENCE_PATHS is encrypted, would we want to read from the other paths?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so - this makes more sense as an all-or-nothing thing. I'm curious if we should prevent writing preferences as well with this env var, but that may cause more confusion (or should be a separate env var). As is, if you set this env, and then provide preferences via config, it will still attempt to write preferences.


return Bluebird.resolve(_.mapValues(CHROME_PREFERENCE_PATHS, () => ({})))
}

debug('reading chrome preferences... %o', { userDir, CHROME_PREFERENCE_PATHS })

return Bluebird.props(_.mapValues(CHROME_PREFERENCE_PATHS, (prefPath) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We are already catching the ENOENT error below and returning an empty object. Is there an error thrown when reading an encrypted path? If so, can we just add it to below and remove the need of the new environment variable?

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be the write logic combined with the lockfile removal, on relaunch, that throws the error, not the read?

cli/CHANGELOG.md Outdated Show resolved Hide resolved
@jennifer-shehane
Copy link
Member Author

@cacieprins to make some updates here based on our convo - to ignore writing and reading chrome prefs

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.

Add an option to ignore preferences files load on browser relaunch
3 participants