-
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 all 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 |
---|---|---|
|
@@ -380,6 +380,8 @@ export class ProjectLifecycleManager { | |
} | ||
|
||
private _setCurrentProject (projectRoot: string) { | ||
process.chdir(projectRoot) | ||
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 wonder why we needed to add this specifically during this PR? Or was it just a drive-by fix or sorts, not actually required for WK?
Will leave this note to assist other reviews who might have the same question. |
||
|
||
this._projectRoot = projectRoot | ||
this._initializedProject = undefined | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
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', | ||
'*.barbaz.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', | ||
}, | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
describe('WebKit-specific behavior', { browser: 'webkit' }, () => { | ||
it('cy.origin() is disabled', (done) => { | ||
cy.on('fail', (err) => { | ||
expect(err.message).to.equal('`cy.origin()` is not currently supported in experimental WebKit.') | ||
expect(err.docsUrl).to.equal('https://on.cypress.io/webkit-experiment') | ||
done() | ||
}) | ||
|
||
cy.origin('foo', () => {}) | ||
}) | ||
|
||
it('cy.session() is disabled', (done) => { | ||
cy.on('fail', (err) => { | ||
expect(err.message).to.equal('`cy.session()` is not currently supported in experimental WebKit.') | ||
expect(err.docsUrl).to.equal('https://on.cypress.io/webkit-experiment') | ||
done() | ||
}) | ||
|
||
cy.session('foo', () => {}) | ||
}) | ||
|
||
it('cy.session() is disabled', (done) => { | ||
cy.on('fail', (err) => { | ||
expect(err.message).to.include('`forceNetworkError` was passed, but it is not currently supported in experimental WebKit.') | ||
expect(err.docsUrl).to.equal('https://on.cypress.io/intercept') | ||
done() | ||
}) | ||
|
||
cy.intercept('http://foo.com', { forceNetworkError: true }) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import _ from 'lodash' | ||
import { SourceMapConsumer } from 'source-map' | ||
import Promise from 'bluebird' | ||
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. Bluebird is not not bad but it contributes to "the code base showing it's age". I hope we can just rip all of bluebird out in one fowl swoop sometime. pun absolute intended 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. 😆 Yeah, this one in particular was needed to fix typings. |
||
|
||
// @ts-ignore | ||
import mappingsWasm from 'source-map/lib/mappings.wasm' | ||
|
@@ -12,19 +11,19 @@ const regexDataUrl = /data:[^;\n]+(?:;charset=[^;\n]+)?;base64,([a-zA-Z0-9+/]+={ | |
|
||
let sourceMapConsumers = {} | ||
|
||
const initializeSourceMapConsumer = (file, sourceMap) => { | ||
if (!sourceMap) return Promise.resolve(null) | ||
const initializeSourceMapConsumer = async (file, sourceMap) => { | ||
if (!sourceMap) return null | ||
|
||
// @ts-ignore | ||
SourceMapConsumer.initialize({ | ||
'lib/mappings.wasm': mappingsWasm, | ||
}) | ||
|
||
return Promise.resolve(new SourceMapConsumer(sourceMap)).then((consumer) => { | ||
sourceMapConsumers[file.fullyQualifiedUrl] = consumer | ||
const consumer = await new SourceMapConsumer(sourceMap) | ||
|
||
return consumer | ||
}) | ||
sourceMapConsumers[file.fullyQualifiedUrl] = consumer | ||
|
||
return consumer | ||
} | ||
|
||
const extractSourceMap = (file, fileContents) => { | ||
|
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.` | ||
}, | ||
|
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 🤔