Skip to content

Commit c613ca7

Browse files
committed
change move_to_location function to move_by_offest
1 parent 2aec818 commit c613ca7

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

tests/test_interactions.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,7 @@ def test_cyin007_click_twice(dash_duo):
344344

345345

346346
def test_cyin008_ctx_menu_remove_node(dash_duo):
347-
init_pos, actions, _ = create_app(dash_duo)
348-
init_x, init_y = init_pos["Node 1"]
347+
_, actions, _ = create_app(dash_duo)
349348

350349
# Open the Drag data JSON tab
351350
actions.move_to_element(dash_duo.find_element("#tabs > div:nth-child(5)"))
@@ -357,7 +356,7 @@ def test_cyin008_ctx_menu_remove_node(dash_duo):
357356
nb_elements_before = len(json.loads(elements.text))
358357

359358
# move mouse to first node and right click and click on remove
360-
actions.move_to_location(init_x, init_y)
359+
actions.move_by_offset(-1170, 130)
361360
actions.context_click()
362361
actions.move_to_element(dash_duo.find_element("button#remove"))
363362
actions.click()
@@ -372,9 +371,7 @@ def test_cyin008_ctx_menu_remove_node(dash_duo):
372371

373372

374373
def test_cyin009_ctx_menu_remove_edge(dash_duo):
375-
_, actions, edge_positions = create_app(dash_duo)
376-
print(edge_positions)
377-
init_x, init_y = edge_positions["Edge from Node 1 to Node 2"]
374+
_, actions, _ = create_app(dash_duo)
378375

379376
# Open the Drag data JSON tab
380377
actions.move_to_element(dash_duo.find_element("#tabs > div:nth-child(5)"))
@@ -386,7 +383,7 @@ def test_cyin009_ctx_menu_remove_edge(dash_duo):
386383
nb_elements_before = len(json.loads(elements.text))
387384

388385
# move mouse to an edge and right click and click on remove
389-
actions.move_to_location(init_x, init_y)
386+
actions.move_by_offset(-1100, 150)
390387
actions.context_click()
391388
actions.move_to_element(dash_duo.find_element("button#remove"))
392389
actions.click()
@@ -413,7 +410,7 @@ def test_cyin010_ctx_menu_add_node(dash_duo):
413410
nb_elements_before = len(json.loads(elements.text))
414411

415412
# click anywhere to add a node
416-
actions.move_to_location(10, 10)
413+
actions.move_by_offset(-1000, 40)
417414
actions.context_click()
418415
actions.move_to_element(dash_duo.find_element("button#add-node"))
419416
actions.click()
@@ -428,9 +425,7 @@ def test_cyin010_ctx_menu_add_node(dash_duo):
428425

429426

430427
def test_cyin011_ctx_menu_add_edge(dash_duo):
431-
init_pos, actions, _ = create_app(dash_duo)
432-
node1_x, node1_y = init_pos["Node 1"]
433-
node2_x, node2_y = init_pos["Node 4"]
428+
_, actions, _ = create_app(dash_duo)
434429

435430
# Open the Drag data JSON tab
436431
actions.move_to_element(dash_duo.find_element("#tabs > div:nth-child(5)"))
@@ -443,9 +438,9 @@ def test_cyin011_ctx_menu_add_edge(dash_duo):
443438

444439
# click on 2 nodes to add an edge between them
445440
actions.key_down(Keys.COMMAND)
446-
actions.move_by_offset(node1_x, node1_y)
441+
actions.move_by_offset(-1170, 130)
447442
actions.click()
448-
actions.move_by_offset(node2_x, node2_y)
443+
actions.move_by_offset(400, 0)
449444
actions.click()
450445
actions.context_click()
451446
actions.move_to_element(dash_duo.find_element("button#add-edge"))

0 commit comments

Comments
 (0)