Files
cypress/packages/server/test/integration/plugins_spec.js
Ben Kucera 94176149c4 deprecated before:browser:launch event (#6293)
* deprecate old API for before:browser:launch

* trigger ci

* allow chrome preferences to be overwritten in before:browser:launch

* add e2e test for chrome preferences

* add launchOptions.windowSize, refactor plugin handling into browser/utils

* async/await-ify chrome.ts, update e2e.js

* add padding to warning, allow more than 1 warning in run mode

* remove psInclude

* bump snap-shot-it, remove patch-package

* fix failing tests, tighten up code

* remove unused Promise.all

* more code cleanup from coffeescript conversion

* fix expectedExitcode

* update snapshot with cross origin error message

* more code cleanup from coffeescript conversion

* remove global state, cleanup normalizing stdout in snapshots

* fix asserting on the expected exit code

* remove firefox a default browser in e2e tests

* remove dupe const

* make onStdout return first arg by default

* remove only

* make expectedExitCode: 0 the default, remove duplicate option from all e2e tests

* fix test for electron

* reuse _getArgs() properly, tighten up dupe code, move perf e2e tests to use new e2e.it helpers

* make e2e test pass properly, and capture snapshot

- this was being overlooked because expectedExitCode wasn’t being set
(until now its the default)

* revert firefox specific changes to reduce PR diff

* remove newline

* temp 02/04/20 [skip ci]

* add more scenarios / return values

* rename plugin deprecation project fixture

* prevent warnings in run mode from being called multiple times in the same browser launch

- add plugin integration tests
- cleanup some promise code in browsers/chrome
- refactor the e2e deprecation tests

* update e2e deprecation specs, test that deprecation warning is displayed once per spec on a run

* cleanup let -> const, coffescript conversion

* bump snap-shot-it, remove patch-package

(cherry picked from commit ba23be5349)

* bump cli snap-shot-it

* cleanup: let -> const, parseFloat, formatting

* revert cross origin normalization

* fix spacing

* add types for plugin events

* dont pad warning message in run mode

* add e2e test for adding extensions before:browser:launch

* fix failing electron unit test, consolidate creating default launch options

* add extensions for electron + warning if install fails

* fix failing tests, yield the right before:browser:launch args signature

* e2e test electron via devtools extension

* remove .only

* add stdout assertions to e2e/1_deprecated_spec

* remove snapshot whitespace

* rename deprecation event

* update deprecated browser launch args warning message

* throw error on unexpected bbl property

* add tests for warning + error on bbl

* update snapshot

* revive 2 useful tests to validate how launchOption args are merged

* try fix e2e fullscreen spec, update snapshots

* tighten up code for throwing errors on unknown launch options properties

- list out the unknown and expected properties using existing
conventions
- tighten up the error message a bit

* rename options -> launchOptions, add e2e test for adding unknown properties to launchOptions, removed dupe snapshots

* fix fullscreen e2e test

* only push user gesture arg if chromium

* add e2e tests for throwing + rejecting errors, run e2e tests on all browsers, avoid ps logic only in electron

* remove conditional args in fullscreen test

* dont automatically install the latest version of chrome in circle

* add stubs for new electron properties

* switch from using port 5555 to 5544 to avoid common conflicts

* temporarily commenting out windowSize launchOption so release is unblocked and all tests pass

- can add it back in later once the e2e tests pass in CI

* make the path to chrome profile correctly dynamic to account for all operating systems

* remove magic length(8) and slice out the first 4 custom args set from the plugin launch options

* add back --start-maximized in chrome

* deleting windowSize-related code... for now!

Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2020-02-05 13:07:59 -05:00

43 lines
1.1 KiB
JavaScript

require('../spec_helper')
const plugins = require('../../lib/plugins')
const Fixtures = require('../support/helpers/fixtures')
const pluginsFile = Fixtures.projectPath('plugin-before-browser-launch-deprecation/cypress/plugins/index.js')
describe('lib/plugins', () => {
beforeEach(() => {
Fixtures.scaffold()
})
afterEach(() => {
Fixtures.remove()
})
it('prints deprecation message if before:browser:launch argument is mutated as array', () => {
const onWarning = sinon.stub()
const projectConfig = {
pluginsFile,
env: {
BEFORE_BROWSER_LAUNCH_HANDLER: 'return-array-mutation',
},
}
const options = {
onWarning,
}
return plugins.init(projectConfig, options)
.then(() => {
return plugins.execute('before:browser:launch', {}, {
args: [],
})
})
.then(() => {
expect(onWarning).to.be.calledOnce
expect(onWarning.firstCall.args[0].message).to.include('Deprecation Warning: The `before:browser:launch` plugin event changed its signature in version `4.0.0`')
})
})
})