11/// <reference types="cypress" />
22
33describe ( 'Text Compare App' , ( ) => {
4+ const delay = 1000 ; // 1 second
5+
46 beforeEach ( ( ) => {
5- cy . visit ( 'https://text-compare.netlify.app/' ) ;
7+ cy . visit ( '/' ) ;
8+ cy . wait ( delay ) ; // wait 1 second before running each test
69 } ) ;
710
811 it ( 'should display the app name on the home page' , ( ) => {
9- cy . visit ( '/' ) ;
1012 cy . contains ( 'Text Compare' ) ;
1113 cy . contains ( 'Netlify' ) ;
1214 cy . get ( 'h1' ) . should ( 'contain.text' , 'Text Compare' ) ;
1315 } ) ;
1416
1517 it ( 'should display two text boxes and a compare button' , ( ) => {
16- cy . visit ( '/' ) ;
1718 cy . get ( '#editor1' ) . should ( 'be.visible' ) ;
1819 cy . get ( '#editor2' ) . should ( 'be.visible' ) ;
1920 cy . contains ( 'button' , 'Compare' ) . should ( 'be.visible' ) ;
@@ -23,8 +24,8 @@ describe('Text Compare App', () => {
2324 const left = 'Hello World' ;
2425 const right = 'Hello world' ;
2526
26- cy . get ( '#editor1' ) . clear ( ) . type ( left ) ;
27- cy . get ( '#editor2' ) . clear ( ) . type ( right ) ;
27+ cy . get ( '#editor1' ) . clear ( ) . type ( left , { delay : 200 } ) ; // 200ms between keystrokes
28+ cy . get ( '#editor2' ) . clear ( ) . type ( right , { delay : 200 } ) ;
2829
2930 cy . contains ( 'button' , 'Compare' ) . click ( ) ;
3031 cy . get ( '#diffeditor' ) . should ( 'be.visible' ) ;
0 commit comments