1
1
/// <reference types="Cypress" />
2
2
3
- context ( 'Form' , ( ) => {
3
+ import { context , beforeEach , cy , it , expect } from 'cypress' ;
4
4
5
+ context ( 'Form' , ( ) => {
5
6
beforeEach ( ( ) => {
6
- cy . visit ( 'http://localhost:3000/' )
7
- } )
7
+ cy . visit ( 'http://localhost:3000/' ) ;
8
+ } ) ;
8
9
9
10
it ( 'should change input values' , ( ) => {
10
11
const nameText = 'John Deer' ;
@@ -17,24 +18,28 @@ context('Form', () => {
17
18
cy . get ( '[id="#/properties/done-input"]' ) . uncheck ( ) ;
18
19
cy . get ( '[id="#/properties/recurrence"] > div' ) . click ( ) ;
19
20
cy . get ( '[data-value="Monthly"]' ) . click ( ) ;
20
- cy . get ( '[id="#/properties/recurrence_interval-input"]' ) . clear ( ) . type ( recurrenceIntervalText ) ;
21
+ cy . get ( '[id="#/properties/recurrence_interval-input"]' )
22
+ . clear ( )
23
+ . type ( recurrenceIntervalText ) ;
21
24
cy . get ( '[id="#/properties/due_date-input"]' ) . clear ( ) . type ( dateText ) ;
22
25
cy . get ( '[id="#/properties/rating"] span:last' ) . click ( ) ;
23
- cy . get ( '[id="boundData"]' ) . invoke ( 'text' ) . then ( ( content => {
24
- const data = JSON . parse ( content ) ;
26
+ cy . get ( '[id="boundData"]' )
27
+ . invoke ( 'text' )
28
+ . then ( content => {
29
+ const data = JSON . parse ( content ) ;
25
30
26
- expect ( data . name ) . to . equal ( nameText ) ;
27
- cy . get ( '[id="#/properties/name"] p' ) . should ( 'be.empty' )
31
+ expect ( data . name ) . to . equal ( nameText ) ;
32
+ cy . get ( '[id="#/properties/name"] p' ) . should ( 'be.empty' ) ;
28
33
29
- cy . get ( '[id="#/properties/recurrence_interval"]' ) . should ( 'exist' )
34
+ cy . get ( '[id="#/properties/recurrence_interval"]' ) . should ( 'exist' ) ;
30
35
31
- expect ( data . description ) . to . equal ( descText ) ;
32
- expect ( data . done ) . to . equal ( false ) ;
33
- expect ( data . recurrence ) . to . equal ( 'Monthly' ) ;
34
- expect ( data . recurrence_interval ) . to . equal ( recurrenceIntervalText ) ;
35
- expect ( data . due_date ) . to . equal ( dateText ) ;
36
- expect ( data . rating ) . to . equal ( 5 ) ;
37
- } ) ) ;
36
+ expect ( data . description ) . to . equal ( descText ) ;
37
+ expect ( data . done ) . to . equal ( false ) ;
38
+ expect ( data . recurrence ) . to . equal ( 'Monthly' ) ;
39
+ expect ( data . recurrence_interval ) . to . equal ( recurrenceIntervalText ) ;
40
+ expect ( data . due_date ) . to . equal ( dateText ) ;
41
+ expect ( data . rating ) . to . equal ( 5 ) ;
42
+ } ) ;
38
43
} ) ;
39
44
40
45
it ( 'should show errors' , ( ) => {
@@ -49,12 +54,14 @@ context('Form', () => {
49
54
cy . get ( '[id="#/properties/recurrence"] > div' ) . click ( ) ;
50
55
cy . get ( '[data-value="Never"]' ) . click ( ) ;
51
56
52
- cy . get ( '[id="#/properties/recurrence_interval"]' ) . should ( 'not.exist' )
57
+ cy . get ( '[id="#/properties/recurrence_interval"]' ) . should ( 'not.exist' ) ;
53
58
54
- cy . get ( '[id="boundData"]' ) . invoke ( 'text' ) . then ( ( content => {
55
- const data = JSON . parse ( content ) ;
59
+ cy . get ( '[id="boundData"]' )
60
+ . invoke ( 'text' )
61
+ . then ( content => {
62
+ const data = JSON . parse ( content ) ;
56
63
57
- expect ( data . due_date ) . to . equal ( 'Invalid date' ) ;
58
- } ) ) ;
64
+ expect ( data . due_date ) . to . equal ( 'Invalid date' ) ;
65
+ } ) ;
59
66
} ) ;
60
- } )
67
+ } ) ;
0 commit comments