-
Notifications
You must be signed in to change notification settings - Fork 88
/
unsafe-to-chain-command.js
56 lines (51 loc) · 1.4 KB
/
unsafe-to-chain-command.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'use strict'
const rule = require('../../../lib/rules/unsafe-to-chain-command')
const RuleTester = require('eslint').RuleTester
const ruleTester = new RuleTester()
const errors = [{ messageId: 'unexpected' }]
const parserOptions = { ecmaVersion: 6 }
ruleTester.run('action-ends-chain', rule, {
valid: [
{
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,
},
{
code: 'cy.submitBtn().click();',
parserOptions,
},
],
invalid: [
{
code: 'cy.get("new-todo").type("todo A{enter}").should("have.class", "active");',
parserOptions,
errors,
},
{
code: 'cy.get("new-todo").type("todo A{enter}").type("todo B{enter}");',
parserOptions,
errors,
},
{
code: 'cy.get("new-todo").focus().should("have.class", "active");',
parserOptions,
errors,
},
{
code: 'cy.get("new-todo").customType("todo A{enter}").customClick();',
options: [{ methods: ['customType', 'customClick'] }],
parserOptions,
errors,
},
{
code: 'cy.get("new-todo").customPress("Enter").customScroll();',
options: [{ methods: [/customPress/, /customScroll/] }],
parserOptions,
errors,
},
],
})