11/// <reference types="Cypress" />
22
3- context ( 'Form' , ( ) => {
3+ import { context , beforeEach , cy , it , expect } from 'cypress' ;
44
5+ context ( 'Form' , ( ) => {
56 beforeEach ( ( ) => {
6- cy . visit ( 'http://localhost:3000/' )
7- } )
7+ cy . visit ( 'http://localhost:3000/' ) ;
8+ } ) ;
89
910 it ( 'should change input values' , ( ) => {
1011 const nameText = 'John Deer' ;
@@ -17,24 +18,28 @@ context('Form', () => {
1718 cy . get ( '[id="#/properties/done-input"]' ) . uncheck ( ) ;
1819 cy . get ( '[id="#/properties/recurrence"] > div' ) . click ( ) ;
1920 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 ) ;
2124 cy . get ( '[id="#/properties/due_date-input"]' ) . clear ( ) . type ( dateText ) ;
2225 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 ) ;
2530
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' ) ;
2833
29- cy . get ( '[id="#/properties/recurrence_interval"]' ) . should ( 'exist' )
34+ cy . get ( '[id="#/properties/recurrence_interval"]' ) . should ( 'exist' ) ;
3035
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+ } ) ;
3843 } ) ;
3944
4045 it ( 'should show errors' , ( ) => {
@@ -49,12 +54,14 @@ context('Form', () => {
4954 cy . get ( '[id="#/properties/recurrence"] > div' ) . click ( ) ;
5055 cy . get ( '[data-value="Never"]' ) . click ( ) ;
5156
52- cy . get ( '[id="#/properties/recurrence_interval"]' ) . should ( 'not.exist' )
57+ cy . get ( '[id="#/properties/recurrence_interval"]' ) . should ( 'not.exist' ) ;
5358
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 ) ;
5663
57- expect ( data . due_date ) . to . equal ( 'Invalid date' ) ;
58- } ) ) ;
64+ expect ( data . due_date ) . to . equal ( 'Invalid date' ) ;
65+ } ) ;
5966 } ) ;
60- } )
67+ } ) ;
0 commit comments