Converted clipboard js to selenium and rename undeleted to conventional name

pull/4563/head
Emilio Talamante Lugo 7 years ago
parent f21650ed0c
commit 31fce8270a

@ -1,41 +0,0 @@
// Test
casper.notebook_test(function () {
this.append_cell('1');
this.append_cell('2');
this.append_cell('3');
this.append_cell('4');
this.append_cell('a5');
this.append_cell('b6');
this.append_cell('c7');
this.append_cell('d8');
this.then(function () {
// Copy/paste/cut
this.select_cell(1);
this.select_cell(3, false);
this.trigger_keydown('c'); // Copy
this.select_cell(6)
this.select_cell(7,false)
this.evaluate(function () {
$("#paste_cell_replace").click();
});
var expected_state = ['', '1', '2', '3', '4', 'a5', '1' ,'2' ,'3', 'd8'];
for (var i=1; i<expected_state.length; i++){
this.test.assertEquals(this.get_cell_text(i), expected_state[i],
'Verify that cell `' + i + '` has for content: `'+ expected_state[i] + '` found : ' + this.get_cell_text(i)
);
}
this.validate_notebook_state('paste-replace', 'command', 8)
});
});

@ -0,0 +1,29 @@
"""Tests clipboard by copying, cutting and pasting multiple cells"""
from selenium.webdriver.common.keys import Keys
from .utils import wait_for_selector, wait_for_xpath
def test_clipboard_multiselect(notebook):
# Cell contents setup
values = ['1', '2', '3', '4', '5a', '6b', '7c', '8d']
[notebook.append(i) for i in values]
assert notebook.get_cells_contents() == ['', '1', '2', '3', '4', '5a', '6b', '7c', '8d']
# Select the first 3 cells with value and replace the last 3
[notebook.body.send_keys(Keys.UP) for i in range(8)]
notebook.select_cell_range(1, 3)
notebook.body.send_keys("c")
notebook.select_cell_range(6, 8)
wait_for_xpath(notebook.browser, '//a[text()="Edit"]', single=True).click()
wait_for_selector(notebook.browser, '#paste_cell_replace', single=True).click()
assert notebook.get_cells_contents() == ['', '1', '2', '3', '4', '5a', '1', '2', '3']
# Select the last four cells, cut them and paste them below the first cell
notebook.select_cell_range(5, 8)
wait_for_selector(notebook.browser, '.fa-cut.fa', single=True).click()
[notebook.body.send_keys(Keys.UP) for i in range(8)]
notebook.body.send_keys("v")
assert notebook.get_cells_contents() == ['', '5a', '1', '2', '3', '1', '2', '3', '4']
Loading…
Cancel
Save