diff --git a/notebook/static/notebook/js/searchandreplace.js b/notebook/static/notebook/js/searchandreplace.js index 427fdbfda..c808668e0 100644 --- a/notebook/static/notebook/js/searchandreplace.js +++ b/notebook/static/notebook/js/searchandreplace.js @@ -163,7 +163,7 @@ define([ var allCellsButton = $('') .append($('').addClass('fa fa-arrows-v')) - .attr('id', 'allcells_id') + .attr('id', 'findreplace_allcells_btn') .attr('type', 'button') .addClass("btn btn-default btn-sm") .attr('data-toggle','button') @@ -180,7 +180,7 @@ define([ var search = $("") .addClass('form-control input-sm') - .attr('id', 'input_id') + .attr('id', 'findreplace_find_inp') .attr('placeholder',i18n.msg._('Find')); var findFormGroup = $('
').addClass('form-group'); @@ -196,7 +196,7 @@ define([ ) var replace = $("") - .attr('id', 'replace_id') + .attr('id', 'findreplace_replace_inp') .addClass('form-control input-sm') .attr('placeholder',i18n.msg._('Replace')); var replaceFormGroup = $('').addClass('form-group'); @@ -358,7 +358,7 @@ define([ buttons:{ 'Replace All':{ class: "btn-primary", click: function(event){onsubmit(event); return true;}, - id: "replaceall_id", + id: "findreplace_replaceall_btn", } }, open: function(){ diff --git a/notebook/tests/selenium/test_find_and_replace_apply_all.py b/notebook/tests/selenium/test_find_and_replace.py similarity index 91% rename from notebook/tests/selenium/test_find_and_replace_apply_all.py rename to notebook/tests/selenium/test_find_and_replace.py index 3365ece36..11143138c 100755 --- a/notebook/tests/selenium/test_find_and_replace_apply_all.py +++ b/notebook/tests/selenium/test_find_and_replace.py @@ -1,8 +1,7 @@ -import os import pytest -def test_find_and_replace_apply_all(notebook): +def test_find_and_replace(notebook): """ test find and replace on all the cells """ cell_0, cell_1, cell_2, cell_3 = "hello", "hellohello", "abc", "ello" @@ -16,7 +15,7 @@ def test_find_and_replace_apply_all(notebook): notebook.add_cell(index=3, content=cell_3); # replace the strings - notebook.find_and_replace(index=0, find_txt=find_str, replace_txt=replace_str, replace_all=True) + notebook.find_and_replace(index=0, find_txt=find_str, replace_txt=replace_str) # check content of the cells assert notebook.get_cell_contents(0) == cell_0.replace(find_str, replace_str) diff --git a/notebook/tests/selenium/utils.py b/notebook/tests/selenium/utils.py index b000185be..1960b200a 100644 --- a/notebook/tests/selenium/utils.py +++ b/notebook/tests/selenium/utils.py @@ -100,15 +100,15 @@ class Notebook: self.to_command_mode() self.current_cell = cell - def find_and_replace(self, index=0, find_txt='', replace_txt='', replace_all=False): + def find_and_replace(self, index=0, find_txt='', replace_txt=''): self.focus_cell(index) self.to_command_mode() self.body.send_keys('f') wait_for_selector(self.browser, "#find-and-replace", single=True) - self.browser.find_element_by_id("allcells_id").click() - self.browser.find_element_by_id("input_id").send_keys(find_txt) - self.browser.find_element_by_id("replace_id").send_keys(replace_txt) - self.browser.find_element_by_id("replaceall_id").click() + self.browser.find_element_by_id("findreplace_allcells_btn").click() + self.browser.find_element_by_id("findreplace_find_inp").send_keys(find_txt) + self.browser.find_element_by_id("findreplace_replace_inp").send_keys(replace_txt) + self.browser.find_element_by_id("findreplace_replaceall_btn").click() def convert_cell_type(self, index=0, cell_type="code"): # TODO add check to see if it is already present