-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: gate WebKit behind experimentalWebKitSupport in prod #23711
Changes from 4 commits
d29b5c6
9a9bf40
b8b5f1e
ea32051
804f7e7
7b473de
e8c0d9a
91357ed
dc21b48
1fde5a7
f396c41
81925de
ca82602
156ae42
95aa0b4
a9d2691
3bd8a3c
77d3248
7cc5584
5e7fb4b
07a3cde
af8d3a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
'projectId': 'ypt4pf', | ||
'experimentalStudio': true, | ||
'hosts': { | ||
projectId: 'ypt4pf', | ||
experimentalStudio: true, | ||
experimentalWebKitSupport: true, | ||
hosts: { | ||
'*.foobar.com': '127.0.0.1', | ||
'*.idp.com': '127.0.0.1', | ||
'localalias': '127.0.0.1', | ||
}, | ||
'reporter': 'cypress-multi-reporters', | ||
'reporterOptions': { | ||
'configFile': '../../mocha-reporter-config.json', | ||
reporter: 'cypress-multi-reporters', | ||
reporterOptions: { | ||
configFile: '../../mocha-reporter-config.json', | ||
}, | ||
'e2e': { | ||
'setupNodeEvents': (on, config) => { | ||
e2e: { | ||
setupNodeEvents: (on, config) => { | ||
return require('./cypress/plugins')(on, config) | ||
}, | ||
'baseUrl': 'http://localhost:3500', | ||
baseUrl: 'http://localhost:3500', | ||
}, | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ export const AllCypressErrors = { | |
}, | ||
CHROME_WEB_SECURITY_NOT_SUPPORTED: (browser: string) => { | ||
return errTemplate`\ | ||
Your project has set the configuration option: ${fmt.highlight(`chromeWebSecurity`)} to ${fmt.highlightTertiary(`false`)} | ||
Your project has set the configuration option: \`chromeWebSecurity\` to \`false\`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
lmiller1990 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This option will not have an effect in ${fmt.off(_.capitalize(browser))}. Tests that rely on web security being disabled will not run as expected.` | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
}" | ||
> | ||
<Tooltip | ||
v-if="!browser.isVersionSupported" | ||
v-if="browser.warning" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also fixes an issue where the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we add a regression test for this somewhere? Not sure I see it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you'd add it in this file potentially: https://github.com/cypress-io/cypress/blob/develop/packages/launchpad/cypress/e2e/config-files-error-handling.cy.ts#L96 Just pick a system-tests project that has There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are percy snapshots for the warning icon itself, does that cover the need for a test? |
||
popper-class="max-w-lg" | ||
> | ||
<i-cy-circle-bg-question-mark_x16 | ||
|
@@ -37,7 +37,10 @@ | |
/> | ||
<template #popper> | ||
<div class="text-center p-2 text-gray-300 text-size-14px leading-20px"> | ||
<div class="font-medium text-white mb-2"> | ||
<div | ||
v-if="!browser.isVersionSupported" | ||
class="font-medium text-white mb-2" | ||
> | ||
Unsupported browser | ||
</div> | ||
{{ browser.warning }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,8 @@ export = { | |
|
||
formatBrowsersToOptions: utils.formatBrowsersToOptions, | ||
|
||
setFocus, | ||
|
||
_setInstance (_instance: BrowserInstance) { | ||
// for testing | ||
instance = _instance | ||
|
@@ -110,15 +112,6 @@ export = { | |
return instance | ||
}, | ||
|
||
getAllBrowsersWith (nameOrPath?: string) { | ||
debug('getAllBrowsersWith %o', { nameOrPath }) | ||
if (nameOrPath) { | ||
return utils.ensureAndGetByNameOrPath(nameOrPath, true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code path was never used so I removed this function entirely. |
||
} | ||
|
||
return utils.getBrowsers() | ||
}, | ||
|
||
async connectToExisting (browser: Browser, options: BrowserLaunchOpts, automation: Automation): Promise<BrowserInstance | null> { | ||
const browserLauncher = await getBrowserLauncher(browser, options.browsers) | ||
|
||
|
@@ -196,5 +189,4 @@ export = { | |
|
||
return instance | ||
}, | ||
setFocus, | ||
} as const |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,10 +204,10 @@ const getWebKitBrowserVersion = async () => { | |
} | ||
} | ||
|
||
const getWebKitBrowser = async () => { | ||
async function getWebKitBrowser () { | ||
try { | ||
const modulePath = require.resolve('playwright-webkit', { paths: [process.cwd()] }) | ||
const mod = require(modulePath) as typeof import('playwright-webkit') | ||
const mod = await import(modulePath) as typeof import('playwright-webkit') | ||
lmiller1990 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const version = await getWebKitBrowserVersion() | ||
|
||
const browser: FoundBrowser = { | ||
|
@@ -218,7 +218,7 @@ const getWebKitBrowser = async () => { | |
version, | ||
path: mod.webkit.executablePath(), | ||
majorVersion: version.split('.')[0], | ||
warning: 'WebKit support is not currently available in production.', | ||
warning: 'WebKit support is currently experimental. Some functions may not work as expected.', | ||
} | ||
|
||
return browser | ||
|
@@ -232,8 +232,12 @@ const getWebKitBrowser = async () => { | |
const getBrowsers = async () => { | ||
debug('getBrowsers') | ||
|
||
const browsers = await launcher.detect() | ||
let majorVersion | ||
const [browsers, wkBrowser] = await Promise.all([ | ||
launcher.detect(), | ||
getWebKitBrowser(), | ||
]) | ||
|
||
if (wkBrowser) browsers.push(wkBrowser) | ||
|
||
debug('found browsers %o', { browsers }) | ||
|
||
|
@@ -243,8 +247,8 @@ const getBrowsers = async () => { | |
return browsers | ||
} | ||
|
||
// @ts-ignore | ||
const version = process.versions.chrome || '' | ||
let majorVersion | ||
|
||
if (version) { | ||
majorVersion = getMajorVersion(version) | ||
|
@@ -258,17 +262,10 @@ const getBrowsers = async () => { | |
version, | ||
path: '', | ||
majorVersion, | ||
info: 'Electron is the default browser that comes with Cypress. This is the default browser that runs in headless mode. Selecting this browser is useful when debugging. The version number indicates the underlying Chromium version that Electron uses.', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the subject of #21769 - info display has been broken since 10.0.0. I've just removed it in lieu of adding the |
||
} | ||
|
||
browsers.push(electronBrowser) | ||
|
||
if (process.env.CYPRESS_INTERNAL_ENV !== 'production') { | ||
const wkBrowser = await getWebKitBrowser() | ||
|
||
if (wkBrowser) browsers.push(wkBrowser) | ||
} | ||
|
||
return browsers | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean by confusing now, there's about 20 places we modify the config, and it's not clear if this is the right place to do it, or one of the other 19 🤔