diff --git a/lib/rules/unsafe-to-chain-command.js b/lib/rules/unsafe-to-chain-command.js index ac2e13d3..2ea527df 100644 --- a/lib/rules/unsafe-to-chain-command.js +++ b/lib/rules/unsafe-to-chain-command.js @@ -19,7 +19,7 @@ const unsafeToChainActions = [ 'check', 'dblclick', 'each', - 'focus', + 'focus$', 'rightclick', 'screenshot', 'scrollIntoView', diff --git a/tests/lib/rules/unsafe-to-chain-command.js b/tests/lib/rules/unsafe-to-chain-command.js index 2855b59a..c79b8e6e 100644 --- a/tests/lib/rules/unsafe-to-chain-command.js +++ b/tests/lib/rules/unsafe-to-chain-command.js @@ -14,6 +14,10 @@ ruleTester.run('action-ends-chain', rule, { code: 'cy.get("new-todo").type("todo A{enter}"); cy.get("new-todo").type("todo B{enter}"); cy.get("new-todo").should("have.class", "active");', parserOptions, }, + { + code: 'cy.focused().should("be.visible");', + parserOptions, + }, ], invalid: [ @@ -27,6 +31,11 @@ ruleTester.run('action-ends-chain', rule, { parserOptions, errors, }, + { + code: 'cy.get("new-todo").focus().should("have.class", "active");', + parserOptions, + errors, + }, { code: 'cy.get("new-todo").customType("todo A{enter}").customClick();', parserOptions,