@@ -22,38 +22,38 @@ describe('Example 35 - Row Based Editing', () => {
2222
2323 it ( 'should only allow to toggle a single row into editmode on single mode' , ( ) => {
2424 cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( ) ;
25- cy . get ( '.action-btns--edit' ) . eq ( 1 ) . click ( ) ;
25+ cy . get ( '.action-btns--edit:nth(0) ' ) . click ( { force : true } ) ;
2626
2727 cy . get ( '.slick-row.slick-rbe-editmode' ) . should ( 'have.length' , 1 ) ;
2828 } ) ;
2929
3030 it ( 'should allow to toggle a multiple rows into editmode on multiple mode' , ( ) => {
3131 cy . reload ( ) ;
3232 cy . get ( '[data-test="single-multi-toggle"]' ) . click ( ) ;
33- cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( ) ;
34- cy . get ( '.action-btns--edit' ) . eq ( 1 ) . click ( ) ;
35- cy . get ( '.action-btns--edit' ) . eq ( 2 ) . click ( ) ;
33+ cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( { force : true } ) ;
34+ cy . get ( '.action-btns--edit' ) . eq ( 1 ) . click ( { force : true } ) ;
35+ cy . get ( '.action-btns--edit' ) . eq ( 2 ) . click ( { force : true } ) ;
3636
3737 cy . get ( '.slick-row.slick-rbe-editmode' ) . should ( 'have.length' , 3 ) ;
3838 } ) ;
3939
4040 it ( 'should not display editor in rows not being in editmode' , ( ) => {
4141 cy . reload ( ) ;
42- cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l2.r2` ) . click ( ) ;
42+ cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l2.r2` ) . click ( { force : true } ) ;
4343
4444 cy . get ( 'input' ) . should ( 'have.length' , 0 ) ;
4545
46- cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( ) ;
46+ cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( { force : true } ) ;
4747
48- cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l2.r2` ) . click ( ) ;
48+ cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l2.r2` ) . click ( { force : true } ) ;
4949
5050 cy . get ( 'input' ) . should ( 'have.length' , 1 ) ;
5151 } ) ;
5252
5353 it ( 'should highlight modified cells and maintain proper index on sorting' , ( ) => {
5454 cy . reload ( ) ;
5555
56- cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( ) ;
56+ cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( { force : true } ) ;
5757
5858 cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l0.r0` ) . click ( ) . type ( 'abc{enter}' ) ;
5959 cy . get ( '.slick-cell' ) . first ( ) . should ( 'have.class' , 'slick-rbe-unsaved-cell' ) ;
@@ -66,7 +66,7 @@ describe('Example 35 - Row Based Editing', () => {
6666 it ( 'should stay in editmode if saving failed' , ( ) => {
6767 cy . reload ( ) ;
6868
69- cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( ) ;
69+ cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( { force : true } ) ;
7070
7171 cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l1.r1` ) . click ( ) . type ( '50{enter}' ) ;
7272 cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l2.r2` ) . click ( ) . type ( '50' ) ;
@@ -83,12 +83,12 @@ describe('Example 35 - Row Based Editing', () => {
8383 it ( 'should save changes on update button click' , ( ) => {
8484 cy . reload ( ) ;
8585
86- cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( ) ;
86+ cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( { force : true } ) ;
8787
8888 cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l1.r1` ) . click ( ) . type ( '30{enter}' ) ;
8989 cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l2.r2` ) . type ( '30' ) ;
9090
91- cy . get ( '.action-btns--update' ) . first ( ) . click ( ) ;
91+ cy . get ( '.action-btns--update' ) . first ( ) . click ( { force : true } ) ;
9292
9393 cy . get ( '[data-test="fetch-result"]' )
9494 . should ( 'contain' , 'success' ) ;
@@ -98,27 +98,27 @@ describe('Example 35 - Row Based Editing', () => {
9898 } ) ;
9999
100100 it ( 'should cleanup status when starting a new edit mode' , ( ) => {
101- cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( ) ;
101+ cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( { force : true } ) ;
102102
103103 cy . get ( '[data-test="fetch-result"]' ) . should ( 'be.empty' ) ;
104104
105- cy . get ( '.action-btns--cancel' ) . first ( ) . click ( ) ;
105+ cy . get ( '.action-btns--cancel' ) . first ( ) . click ( { force : true } ) ;
106106 } ) ;
107107
108108 it ( 'should revert changes on cancel click' , ( ) => {
109- cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( ) ;
109+ cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] .action-btns--edit` ) . click ( { force : true } ) ;
110110
111111 cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l1.r1` ) . click ( ) . type ( '50{enter}' ) ;
112112 cy . get ( `[style="top: ${ GRID_ROW_HEIGHT * 0 } px;"] > .slick-cell.l2.r2` ) . type ( '50{enter}' ) ;
113113
114- cy . get ( '.action-btns--cancel' ) . first ( ) . click ( ) ;
114+ cy . get ( '.action-btns--cancel' ) . first ( ) . click ( { force : true } ) ;
115115
116116 cy . get ( '.slick-cell.l1.r1' ) . first ( ) . should ( 'contain' , '30' ) ;
117117 cy . get ( '.slick-cell.l2.r2' ) . first ( ) . should ( 'contain' , '30' ) ;
118118 } ) ;
119119
120120 it ( 'should delete a row when clicking it' , ( ) => {
121- cy . get ( '.action-btns--delete' ) . first ( ) . click ( ) ;
121+ cy . get ( '.action-btns--delete' ) . first ( ) . click ( { force : true } ) ;
122122
123123 cy . on ( 'window:confirm' , ( ) => true ) ;
124124
@@ -143,20 +143,25 @@ describe('Example 35 - Row Based Editing', () => {
143143 cy . get ( '[data-test="toggle-language"]' ) . click ( ) ;
144144 cy . get ( '[data-test="selected-locale"]' ) . should ( 'contain' , 'fr.json' ) ;
145145
146- // this seems to be a bug in Cypress, it doesn't seem to be able to click on the button
147- // but at least it triggers a rerender, which makes it refetch the actual button instead of a cached one
148- cy . get ( '.action-btns--update' ) . first ( ) . click ( { force : true } ) ;
146+ cy . get ( '.action-btns--edit' ) . first ( ) . click ( { force : true } ) ;
149147
150- cy . get ( '.action-btns--update' )
151- . first ( )
152- . should ( ( $btn ) => {
153- expect ( $btn . attr ( 'title' ) ) . to . equal ( 'Mettre à jour la ligne actuelle' ) ;
154- } ) ;
148+ cy . get ( '.action-btns--cancel' ) . first ( ) . as ( 'cancel-btn' ) ;
149+ cy . get ( '@cancel-btn' ) . should ( ( $btn ) => {
150+ expect ( $btn . attr ( 'title' ) ) . to . equal ( 'Annuler la ligne actuelle' ) ;
151+ } ) ;
152+ cy . get ( '@cancel-btn' ) . trigger ( 'mouseover' , { position : 'top' } ) ;
153+ cy . get ( '.slick-custom-tooltip' ) . should ( 'be.visible' ) ;
154+ cy . get ( '.slick-custom-tooltip .tooltip-body' ) . contains ( 'Annuler la ligne actuelle' ) ;
155155
156- cy . get ( '.action-btns--cancel' )
157- . first ( )
158- . should ( ( $btn ) => {
159- expect ( $btn . attr ( 'title' ) ) . to . equal ( 'Annuler la ligne actuelle' ) ;
160- } ) ;
156+ cy . get ( '.action-btns--update' ) . first ( ) . as ( 'update-btn' ) ;
157+ cy . get ( '@update-btn' ) . should ( ( $btn ) => {
158+ expect ( $btn . attr ( 'title' ) ) . to . equal ( 'Mettre à jour la ligne actuelle' ) ;
159+ } ) ;
160+
161+ cy . get ( '@update-btn' ) . trigger ( 'mouseover' , { position : 'top' } ) ;
162+
163+ cy . get ( '.slick-custom-tooltip' ) . should ( 'be.visible' ) ;
164+ cy . get ( '.slick-custom-tooltip .tooltip-body' ) . contains ( 'Mettre à jour la ligne actuelle' ) ;
165+ cy . get ( '@update-btn' ) . first ( ) . click ( { force : true } ) ;
161166 } ) ;
162- } ) ;
167+ } ) ;
0 commit comments