@@ -75,36 +75,122 @@ describe('DynamicDateRange Component', () => {
75
75
cy . get ( "@input" ) . should ( 'have.value' , 'Today' ) ;
76
76
} ) ;
77
77
78
- // Unstable test, needs investigation
79
- it . skip ( 'selects the Date option and updates the current value' , ( ) => {
80
- cy . window ( ) . then ( ( win ) => {
81
- cy . stub ( win . Date , 'now' ) . returns ( new Date ( 2025 , 4 , 15 ) . getTime ( ) ) ;
82
- } ) ;
83
78
84
- cy . get ( '[ui5-dynamic-date-range]' ) . as ( "ddr" ) ;
85
- cy . get ( "@ddr" ) . shadow ( ) . find ( '[ui5-input]' ) . as ( "input" ) ;
79
+ it ( 'selects the Date option and updates the current value' , ( ) => {
80
+ cy . get ( '[ui5-dynamic-date-range]' )
81
+ . as ( "ddr" ) ;
82
+
83
+ cy . get ( "@ddr" )
84
+ . shadow ( )
85
+ . find ( '[ui5-input]' )
86
+ . as ( "input" ) ;
86
87
87
- cy . get ( "@input" ) . should ( 'exist' ) ;
88
+ cy . get ( "@input" )
89
+ . should ( 'exist' ) ;
88
90
89
- cy . get ( "@input" ) . find ( '[ui5-icon]' ) . as ( "icon" ) ;
90
- cy . get ( "@icon" ) . realClick ( ) ;
91
-
92
- cy . get ( "@ddr" ) . shadow ( ) . find ( "[ui5-responsive-popover]" ) . as ( "popover" ) ;
93
- cy . get ( "@popover" ) . should ( 'exist' ) ;
91
+ cy . get ( "@input" )
92
+ . find ( '[ui5-icon]' )
93
+ . as ( "icon" ) ;
94
94
95
- cy . get ( "@popover" ) . find ( "[ui5-list]" ) . as ( "list" ) ;
96
- cy . get ( "@list" ) . find ( "[ui5-li]" ) . contains ( 'Date' ) . realClick ( ) ;
95
+ cy . get ( "@icon" )
96
+ . realClick ( ) ;
97
97
98
- cy . get ( "@popover" ) . find ( "[ui5-calendar]" ) . as ( "calendar" ) ;
99
- cy . get ( "@calendar" ) . should ( 'exist' ) ;
98
+ cy . get ( "@ddr" )
99
+ . shadow ( )
100
+ . find ( "[ui5-responsive-popover]" )
101
+ . as ( "popover" ) ;
102
+
103
+ cy . get ( "@popover" )
104
+ . should ( 'exist' ) ;
105
+
106
+ cy . get ( "@popover" )
107
+ . find ( "[ui5-list]" )
108
+ . as ( "list" ) ;
109
+
110
+ cy . get ( "@list" )
111
+ . find ( "[ui5-li]" )
112
+ . contains ( 'Date' )
113
+ . realClick ( ) ;
100
114
101
- cy . get ( "@calendar" ) . shadow ( ) . find ( "ui5-daypicker" ) . as ( "dayPicker" ) ;
102
- cy . get ( "@dayPicker" ) . shadow ( ) . find ( "div[data-sap-timestamp='1747785600']" ) . realClick ( ) ;
115
+ cy . get ( "@popover" )
116
+ . find ( "[ui5-calendar]" )
117
+ . as ( "calendar" ) ;
103
118
104
- cy . get ( "@popover" ) . find ( "[ui5-button][design='Emphasized']" ) . as ( "submitButton" ) ;
105
- cy . get ( "@submitButton" ) . should ( 'exist' ) . realClick ( ) ;
119
+ cy . get ( "@calendar" )
120
+ . should ( 'exist' ) ;
106
121
107
- cy . get ( "@input" ) . shadow ( ) . find ( "input" ) . should ( 'have.value' , 'May 21, 2025' ) ;
122
+ cy . realPress ( "Tab" ) ;
123
+ cy . realPress ( "Tab" ) ;
124
+ cy . realPress ( "Tab" ) ;
125
+
126
+ cy . get ( "@calendar" )
127
+ . shadow ( )
128
+ . find ( "[data-ui5-cal-header-btn-year='true']" )
129
+ . as ( "yearButton" ) ;
130
+
131
+ cy . get ( "@yearButton" )
132
+ . should ( "be.focused" ) ;
133
+
134
+ cy . realPress ( "Space" ) ;
135
+
136
+ cy . get ( "@calendar" )
137
+ . shadow ( )
138
+ . find ( "ui5-yearpicker" )
139
+ . as ( "yearPicker" ) ;
140
+
141
+ cy . get ( "@yearPicker" )
142
+ . shadow ( )
143
+ . find ( ".ui5-dp-yeartext" )
144
+ . contains ( '2035' )
145
+ . realClick ( ) ;
146
+
147
+ cy . realPress ( "Tab" ) ;
148
+ cy . realPress ( "Tab" ) ;
149
+
150
+ cy . get ( "@calendar" )
151
+ . shadow ( )
152
+ . find ( "[data-ui5-cal-header-btn-month='true']" )
153
+ . as ( "monthButton" ) ;
154
+
155
+ cy . get ( "@monthButton" )
156
+ . should ( "be.focused" ) ;
157
+
158
+ cy . realPress ( "Space" ) ;
159
+
160
+ cy . get ( "@calendar" )
161
+ . shadow ( )
162
+ . find ( "ui5-monthpicker" )
163
+ . as ( "monthPicker" ) ;
164
+
165
+ cy . get ( "@monthPicker" )
166
+ . shadow ( )
167
+ . find ( ".ui5-dp-monthtext" )
168
+ . contains ( 'May' )
169
+ . realClick ( ) ;
170
+
171
+ cy . get ( "@calendar" )
172
+ . shadow ( )
173
+ . find ( "ui5-daypicker" )
174
+ . as ( "dayPicker" ) ;
175
+
176
+ cy . get ( "@dayPicker" )
177
+ . shadow ( )
178
+ . find ( ".ui5-dp-daytext" )
179
+ . eq ( 22 ) // May 21, 2035 is the 21st day
180
+ . realClick ( ) ;
181
+
182
+ cy . get ( "@popover" )
183
+ . find ( "[ui5-button][design='Emphasized']" )
184
+ . as ( "submitButton" ) ;
185
+
186
+ cy . get ( "@submitButton" )
187
+ . should ( 'exist' )
188
+ . realClick ( ) ;
189
+
190
+ cy . get ( "@input" )
191
+ . shadow ( )
192
+ . find ( "input" )
193
+ . should ( 'have.value' , 'May 21, 2035' ) ;
108
194
} ) ;
109
195
110
196
it ( 'writes a date in the input and verifies it is selected in the calendar for the Date option' , ( ) => {
0 commit comments