@@ -205,7 +205,7 @@ describe('Training Keyboard Shortcuts Tests', () => {
205205 cy . get ( '[data-cy="trainingSearchDialog"]' ) . should ( 'be.visible' )
206206 } )
207207
208- it ( 'search dialog honers custom labels' , ( ) => {
208+ it ( 'search dialog honors custom labels' , ( ) => {
209209 cy . createProject ( 1 ) ;
210210 cy . createSubject ( 1 , 1 ) ;
211211 cy . createSkill ( 1 , 1 , 1 ) ;
@@ -234,5 +234,60 @@ describe('Training Keyboard Shortcuts Tests', () => {
234234 cy . get ( '[data-cy="subjectName"]' ) . first ( ) . should ( 'have.text' , "Course: Subject 1" ) ;
235235 } ) ;
236236
237+ it ( 'client-display: training-wide search dialog is visible and displayed with position=top when in client-display iframe' , ( ) => {
238+ cy . createProject ( 1 )
239+ cy . createSubject ( 1 , 1 )
240+ cy . createSkill ( 1 , 1 , 1 )
241+ cy . createSkill ( 1 , 1 , 2 )
242+ cy . createSkill ( 1 , 1 , 3 )
243+ cy . createBadge ( 1 , 1 ) ;
244+ cy . assignSkillToBadge ( 1 , 1 , 1 ) ;
245+ cy . createBadge ( 1 , 1 , { enabled : true } ) ;
246+
247+ cy . visit ( '/test-skills-client/proj1' )
248+ cy . wrapIframe ( ) . contains ( 'Overall Points' ) ;
249+
250+ cy . wrapIframe ( ) . find ( '[data-cy="skillsDisplaySearchBtn"]' ) . click ( )
251+ cy . wait ( 1000 )
252+ cy . wrapIframe ( ) . find ( '[data-cy="trainingSearchDialog"]' ) . should ( 'be.visible' )
253+ cy . wrapIframe ( ) . find ( '[data-cy="trainingSearchDialog"]' ) . first ( ) . then ( ( $el ) => {
254+ const bounding = $el [ 0 ] . getBoundingClientRect ( ) ;
255+ const windowWidth = Cypress . config ( 'viewportWidth' ) ;
256+ const windowHeight = Cypress . config ( 'viewportHeight' ) ;
257+
258+ expect ( bounding . top ) . to . be . gte ( 0 ) ;
259+ expect ( bounding . left ) . to . be . gte ( 0 ) ;
260+ expect ( bounding . right ) . to . be . lte ( windowWidth ) ;
261+ expect ( bounding . bottom ) . to . be . lte ( windowHeight ) ;
262+ } ) ;
263+ } )
264+
265+ it ( 'training-wide search dialog is visible and displayed with position=center when not in client-display iframe' , ( ) => {
266+ cy . createProject ( 1 )
267+ cy . createSubject ( 1 , 1 )
268+ cy . createSkill ( 1 , 1 , 1 )
269+ cy . createSkill ( 1 , 1 , 2 )
270+ cy . createSkill ( 1 , 1 , 3 )
271+ cy . createBadge ( 1 , 1 ) ;
272+ cy . assignSkillToBadge ( 1 , 1 , 1 ) ;
273+ cy . createBadge ( 1 , 1 , { enabled : true } ) ;
274+
275+ cy . visit ( '/progress-and-rankings/projects/proj1' ) ;
276+ cy . contains ( 'Overall Points' ) ;
277+
278+ cy . get ( '[data-cy="skillsDisplaySearchBtn"]' ) . click ( )
279+ cy . wait ( 1000 )
280+ cy . get ( '[data-cy="trainingSearchDialog"]' ) . should ( 'be.visible' )
281+ cy . get ( '[data-cy="trainingSearchDialog"]' ) . first ( ) . then ( ( $el ) => {
282+ const bounding = $el [ 0 ] . getBoundingClientRect ( ) ;
283+ const windowWidth = Cypress . config ( 'viewportWidth' ) ;
284+ const windowHeight = Cypress . config ( 'viewportHeight' ) ;
285+
286+ expect ( bounding . top ) . to . be . gte ( 0 ) ;
287+ expect ( bounding . left ) . to . be . gte ( 0 ) ;
288+ expect ( bounding . right ) . to . be . lte ( windowWidth ) ;
289+ expect ( bounding . bottom ) . to . be . lte ( windowHeight ) ;
290+ } ) ;
291+ } )
237292
238293} )
0 commit comments