@@ -356,6 +356,58 @@ def drag_block(block, before_block):
356356 assert message .get_attribute ("class" ) == "alert alert-info"
357357
358358
359+ def test_dag_grader_indentation (selenium_utils_get ):
360+ selenium_utils_get .wait_until_ready ("test_parsons_dag_indent" )
361+
362+ source = selenium_utils_get .driver .find_element (By .ID , "parsons-7-source" )
363+ answer = selenium_utils_get .driver .find_element (By .ID , "parsons-7-answer" )
364+ checkme = selenium_utils_get .driver .find_element (By .ID , "parsons-7-check" )
365+ reset = selenium_utils_get .driver .find_element (By .ID , "parsons-7-reset" )
366+
367+ def drag_to_answer (blockNum ):
368+ targetLoc = answer .location
369+ block = source .find_element (By .ID , "parsons-7-block-" + str (blockNum ))
370+ xOffset = answer .location ["x" ] - block .location ["x" ] + 1
371+ yOffset = answer .location ["y" ] - block .location ["y" ] + 1
372+ ActionChains (selenium_utils_get .driver ).drag_and_drop_by_offset (
373+ block , xOffset , yOffset
374+ ).perform ()
375+
376+ reset .click ()
377+
378+ for i in range (5 , - 1 , - 1 ):
379+ element = source .find_element (By .ID , "parsons-7-block-" + str (i ))
380+ drag_to_answer (i )
381+ checkme .click ()
382+
383+ message = selenium_utils_get .driver .find_element (By .ID , "parsons-7-message" )
384+ assert "alert-danger" in message .get_attribute ("class" )
385+
386+ checkme .click ()
387+ b1 = answer .find_element (By .ID , "parsons-7-block-1" )
388+ b2 = answer .find_element (By .ID , "parsons-7-block-2" )
389+ b4 = answer .find_element (By .ID , "parsons-7-block-4" )
390+ assert "indentRight" in b1 .get_attribute ("class" )
391+ assert "indentRight" in b2 .get_attribute ("class" )
392+ assert "indentRight" in b4 .get_attribute ("class" )
393+
394+ ActionChains (selenium_utils_get .driver ).drag_and_drop_by_offset (
395+ answer .find_element (By .ID , "parsons-7-block-1" ), 10 , 0
396+ ).perform ()
397+ ActionChains (selenium_utils_get .driver ).drag_and_drop_by_offset (
398+ answer .find_element (By .ID , "parsons-7-block-2" ), 60 , 0
399+ ).perform ()
400+ ActionChains (selenium_utils_get .driver ).drag_and_drop_by_offset (
401+ answer .find_element (By .ID , "parsons-7-block-4" ), 10 , 0
402+ ).perform ()
403+ wait_for_animation (selenium_utils_get , "#parsons-7-block-4" )
404+
405+ checkme .click ()
406+ assert "indentRight" not in b1 .get_attribute ("class" )
407+ assert "indentRight" not in b2 .get_attribute ("class" )
408+ assert "indentRight" not in b4 .get_attribute ("class" )
409+
410+
359411def wait_for_animation (selenium_utils , selector ):
360412 while is_element_animated (selenium_utils , selector ):
361413 time .sleep (0.5 )
0 commit comments