From 653f52dc3cad92fd96fc2fb019a0c276aafb83dd Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Thu, 17 Oct 2019 11:40:53 -0400 Subject: [PATCH] upgrade eslint-plugin-dev to 5.0.0 (#5382) * upgrade eslint-plugin-dev to 5.0.0 * more [lint fixes] --- cli/lib/exec/versions.js | 1 - cli/lib/tasks/download.js | 1 - cli/lib/tasks/install.js | 6 ---- cli/lib/tasks/unzip.js | 1 - cli/lib/tasks/verify.js | 2 -- cli/lib/util.js | 1 - cli/test/lib/exec/xvfb_spec.js | 1 - cli/test/lib/tasks/install_spec.js | 8 ----- cli/test/lib/tasks/verify_spec.js | 3 -- cli/test/lib/util_spec.js | 1 - cli/test/spec_helper.js | 2 -- package.json | 2 +- packages/desktop-gui/src/app/nav.jsx | 1 - packages/desktop-gui/src/auth/login-form.jsx | 1 - .../desktop-gui/src/dropdown/dropdown.jsx | 1 - packages/desktop-gui/src/lib/utils.js | 1 - .../desktop-gui/src/project/onboarding.jsx | 1 - .../src/runs/permission-message.jsx | 2 -- packages/desktop-gui/src/runs/runs-list.jsx | 2 -- .../desktop-gui/src/update/update-banner.jsx | 1 - .../driver/src/cy/commands/actions/click.js | 1 - .../driver/src/cy/commands/actions/type.js | 4 --- packages/driver/src/cy/keyboard.js | 8 ----- packages/driver/src/cy/mouse.js | 10 ------- packages/driver/src/dom/elements.js | 5 ---- packages/driver/src/dom/jquery.js | 1 - packages/driver/src/dom/selection.js | 3 -- packages/driver/src/dom/visibility.js | 1 - .../commands/actions/click_spec.js | 23 --------------- .../integration/commands/actions/type_spec.js | 10 ------- .../integration/cy/snapshot_css_spec.js | 1 - .../integration/dom/visibility_spec.js | 1 - .../integration/e2e/focus_blur_spec.js | 29 ------------------- .../e2e/selector_playground.spec.js | 3 -- .../cypress/integration/issues/3847_spec.js | 1 - .../integration/util/limited_map_spec.js | 1 - packages/driver/test/cypress/support/utils.js | 3 -- packages/network/lib/agent.ts | 2 +- .../src/commands/command-model.spec.js | 1 - .../reporter/src/runnables/suite-model.js | 1 - packages/reporter/src/test/test.jsx | 1 - packages/runner/src/app/app.spec.jsx | 1 - packages/runner/src/dropdown/dropdown.jsx | 1 - packages/runner/src/iframe/visit-failure.js | 1 - packages/runner/src/lib/logger.js | 1 - packages/runner/src/lib/state.js | 1 - packages/runner/src/lib/util.js | 1 - packages/runner/test/helper.js | 1 - packages/server/lib/browsers/cri-client.ts | 9 +++--- packages/server/lib/gui/menu.js | 1 - packages/server/lib/modes/run.js | 2 +- packages/server/lib/plugins/child/task.js | 1 - packages/server/lib/util/app_data.js | 1 - packages/server/lib/util/args.js | 1 - packages/server/lib/util/file.js | 1 - packages/server/lib/util/replace_stream.ts | 2 +- packages/server/lib/util/settings.js | 2 -- packages/server/lib/util/shell.js | 1 - packages/server/lib/util/system.js | 1 - packages/server/lib/util/terminal.js | 1 - packages/server/test/e2e/2_cdp_spec.ts | 2 +- .../visit_response_never_ends_failing_spec.js | 1 - .../test/unit/browsers/protocol_spec.ts | 2 +- packages/server/test/unit/gui/auth_spec.js | 1 - .../server/test/unit/stream_buffer_spec.js | 1 - packages/ts/index.d.ts | 4 +-- packages/web-config/node-jsdom-setup.ts | 2 -- scripts/binary/util/testStaticAssets.js | 3 -- scripts/binary/util/transform-requires.js | 3 -- scripts/link-packages.js | 1 - scripts/unit/binary/util/packages-spec.js | 14 ++++----- 71 files changed, 17 insertions(+), 196 deletions(-) diff --git a/cli/lib/exec/versions.js b/cli/lib/exec/versions.js index 58ed2e1726..bb3589ef74 100644 --- a/cli/lib/exec/versions.js +++ b/cli/lib/exec/versions.js @@ -8,7 +8,6 @@ const { throwFormErrorText, errors } = require('../errors') const getVersions = () => { return Promise.try(() => { - if (util.getEnv('CYPRESS_RUN_BINARY')) { let envBinaryPath = path.resolve(util.getEnv('CYPRESS_RUN_BINARY')) diff --git a/cli/lib/tasks/download.js b/cli/lib/tasks/download.js index 3bdda4ffd4..5afd2a7b95 100644 --- a/cli/lib/tasks/download.js +++ b/cli/lib/tasks/download.js @@ -176,7 +176,6 @@ const verifyDownloadedFile = (filename, expectedSize, expectedChecksum) => { debug('downloaded file lacks checksum or size to verify') return Promise.resolve() - } // downloads from given url diff --git a/cli/lib/tasks/install.js b/cli/lib/tasks/install.js index 6215a08e8e..26cb7b23cc 100644 --- a/cli/lib/tasks/install.js +++ b/cli/lib/tasks/install.js @@ -27,7 +27,6 @@ const alreadyInstalledMsg = () => { } const displayCompletionMsg = () => { - // check here to see if we are globally installed if (util.isInstalledGlobally()) { // if we are display a warning @@ -103,7 +102,6 @@ const downloadAndUnzip = ({ version, installDir, downloadDir }) => { { title: util.titleize('Finishing Installation'), task: (ctx, task) => { - const cleanup = () => { debug('removing zip file %s', downloadDestination) @@ -129,7 +127,6 @@ const downloadAndUnzip = ({ version, installDir, downloadDir }) => { } const start = (options = {}) => { - // handle deprecated / removed if (util.getEnv('CYPRESS_BINARY_VERSION')) { return throwFormErrorText(errors.removed.CYPRESS_BINARY_VERSION)() @@ -152,7 +149,6 @@ const start = (options = {}) => { // let this environment variable reset the binary version we need if (util.getEnv('CYPRESS_INSTALL_BINARY')) { - // because passed file paths are often double quoted // and might have extra whitespace around, be robust and trim the string const trimAndRemoveDoubleQuotes = true @@ -175,7 +171,6 @@ const start = (options = {}) => { // if this doesn't match the expected version // then print warning to the user if (envVarVersion !== needVersion) { - // reset the version to the env var version needVersion = envVarVersion } @@ -211,7 +206,6 @@ const start = (options = {}) => { return state.getBinaryPkgVersionAsync(binaryDir) }) .then((binaryVersion) => { - if (!binaryVersion) { debug('no binary installed under cli version') diff --git a/cli/lib/tasks/unzip.js b/cli/lib/tasks/unzip.js index a7a7124290..c341d62eb3 100644 --- a/cli/lib/tasks/unzip.js +++ b/cli/lib/tasks/unzip.js @@ -14,7 +14,6 @@ const util = require('../util') // expose this function for simple testing const unzip = ({ zipFilePath, installDir, progress }) => { - debug('unzipping from %s', zipFilePath) debug('into', installDir) diff --git a/cli/lib/tasks/verify.js b/cli/lib/tasks/verify.js index 48830022aa..41371d0ce7 100644 --- a/cli/lib/tasks/verify.js +++ b/cli/lib/tasks/verify.js @@ -221,7 +221,6 @@ function testBinary (version, binaryDir, options) { const maybeVerify = (installedVersion, binaryDir, options) => { return state.getBinaryVerifiedAsync(binaryDir) .then((isVerified) => { - debug('is Verified ?', isVerified) let shouldVerify = !isVerified @@ -317,7 +316,6 @@ const start = (options = {}) => { return state.getBinaryPkgVersionAsync(binaryDir) }) .then((binaryVersion) => { - if (!binaryVersion) { debug('no Cypress binary found for cli version ', packageVersion) diff --git a/cli/lib/util.js b/cli/lib/util.js index 029c0bb189..84f872db4c 100644 --- a/cli/lib/util.js +++ b/cli/lib/util.js @@ -326,7 +326,6 @@ const util = { } return os.release() - }) }, diff --git a/cli/test/lib/exec/xvfb_spec.js b/cli/test/lib/exec/xvfb_spec.js index 55db48b0f5..a5da2853ef 100644 --- a/cli/test/lib/exec/xvfb_spec.js +++ b/cli/test/lib/exec/xvfb_spec.js @@ -71,7 +71,6 @@ describe('lib/exec/xvfb', function () { }) context('#isNeeded', function () { - it('does not need xvfb on osx', function () { os.platform.returns('darwin') diff --git a/cli/test/lib/tasks/install_spec.js b/cli/test/lib/tasks/install_spec.js index c9c50bae9b..8e9a9a5b22 100644 --- a/cli/test/lib/tasks/install_spec.js +++ b/cli/test/lib/tasks/install_spec.js @@ -59,7 +59,6 @@ describe('/lib/tasks/install', function () { }) describe('skips install', function () { - it('when environment variable is set', function () { process.env.CYPRESS_INSTALL_BINARY = '0' @@ -76,7 +75,6 @@ describe('/lib/tasks/install', function () { }) describe('override version', function () { - it('warns when specifying cypress version in env', function () { const version = '0.12.1' @@ -182,7 +180,6 @@ describe('/lib/tasks/install', function () { describe('when version is already installed', function () { beforeEach(function () { state.getBinaryPkgVersionAsync.resolves(packageVersion) - }) it('doesn\'t attempt to download', function () { @@ -191,7 +188,6 @@ describe('/lib/tasks/install', function () { expect(download.start).not.to.be.called expect(state.getBinaryPkgVersionAsync).to.be.calledWith('/cache/Cypress/1.2.3/Cypress.app') }) - }) it('logs \'skipping install\' when explicit cypress install', function () { @@ -202,7 +198,6 @@ describe('/lib/tasks/install', function () { normalize(this.stdout.toString()) ) }) - }) it('logs when already installed when run from postInstall', function () { @@ -249,7 +244,6 @@ describe('/lib/tasks/install', function () { }) it('logs message and starts download', function () { - expect(download.start).to.be.calledWithMatch({ version: packageVersion, }) @@ -301,7 +295,6 @@ describe('/lib/tasks/install', function () { }) it('logs message and starts download', function () { - expect(download.start).to.be.calledWithMatch({ version: packageVersion, }) @@ -467,5 +460,4 @@ describe('/lib/tasks/install', function () { }) }) }) - }) diff --git a/cli/test/lib/tasks/verify_spec.js b/cli/test/lib/tasks/verify_spec.js index ed147aeef9..9d18832c72 100644 --- a/cli/test/lib/tasks/verify_spec.js +++ b/cli/test/lib/tasks/verify_spec.js @@ -178,7 +178,6 @@ context('lib/tasks/verify', () => { .then(() => { snapshot(normalize(slice(stdout.toString()))) }) - }) it('logs error when child process returns incorrect stdout (stderr when exists)', () => { @@ -205,7 +204,6 @@ context('lib/tasks/verify', () => { .then(() => { snapshot(normalize(slice(stdout.toString()))) }) - }) it('logs error when child process returns incorrect stdout (stdout when no stderr)', () => { @@ -231,7 +229,6 @@ context('lib/tasks/verify', () => { .then(() => { snapshot(normalize(slice(stdout.toString()))) }) - }) it('sets ELECTRON_ENABLE_LOGGING without mutating process.env', () => { diff --git a/cli/test/lib/util_spec.js b/cli/test/lib/util_spec.js index 73238da52e..30be63f3a4 100644 --- a/cli/test/lib/util_spec.js +++ b/cli/test/lib/util_spec.js @@ -321,7 +321,6 @@ describe('util', () => { context('.printNodeOptions', () => { describe('NODE_OPTIONS is not set', () => { - it('does nothing if debug is not enabled', () => { const log = sinon.spy() diff --git a/cli/test/spec_helper.js b/cli/test/spec_helper.js index e795b33e87..a5df843f79 100644 --- a/cli/test/spec_helper.js +++ b/cli/test/spec_helper.js @@ -9,9 +9,7 @@ const { MockChildProcess } = require('spawn-mock') const _kill = MockChildProcess.prototype.kill const patchMockSpawn = () => { - MockChildProcess.prototype.kill = function (...args) { - this.emit('exit') return _kill.apply(this, args) diff --git a/package.json b/package.json index 536c729f93..5378d6b285 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@cypress/bumpercar": "2.0.12", "@cypress/commit-message-install": "2.7.0", "@cypress/env-or-json-file": "2.0.0", - "@cypress/eslint-plugin-dev": "4.0.0", + "@cypress/eslint-plugin-dev": "5.0.0", "@cypress/github-commit-status-check": "1.5.0", "@cypress/npm-run-all": "4.0.5", "@cypress/questions-remain": "1.0.1", diff --git a/packages/desktop-gui/src/app/nav.jsx b/packages/desktop-gui/src/app/nav.jsx index 43cce7741c..d91b3be222 100644 --- a/packages/desktop-gui/src/app/nav.jsx +++ b/packages/desktop-gui/src/app/nav.jsx @@ -118,7 +118,6 @@ export default class Nav extends Component { Log Out ) - } _select = (item) => { diff --git a/packages/desktop-gui/src/auth/login-form.jsx b/packages/desktop-gui/src/auth/login-form.jsx index 7577ab4fa8..39bf0ce989 100644 --- a/packages/desktop-gui/src/auth/login-form.jsx +++ b/packages/desktop-gui/src/auth/login-form.jsx @@ -80,7 +80,6 @@ class LoginForm extends Component { Log In to Dashboard ) - } _error () { diff --git a/packages/desktop-gui/src/dropdown/dropdown.jsx b/packages/desktop-gui/src/dropdown/dropdown.jsx index 412caf8bec..ebce51d024 100644 --- a/packages/desktop-gui/src/dropdown/dropdown.jsx +++ b/packages/desktop-gui/src/dropdown/dropdown.jsx @@ -60,7 +60,6 @@ class Dropdown extends Component { {this._buttonContent()} ) - } _buttonContent () { diff --git a/packages/desktop-gui/src/lib/utils.js b/packages/desktop-gui/src/lib/utils.js index 95ac38990d..5fbb8b70ec 100644 --- a/packages/desktop-gui/src/lib/utils.js +++ b/packages/desktop-gui/src/lib/utils.js @@ -110,5 +110,4 @@ export function stripSharedDirsFromDir2 (dir1, dir2, osName) { }) .join(sep) .value() - } diff --git a/packages/desktop-gui/src/project/onboarding.jsx b/packages/desktop-gui/src/project/onboarding.jsx index 992f0131fa..57e011f9be 100644 --- a/packages/desktop-gui/src/project/onboarding.jsx +++ b/packages/desktop-gui/src/project/onboarding.jsx @@ -116,7 +116,6 @@ class OnBoarding extends Component { ) - }) } diff --git a/packages/desktop-gui/src/runs/permission-message.jsx b/packages/desktop-gui/src/runs/permission-message.jsx index 2b4264889d..2182835b79 100644 --- a/packages/desktop-gui/src/runs/permission-message.jsx +++ b/packages/desktop-gui/src/runs/permission-message.jsx @@ -45,7 +45,6 @@ class PermissionMessage extends Component { } return this._noResult() - } _button () { @@ -101,7 +100,6 @@ class PermissionMessage extends Component { {this._button()} ) - } _noResult () { diff --git a/packages/desktop-gui/src/runs/runs-list.jsx b/packages/desktop-gui/src/runs/runs-list.jsx index 4f293295b3..bbe30580cc 100644 --- a/packages/desktop-gui/src/runs/runs-list.jsx +++ b/packages/desktop-gui/src/runs/runs-list.jsx @@ -192,7 +192,6 @@ class RunsList extends Component { // OR there are no runs to show if (!this.runsStore.runs.length) { - // AND they've never setup CI if (!project.id) { return this._projectNotSetup() @@ -201,7 +200,6 @@ class RunsList extends Component { } return this._empty() - } //--------End Run States----------// diff --git a/packages/desktop-gui/src/update/update-banner.jsx b/packages/desktop-gui/src/update/update-banner.jsx index ddd0f79ff2..a987d6f5ca 100644 --- a/packages/desktop-gui/src/update/update-banner.jsx +++ b/packages/desktop-gui/src/update/update-banner.jsx @@ -94,7 +94,6 @@ class UpdateBanner extends Component { ) - } _checkForUpdate () { diff --git a/packages/driver/src/cy/commands/actions/click.js b/packages/driver/src/cy/commands/actions/click.js index cd83ad7cbd..bdab1663f2 100644 --- a/packages/driver/src/cy/commands/actions/click.js +++ b/packages/driver/src/cy/commands/actions/click.js @@ -40,7 +40,6 @@ const formatMoveEventsTable = (events) => { const formatMouseEvents = (events) => { return _.map(events, (val, key) => { if (val.skipped) { - const reason = val.skipped return { diff --git a/packages/driver/src/cy/commands/actions/type.js b/packages/driver/src/cy/commands/actions/type.js index a5da732b2b..eb83c72937 100644 --- a/packages/driver/src/cy/commands/actions/type.js +++ b/packages/driver/src/cy/commands/actions/type.js @@ -246,7 +246,6 @@ module.exports = function (Commands, Cypress, cy, state, config) { } return false - } const getDefaultButton = (form) => { @@ -421,7 +420,6 @@ module.exports = function (Commands, Cypress, cy, state, config) { onFail: options._log, args: { chars, allChars }, }) - }, }) @@ -480,7 +478,6 @@ module.exports = function (Commands, Cypress, cy, state, config) { } return type() - }, }) } @@ -577,7 +574,6 @@ module.exports = function (Commands, Cypress, cy, state, config) { } return verifyAssertions() - }) }, }) diff --git a/packages/driver/src/cy/keyboard.js b/packages/driver/src/cy/keyboard.js index 60c7039167..109a5e8c83 100644 --- a/packages/driver/src/cy/keyboard.js +++ b/packages/driver/src/cy/keyboard.js @@ -125,7 +125,6 @@ const create = (state) => { options.setKey = '{del}' return kb.ensureKey(el, null, options, () => { - if ($selection.isCollapsed(el)) { // if there's no text selected, delete the prev char // if deleted char, send the input event @@ -138,7 +137,6 @@ const create = (state) => { // contents and send the input event $selection.deleteSelectionContents(el) options.input = true - }) }, @@ -167,7 +165,6 @@ const create = (state) => { options.setKey = '{backspace}' return kb.ensureKey(el, null, options, () => { - if ($selection.isCollapsed(el)) { // if there's no text selected, delete the prev char // if deleted char, send the input event @@ -180,7 +177,6 @@ const create = (state) => { // contents and send the input event $selection.deleteSelectionContents(el) options.input = true - }) }, @@ -418,7 +414,6 @@ const create = (state) => { } return memo + chars.length - } , 0) }, @@ -576,7 +571,6 @@ const create = (state) => { typeKey (el, key, options) { return kb.ensureKey(el, key, options, () => { - const isDigit = isSingleDigitRe.test(key) const isNumberInputType = $elements.isInput(el) && $elements.isType(el, 'number') @@ -636,7 +630,6 @@ const create = (state) => { if (kb.simulateKey(el, 'keydown', key, options)) { if (kb.simulateKey(el, 'keypress', key, options)) { if (kb.simulateKey(el, 'textInput', key, options)) { - let ml if ($elements.isInput(el) || $elements.isTextarea(el)) { @@ -703,7 +696,6 @@ const create = (state) => { }, resetModifiers (doc) { - const activeEl = $elements.getActiveElByDocument(doc) const activeModifiers = kb.getActiveModifiers(state) diff --git a/packages/driver/src/cy/mouse.js b/packages/driver/src/cy/mouse.js index ae5e531331..772478dceb 100644 --- a/packages/driver/src/cy/mouse.js +++ b/packages/driver/src/cy/mouse.js @@ -179,12 +179,10 @@ const create = (state, keyboard, focused) => { sendMouseleave(elToSend, _.extend({}, defaultMouseOptions, { relatedTarget: el })) }) } - } if (hoveredElChanged) { if (el && $elements.isAttachedEl(el)) { - mouseover = () => { return sendMouseover(el, _.extend({}, defaultMouseOptions, { relatedTarget: lastHoveredEl })) } @@ -215,7 +213,6 @@ const create = (state, keyboard, focused) => { }) } } - } pointermove = () => { @@ -270,7 +267,6 @@ const create = (state, keyboard, focused) => { * @param {HTMLElement} forceEl */ _downEvents (coords, forceEl, pointerEvtOptionsExtend = {}, mouseEvtOptionsExtend = {}) { - const { x, y } = coords const el = forceEl || mouse.moveToCoords(coords) @@ -323,7 +319,6 @@ const create = (state, keyboard, focused) => { pointerdownProps, mousedownProps, } - }, down (fromElViewport, forceEl, pointerEvtOptionsExtend = {}, mouseEvtOptionsExtend = {}) { @@ -361,7 +356,6 @@ const create = (state, keyboard, focused) => { // the user clicked inside a focusable element focused.fireFocus($elToFocus.get(0)) } - } return mouseDownEvents @@ -414,7 +408,6 @@ const create = (state, keyboard, focused) => { const mouseClickEvents = mouse._mouseClickEvents(fromElViewport, forceEl, skipClickEvent, mouseEvtOptionsExtend) return _.extend({}, mouseDownEvents, mouseUpEvents, mouseClickEvents) - }, /** @@ -424,7 +417,6 @@ const create = (state, keyboard, focused) => { * @param {Window} win */ _upEvents (fromElViewport, forceEl, skipMouseEvent, pointerEvtOptionsExtend = {}, mouseEvtOptionsExtend = {}) { - const win = state('window') let defaultOptions = mouse._getDefaultMouseOptions(fromElViewport.x, fromElViewport.y, win) @@ -458,7 +450,6 @@ const create = (state, keyboard, focused) => { pointerupProps, mouseupProps, } - }, _mouseClickEvents (fromElViewport, forceEl, skipClickEvent, mouseEvtOptionsExtend = {}) { @@ -583,7 +574,6 @@ const sendEvent = (evtName, el, evtOptions, bubbles = false, cancelable = false, el, modifiers, } - } const sendPointerEvent = (el, evtOptions, evtName, bubbles = false, cancelable = false) => { diff --git a/packages/driver/src/dom/elements.js b/packages/driver/src/dom/elements.js index 3228dce8fd..7b217529f6 100644 --- a/packages/driver/src/dom/elements.js +++ b/packages/driver/src/dom/elements.js @@ -356,7 +356,6 @@ const isFocused = (el) => { } const isFocusedOrInFocused = (el) => { - const doc = $document.getDocumentFromElement(el) const { activeElement, body } = doc @@ -376,7 +375,6 @@ const isFocusedOrInFocused = (el) => { if (elToCheckCurrentlyFocused && elToCheckCurrentlyFocused === activeElement) { return true } - } const isElement = function (obj) { @@ -453,7 +451,6 @@ const getAllParents = (el) => { } return allParents - } const isChild = ($el, $maybeChild) => { @@ -643,7 +640,6 @@ const isDescendent = ($el1, $el2) => { } const findParent = (el, fn) => { - const recurse = (curEl, prevEl) => { if (!curEl) { return null @@ -790,7 +786,6 @@ const getElements = ($el) => { } return els - } const getContainsSelector = (text, filter = '') => { diff --git a/packages/driver/src/dom/jquery.js b/packages/driver/src/dom/jquery.js index 13336cbd8a..7ed2b474b8 100644 --- a/packages/driver/src/dom/jquery.js +++ b/packages/driver/src/dom/jquery.js @@ -18,7 +18,6 @@ const unwrap = function (obj) { } return obj - } const isJquery = (obj) => { diff --git a/packages/driver/src/dom/selection.js b/packages/driver/src/dom/selection.js index c9c4fa4bf2..84d1b674fa 100644 --- a/packages/driver/src/dom/selection.js +++ b/packages/driver/src/dom/selection.js @@ -175,7 +175,6 @@ const deleteSelectionContents = function (el) { } const setSelectionRange = function (el, start, end) { - if ($elements.canSetSelectionRangeElement(el)) { $elements.callNativeMethod(el, 'setSelectionRange', start, end) @@ -190,7 +189,6 @@ const setSelectionRange = function (el, start, end) { start, end, } - } const deleteRightOfCursor = function (el) { @@ -448,7 +446,6 @@ const moveSelectionToEnd = function (el) { ({ length } = $elements.getNativeProp(el, 'value')) return setSelectionRange(el, length, length) - } if ($elements.isContentEditable(el)) { diff --git a/packages/driver/src/dom/visibility.js b/packages/driver/src/dom/visibility.js index 70b873f60c..85fee6aec4 100644 --- a/packages/driver/src/dom/visibility.js +++ b/packages/driver/src/dom/visibility.js @@ -141,7 +141,6 @@ const elHasClippableOverflow = function ($el) { } const canClipContent = function ($el, $ancestor) { - // can't clip without overflow properties if (!elHasClippableOverflow($ancestor)) { return false diff --git a/packages/driver/test/cypress/integration/commands/actions/click_spec.js b/packages/driver/test/cypress/integration/commands/actions/click_spec.js index 2f6a049c9d..06bdf31146 100644 --- a/packages/driver/test/cypress/integration/commands/actions/click_spec.js +++ b/packages/driver/test/cypress/integration/commands/actions/click_spec.js @@ -249,7 +249,6 @@ describe('src/cy/commands/actions/click', () => { }) it('will send all events even mousedown is defaultPrevented', () => { - const $btn = cy.$$('#button') $btn.get(0).addEventListener('mousedown', (e) => { @@ -279,7 +278,6 @@ describe('src/cy/commands/actions/click', () => { cy.getAll('$btn', 'pointerdown pointerup click').each(shouldBeCalledOnce) cy.getAll('$btn', 'mousedown mouseup').each(shouldNotBeCalled) - }) it('sends a click event', (done) => { @@ -299,7 +297,6 @@ describe('src/cy/commands/actions/click', () => { }) it('causes focusable elements to receive focus', () => { - const el = cy.$$(':text:first') attachFocusListeners({ el }) @@ -428,7 +425,6 @@ describe('src/cy/commands/actions/click', () => { metaKey: false, altKey: false, }) - }) }) @@ -611,7 +607,6 @@ describe('src/cy/commands/actions/click', () => { }) it('places cursor at the end of [contenteditable]', () => { - cy.get('[contenteditable]:first') .invoke('html', '

').click() .then(($el) => { @@ -1706,7 +1701,6 @@ describe('src/cy/commands/actions/click', () => { }) it('throws when attempting to click multiple elements', (done) => { - cy.on('fail', (err) => { expect(err.message).to.eq('cy.click() can only be called on a single element. Your subject contained 4 elements. Pass { multiple: true } if you want to serially click each element.') @@ -1770,7 +1764,6 @@ describe('src/cy/commands/actions/click', () => { // Array(1).fill().map(()=> it('throws when any member of the subject isnt visible', function (done) { - // sometimes the command will timeout early with // Error: coordsHistory must be at least 2 sets of coords cy.timeout(300) @@ -2169,7 +2162,6 @@ describe('src/cy/commands/actions/click', () => { }) cy.get('input:first').click().then(function () { - const consoleProps = this.lastLog.invoke('consoleProps') expect(consoleProps.table[1]()).to.containSubset({ @@ -2237,7 +2229,6 @@ describe('src/cy/commands/actions/click', () => { }, ], }) - }) }) @@ -2334,7 +2325,6 @@ describe('src/cy/commands/actions/click', () => { cy.getAll('btn', 'mousemove mouseover').each(shouldBeCalledOnce) cy.getAll('btn', 'pointerdown mousedown pointerup mouseup click').each(shouldBeCalledWithCount(2)) .then(function () { - const { logs } = this const logsArr = logs.map((x) => x.invoke('consoleProps')) @@ -2387,7 +2377,6 @@ describe('src/cy/commands/actions/click', () => { ], }, ]) - }) }) @@ -2704,7 +2693,6 @@ describe('src/cy/commands/actions/click', () => { }) it('sends modifiers', () => { - const btn = cy.$$('button:first') attachMouseClickListeners({ btn }) @@ -2894,7 +2882,6 @@ describe('src/cy/commands/actions/click', () => { it('#consoleProps', function () { cy.on('log:added', (attrs, log) => { this.log = log - }) cy.get('button').first().dblclick().then(function ($btn) { @@ -3131,7 +3118,6 @@ describe('src/cy/commands/actions/click', () => { cy.getAll('el', 'pointerdown mousedown contextmenu pointerup mouseup').each(shouldBeCalled) cy.getAll('el', 'focus click').each(shouldNotBeCalled) - }) it('rightclick cancel pointerdown', () => { @@ -3147,7 +3133,6 @@ describe('src/cy/commands/actions/click', () => { cy.getAll('el', 'pointerdown pointerup contextmenu').each(shouldBeCalled) cy.getAll('el', 'mousedown mouseup').each(shouldNotBeCalled) - }) it('rightclick remove el on pointerdown', () => { @@ -3163,7 +3148,6 @@ describe('src/cy/commands/actions/click', () => { cy.getAll('el', 'pointerdown').each(shouldBeCalled) cy.getAll('el', 'mousedown mouseup contextmenu pointerup').each(shouldNotBeCalled) - }) it('rightclick remove el on mouseover', () => { @@ -3183,7 +3167,6 @@ describe('src/cy/commands/actions/click', () => { cy.getAll('el', 'pointerover mouseover').each(shouldBeCalledOnce) cy.getAll('el', 'pointerdown mousedown pointerup mouseup contextmenu').each(shouldNotBeCalled) cy.getAll('el2', 'focus pointerdown pointerup contextmenu').each(shouldBeCalled) - }) describe('errors', () => { @@ -3442,7 +3425,6 @@ describe('src/cy/commands/actions/click', () => { }) }) }) - }) }) @@ -3911,7 +3893,6 @@ describe('mouse state', () => { cy.getAll('input', 'mouseover mouseout').each(shouldBeCalledOnce) cy.getAll('input', 'mousedown mouseup click').each(shouldNotBeCalled) - }) it('can click on a recursively moving element', () => { @@ -4185,18 +4166,15 @@ describe('mouse state', () => { expect(stub).to.be.calledOnce }) }) - }) describe('user experience', () => { - beforeEach(() => { cy.visit('/fixtures/dom.html') }) // https://github.com/cypress-io/cypress/issues/4347 it('can render element highlight inside iframe', () => { - cy.get('iframe:first') .should(($iframe) => { // wait for iframe to load @@ -4253,5 +4231,4 @@ describe('mouse state', () => { }) }) }) - }) diff --git a/packages/driver/test/cypress/integration/commands/actions/type_spec.js b/packages/driver/test/cypress/integration/commands/actions/type_spec.js index b86ed25b71..ef2eab1680 100644 --- a/packages/driver/test/cypress/integration/commands/actions/type_spec.js +++ b/packages/driver/test/cypress/integration/commands/actions/type_spec.js @@ -1013,7 +1013,6 @@ describe('src/cy/commands/actions/type', () => { it('automatically moves the caret to the end if value is changed manually asynchronously', () => { cy.$$('#input-without-value').keypress((e) => { - const $input = $(e.target) _.defer(() => { @@ -1524,7 +1523,6 @@ describe('src/cy/commands/actions/type', () => { }) describe('specialChars', () => { - context('parseSpecialCharSequences: false', () => { it('types special character sequences literally', (done) => { cy.get(':text:first').invoke('val', 'foo') @@ -2538,9 +2536,7 @@ describe('src/cy/commands/actions/type', () => { }) describe('modifiers', () => { - describe('activating modifiers', () => { - it('sends keydown event for modifiers in order', (done) => { const $input = cy.$$('input:text:first') const events = [] @@ -2680,7 +2676,6 @@ describe('src/cy/commands/actions/type', () => { }) describe('release: false', () => { - it('maintains modifiers for subsequent type commands', (done) => { const $input = cy.$$('input:text:first') const events = [] @@ -2798,7 +2793,6 @@ describe('src/cy/commands/actions/type', () => { }) describe('case-insensitivity', () => { - it('special chars are case-insensitive', () => { cy.get(':text:first').invoke('val', 'bar').type('{leftarrow}{DeL}').then(($input) => { expect($input).to.have.value('ba') @@ -3209,7 +3203,6 @@ describe('src/cy/commands/actions/type', () => { }) describe('caret position', () => { - it('respects being formatted by input event handlers') it('accurately returns host contenteditable attr', () => { @@ -3266,7 +3259,6 @@ describe('src/cy/commands/actions/type', () => { }) it('inside textarea', () => { - cy.$$('body').append(Cypress.$(/*html*/`\
\ \ @@ -3278,7 +3270,6 @@ describe('src/cy/commands/actions/type', () => { }) it('inside contenteditable', () => { - cy.$$('body').append(Cypress.$(/*html*/`\
\
\ @@ -4042,7 +4033,6 @@ describe('src/cy/commands/actions/type', () => { if (log.get('name') === 'type') { expect(log.get('state')).to.eq('pending') expect(log.get('$el').get(0)).to.eq($txt.get(0)) - } }) diff --git a/packages/driver/test/cypress/integration/cy/snapshot_css_spec.js b/packages/driver/test/cypress/integration/cy/snapshot_css_spec.js index 9406cbffb3..2c32d1c33c 100644 --- a/packages/driver/test/cypress/integration/cy/snapshot_css_spec.js +++ b/packages/driver/test/cypress/integration/cy/snapshot_css_spec.js @@ -97,7 +97,6 @@ describe('driver/src/cy/snapshots_css', () => { }) it('returns same id after css has been modified until a new window', () => { - cy.state('document').styleSheets[0].insertRule('.qux { color: orange; }') snapshotCss.onCssModified('http://localhost:3500/fixtures/generic_styles.css') const ids1 = snapshotCss.getStyleIds() diff --git a/packages/driver/test/cypress/integration/dom/visibility_spec.js b/packages/driver/test/cypress/integration/dom/visibility_spec.js index 60e70fb0e2..ec957c0721 100644 --- a/packages/driver/test/cypress/integration/dom/visibility_spec.js +++ b/packages/driver/test/cypress/integration/dom/visibility_spec.js @@ -53,7 +53,6 @@ describe('src/cypress/dom/visibility', () => { }) it('returns false window and body > window height', () => { - cy.$$('body').html('
foo
') const win = cy.state('window') diff --git a/packages/driver/test/cypress/integration/e2e/focus_blur_spec.js b/packages/driver/test/cypress/integration/e2e/focus_blur_spec.js index 7cb33e88d7..4bd0cee014 100644 --- a/packages/driver/test/cypress/integration/e2e/focus_blur_spec.js +++ b/packages/driver/test/cypress/integration/e2e/focus_blur_spec.js @@ -65,7 +65,6 @@ const requireWindowInFocus = () => { if (!hasFocus) { expect(hasFocus, 'this test requires the window to be in focus').ok } - } it('can intercept blur/focus events', () => { @@ -87,7 +86,6 @@ it('can intercept blur/focus events', () => { cy .visit('http://localhost:3500/fixtures/active-elements.html') .then(() => { - requireWindowInFocus() expect(cy.getFocused()).to.be.null @@ -131,9 +129,7 @@ it('can intercept blur/focus events', () => { expect(blur).calledOnce expect(handleBlur).not.called - }) - }) it('blur the activeElement when clicking the body', () => { @@ -254,7 +250,6 @@ describe('polyfill programmatic blur events', () => { cy .visit('http://localhost:3500/fixtures/active-elements.html') .then(() => { - // programmatically focus the first, then second input element const $one = cy.$$('#one') const $two = cy.$$('#two') @@ -302,7 +297,6 @@ describe('polyfill programmatic blur events', () => { }) }) .then(() => { - stub.reset() setActiveElement($two.get(0)) @@ -339,7 +333,6 @@ describe('polyfill programmatic blur events', () => { $one.get(0).blur() cy.then(() => { - expect(stub).calledTwice expect(_.toPlainObject(stub.getCall(0).args[0].originalEvent)).to.containSubset({ @@ -356,7 +349,6 @@ describe('polyfill programmatic blur events', () => { }) .then(() => { - stub.reset() setActiveElement(cy.$$('body').get(0)) @@ -365,7 +357,6 @@ describe('polyfill programmatic blur events', () => { expect(stub, 'should not send blur if not focused el').not.called }) - }) }) @@ -374,7 +365,6 @@ describe('polyfill programmatic blur events', () => { cy .visit('http://localhost:3500/fixtures/active-elements.html') .then(() => { - // programmatically focus the first, then second input element const $one = cy.$$(` @@ -427,7 +417,6 @@ describe('polyfill programmatic blur events', () => { }) }) .then(() => { - stub.reset() setActiveElement($two.get(0)) @@ -468,7 +457,6 @@ describe('polyfill programmatic blur events', () => { $one.get(0).blur() cy.then(() => { - expect(stub).calledTwice expect(_.toPlainObject(stub.getCall(0).args[0].originalEvent)).to.containSubset({ @@ -485,7 +473,6 @@ describe('polyfill programmatic blur events', () => { }) .then(() => { - stub.reset() setActiveElement(cy.$$('body').get(0)) @@ -494,7 +481,6 @@ describe('polyfill programmatic blur events', () => { expect(stub, 'should not send blur if not focused el').not.called }) - }) }) @@ -508,7 +494,6 @@ describe('polyfill programmatic blur events', () => { it('does not send focus events for non-focusable elements', () => { cy.visit('http://localhost:3500/fixtures/active-elements.html') .then(() => { - cy.$$('
clearly not a focusable element
') .appendTo(cy.$$('body')) @@ -521,9 +506,7 @@ describe('polyfill programmatic blur events', () => { el1[0].focus() expect(stub).not.called - }) - }) }) @@ -548,7 +531,6 @@ describe('intercept blur methods correctly', () => { .should('have.focus') cy.wait(0).get('@selectionchange').should('not.be.called') - }) it('focus