@@ -45,50 +45,50 @@ describe('<Allocations />', () => {
4545 } ) ;
4646 const allocationRow = reportData . allocations [ 0 ] ;
4747 // check the test data matches the content displayed
48- cy . get ( '.q-table > tbody > tr > td:nth-child(1) > p:nth-child(1)' ) . should ( 'have.text' , allocationRow . licensee ) ;
49- cy . get ( '.q-table > tbody > tr > td:nth-child(1) > p:nth-child(2)' ) . should ( 'contain' , allocationRow . purpose ) . and ( 'contain' , allocationRow . stream_name ) ;
50- cy . get ( '.q-table > tbody > tr > td:nth-child(2) > p:nth-child(2)' ) . should ( 'contain' , 'File # ' + allocationRow . file_no )
51- cy . get ( '.q-table > tbody > tr > td:nth-child(3) > p:nth-child(1)' ) . should ( 'contain' , allocationRow . pod ) ;
52- cy . get ( '.q-table > tbody > tr > td:nth-child(3) > p:nth-child(2)' ) . should ( 'contain' , allocationRow . well_tag_number ) ;
53- cy . get ( '.q-table > tbody > tr > td:nth-child(4) > p:nth-child(1)' ) . then ( text => {
48+
49+ cy . get ( '[data-cy="license"] > p:nth-child(1)' ) . should ( 'have.text' , allocationRow . licensee ) ;
50+ cy . get ( '[data-cy="license"] > p:nth-child(2)' ) . should ( 'contain' , allocationRow . purpose ) . and ( 'contain' , allocationRow . stream_name ) ;
51+ cy . get ( '[data-cy="number"] > p:nth-child(2)' ) . should ( 'contain' , 'File # ' + allocationRow . file_no )
52+ cy . get ( '[data-cy="pod"] > p:nth-child(1)' ) . should ( 'contain' , allocationRow . pod ) ;
53+ cy . get ( '[data-cy="pod"] > p:nth-child(2)' ) . should ( 'contain' , allocationRow . well_tag_number ) ;
54+ cy . get ( '[data-cy="date"] > p:nth-child(1)' ) . then ( text => {
5455 assert ( text [ 0 ] . innerHTML . includes ( formatDate ( allocationRow . start_date , 'dd mmm yyyy' , ' ' ) ) ) ;
55- } )
56- cy . get ( '.q-table > tbody > tr > td:nth-child(4) > p:nth-child(1)' ) . should ( 'contain' , formatDate ( allocationRow . start_date , 'dd mmm yyyy' , ' ' ) ) ;
57- cy . get ( '.q-table > tbody > tr > td:nth-child(4) > p:nth-child(2)' ) . should ( 'contain' , formatDate ( allocationRow . priority_date , 'dd mmm yyyy' , ' ' ) ) ;
58- cy . get ( '.q-table > tbody > tr > td:nth-child(4) > p:nth-child(3)' ) . should ( 'contain' , formatDate ( allocationRow . expiry_date , 'dd mmm yyyy' , ' ' ) ) ;
59- cy . get ( '.q-table > tbody > tr > td:nth-child(4) > p:nth-child(4)' ) . should ( 'contain' , formatDate ( allocationRow . lic_status_date , 'dd mmm yyyy' , ' ' ) ) ;
60- cy . get ( '.q-table > tbody > tr > td:nth-child(5) ' ) . should ( 'contain' , "1,234.0" ) ;
61- cy . get ( '.q-table > tbody > tr > td:nth-child(6) ' ) . should ( 'contain' , allocationRow . qty_flag ) ;
62- cy . get ( '.q-table > tbody > tr > td:nth-child(7) > div' ) . should ( 'have.class' , allocationRow . lic_type ) ;
63- cy . get ( '.q-table > tbody > tr > td:nth-child(7) > div' ) . should ( 'contain' , allocationRow . lic_type ) ;
64- cy . get ( '.q-table > tbody > tr > td:nth-child(8) > .q-icon' ) . should ( 'have.class' , 'mdi-check-circle' ) . and ( 'have.class' , 'text-green-5' )
56+ } ) ;
57+ cy . get ( '[data-cy="date"] > p:nth-child(1)' ) . should ( 'contain' , formatDate ( allocationRow . start_date , 'dd mmm yyyy' , ' ' ) ) ;
58+ cy . get ( '[data-cy="date"] > p:nth-child(2)' ) . should ( 'contain' , formatDate ( allocationRow . priority_date , 'dd mmm yyyy' , ' ' ) ) ;
59+ cy . get ( '[data-cy="date"] > p:nth-child(3)' ) . should ( 'contain' , formatDate ( allocationRow . expiry_date , 'dd mmm yyyy' , ' ' ) ) ;
60+ cy . get ( '[data-cy="date"] > p:nth-child(4)' ) . should ( 'contain' , formatDate ( allocationRow . lic_status_date , 'dd mmm yyyy' , ' ' ) ) ;
61+ cy . get ( '[data-cy="quantity"] ' ) . should ( 'contain' , "1,234.0" ) ;
62+ cy . get ( '[data-cy="flag"] ' ) . should ( 'contain' , allocationRow . qty_flag ) ;
63+ cy . get ( '[data-cy="type"] > div' ) . should ( 'have.class' , allocationRow . lic_type ) ;
64+ cy . get ( '[data-cy="type"] > div' ) . should ( 'contain' , allocationRow . lic_type ) ;
65+ cy . get ( '[data-cy="status"] > .q-icon' ) . should ( 'have.class' , 'mdi-check-circle' ) . and ( 'have.class' , 'text-green-5' )
6566 } )
6667 it ( 'sets and resets filters' , ( ) => {
6768 cy . mount ( Allocations , {
6869 props : {
6970 reportContent : reportData
7071 }
7172 } ) ;
72- const allocationRow = reportData . allocations [ 0 ] ;
7373 // check value exists before filtering
74- cy . get ( '.q-table > tbody > tr > td:nth-child(5) ' ) . should ( 'contain' , "1,234.0" ) ;
74+ cy . get ( '[data-cy="quantity"] ' ) . should ( 'contain' , "1,234.0" ) ;
7575 cy . get ( '.mdi-filter' ) . click ( )
7676 cy . get ( '.q-checkbox__label' ) . contains ( 'Surface Water' ) . click ( )
77- cy . get ( '.q-table > tbody > tr > td:nth-child(5) ' ) . should ( 'not.exist' ) ;
77+ cy . get ( '[data-cy="quantity"] ' ) . should ( 'not.exist' ) ;
7878 cy . get ( '.q-checkbox__label' ) . contains ( 'Surface Water' ) . click ( )
79- cy . get ( '.q-table > tbody > tr > td:nth-child(5) ' ) . should ( 'contain' , "1,234.0" ) ;
79+ cy . get ( '[data-cy="quantity"] ' ) . should ( 'contain' , "1,234.0" ) ;
8080 cy . get ( '.q-checkbox__label' ) . contains ( 'Application' ) . click ( )
81- cy . get ( '.q-table > tbody > tr > td:nth-child(5) ' ) . should ( 'not.exist' ) ;
81+ cy . get ( '[data-cy="quantity"] ' ) . should ( 'not.exist' ) ;
8282 cy . get ( '.q-checkbox__label' ) . contains ( 'Application' ) . click ( ) ;
8383 cy . get ( '.q-checkbox__label' ) . contains ( 'Agriculture' ) . click ( ) ;
84- cy . get ( '.q-table > tbody > tr > td:nth-child(5) ' ) . should ( 'not.exist' ) ;
84+ cy . get ( '[data-cy="quantity"] ' ) . should ( 'not.exist' ) ;
8585 cy . get ( '.q-checkbox__label' ) . contains ( 'Agriculture' ) . click ( ) ;
86- cy . get ( '.q-table > tbody > tr > td:nth-child(5) ' ) . should ( 'contain' , "1,234.0" ) ;
86+ cy . get ( '[data-cy="quantity"] ' ) . should ( 'contain' , "1,234.0" ) ;
8787 cy . get ( 'input[placeholder="Text Search"]' ) . type ( 'TESTING' )
88- cy . get ( '.q-table > tbody > tr > td:nth-child(5) ' ) . should ( 'not.exist' ) ;
88+ cy . get ( '[data-cy="quantity"] ' ) . should ( 'not.exist' ) ;
8989 cy . get ( 'input[placeholder="Text Search"]' ) . clear ( )
9090 cy . get ( 'input[placeholder="Text Search"]' ) . type ( 'Cypress' )
91- cy . get ( '.q-table > tbody > tr > td:nth-child(5) ' ) . should ( 'contain' , "1,234.0" ) ;
91+ cy . get ( '[data-cy="quantity"] ' ) . should ( 'contain' , "1,234.0" ) ;
9292 cy . get ( 'span' ) . contains ( 'Reset Filters' ) . click ( ) ;
9393 cy . get ( 'input[placeholder="Text Search"]' ) . should ( 'have.value' , '' ) ;
9494 } )
0 commit comments