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