Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Move multiselection test to selenium #5158

Merged
merged 3 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions notebook/tests/notebook/move_multiselection.js

This file was deleted.

47 changes: 47 additions & 0 deletions notebook/tests/selenium/test_move_multiselection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
INITIAL_CELLS = ['1', '2', '3', '4', '5', '6']
def test_move_multiselection(prefill_notebook):
notebook = prefill_notebook(INITIAL_CELLS)
def assert_oder(pre_message, expected_state):
for i in range(len(expected_state)):
assert expected_state[i] == notebook.get_cell_contents(i), f"{pre_message}: Verify that cell {i} has for content: {expected_state[i]} found: {notebook.get_cell_contents(i)}"

# Select 3 first cells
notebook.select_cell_range(0, 2)
notebook.browser.execute_script(
"Jupyter.notebook.move_selection_up();"
)
# Should not move up at top
assert_oder('move up at top', ['1', '2', '3', '4', '5','6'])

# We do not need to reselect, move/up down should keep the selection.
notebook.browser.execute_script(
"Jupyter.notebook.move_selection_down();"
)
notebook.browser.execute_script(
"Jupyter.notebook.move_selection_down();"
)
notebook.browser.execute_script(
"Jupyter.notebook.move_selection_down();"
)

# 3 times down should move the 3 selected cells to the bottom
assert_oder("move down to bottom", ['4', '5', '6', '1', '2', '3'])
notebook.browser.execute_script(
"Jupyter.notebook.move_selection_down();"
)

# They can't go any futher
assert_oder("move down to bottom", ['4', '5', '6', '1', '2', '3'])

notebook.browser.execute_script(
"Jupyter.notebook.move_selection_up();"
)
notebook.browser.execute_script(
"Jupyter.notebook.move_selection_up();"
)
notebook.browser.execute_script(
"Jupyter.notebook.move_selection_up();"
)

# Bring them back on top
assert_oder('move up at top', ['1', '2', '3', '4', '5','6'])
3 changes: 1 addition & 2 deletions notebook/tests/selenium/test_multiselect_toggle.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
INITIAL_CELLS = ['print("a")', 'print("b")', 'print("c")']

INITIAL_CELLS = ['print("a")', 'print("b")', 'print("c")']
def test_multiselect_toggle(prefill_notebook):
notebook = prefill_notebook(INITIAL_CELLS)

def extend_selection_by(delta):
notebook.browser.execute_script(
"Jupyter.notebook.extend_selection_by(arguments[0]);", delta)
Expand Down