-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4142 from askerry/selenium_merge_cells
Migrate test for merge cells api to selenium
- Loading branch information
Showing
2 changed files
with
32 additions
and
43 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Tests the merge cell api.""" | ||
|
||
def test_merge_cells(notebook): | ||
# Add cells to notebook | ||
a = "foo = 5" | ||
b = "bar = 10" | ||
c = "print(foo)" | ||
d = "print(bar)" | ||
notebook.edit_cell(index=0, content=a) | ||
notebook.append(b, c, d) | ||
|
||
# Before merging, there are 4 separate cells | ||
assert notebook.get_cells_contents() == [a, b, c, d] | ||
|
||
# Focus on the second cell and merge it with the cell above | ||
notebook.focus_cell(1) | ||
notebook.browser.execute_script("Jupyter.notebook.merge_cell_above();") | ||
merged_a_b = "%s\n\n%s" % (a, b) | ||
assert notebook.get_cells_contents() == [merged_a_b, c, d] | ||
|
||
# Focus on the second cell and merge it with the cell below | ||
notebook.focus_cell(1) | ||
notebook.browser.execute_script("Jupyter.notebook.merge_cell_below();") | ||
merged_c_d = "%s\n\n%s" % (c, d) | ||
assert notebook.get_cells_contents() == [merged_a_b, merged_c_d] | ||
|
||
# Merge everything down to a single cell | ||
notebook.focus_cell(0) | ||
notebook.browser.execute_script("Jupyter.notebook.merge_cell_below();") | ||
merged_all = "%s\n\n%s" % (merged_a_b, merged_c_d) | ||
assert notebook.get_cells_contents() == [merged_all] | ||
|