From f9c015302a7801171f11b55a3de3cfc94346bdb2 Mon Sep 17 00:00:00 2001 From: Nico Schedel Date: Thu, 31 Oct 2019 10:48:33 +0100 Subject: [PATCH] TT#68016 selenium: more cleanups in controller_admin controller_admin.t: - added better_scroll_to_element calls - removed "xpath" arguments in select_if_unselected calls. these are not necessary - corrected one xpath check Change-Id: I7b6ce79d4202327aa9df934e7b14a102a6922fd3 --- t/selenium/controller_admin.t | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/t/selenium/controller_admin.t b/t/selenium/controller_admin.t index f48861d995..73a7b37c64 100644 --- a/t/selenium/controller_admin.t +++ b/t/selenium/controller_admin.t @@ -32,7 +32,7 @@ diag("Try to create a new Administrator"); $d->find_element('Create Administrator', 'link_text')->click(); diag("Save without entering anything"); -$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath'); +$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input'); $d->find_element('//*[@id="save"]')->click(); diag("Check error messages"); @@ -45,12 +45,13 @@ $d->fill_element('//*[@id="reselleridtable_filter"]/label/input', 'xpath', 'this ok($d->find_element_by_css('#reselleridtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found'); $d->fill_element('//*[@id="reselleridtable_filter"]/label/input', 'xpath', $resellername); ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller found'); -$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath'); +$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input'); +$d->fill_element('//*[@id="login"]', 'xpath', $adminname); +$d->fill_element('//*[@id="password"]', 'xpath', $adminpwd); +$d->scroll_to_element($d->find_element('//*[@id="is_superuser"]')); $d->unselect_if_selected('//*[@id="show_passwords"]'); $d->unselect_if_selected('//*[@id="call_data"]'); $d->unselect_if_selected('//*[@id="billing_data"]'); -$d->fill_element('//*[@id="login"]', 'xpath', $adminname); -$d->fill_element('//*[@id="password"]', 'xpath', $adminpwd); $d->find_element('//*[@id="save"]')->click(); diag("Search Administrator"); @@ -68,7 +69,7 @@ diag("Edit Administrator details. Enable read-only setting"); $adminname = ("admin" . int(rand(100000)) . "test"); $d->move_and_click('//*[@id="administrator_table"]//tr[1]/td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="administrator_table_filter"]/label/input'); $d->fill_element('//*[@id="login"]', 'xpath', $adminname); -$d->scroll_to_element($d->find_element('//form//div/label[contains(text(), "Read only")]')); +$d->scroll_to_element($d->find_element('//*[@id="is_superuser"]')); $d->select_if_unselected('//*[@id="read_only"]'); $d->find_element('//*[@id="save"]')->click(); @@ -91,7 +92,7 @@ $d->find_element('Administrators', 'link_text')->click(); diag("Check if only your Administrator is shown"); ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), '. $adminname .')]'), 'Name is correct'); ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), '. $resellername .')]'), 'Reseller is correct'); -ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[7][contains(text(), "1")]'), 'Read-Only value is correct'); +ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[6][contains(text(), "1")]'), 'Read-Only value is correct'); ok($d->find_element_by_xpath('//*[@id="administrator_table_info"][contains(text(), "Showing 1 to 1 of 1 entries")]'), 'Only 1 entry exists'); $d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'administrator'); ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Administrator table is empty'); @@ -123,6 +124,7 @@ ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css $d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname); ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname .'")]'), 'Administrator found'); $d->move_and_click('//*[@id="administrator_table"]//tr[1]/td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="administrator_table_filter"]/label/input'); +$d->scroll_to_element($d->find_element('//*[@id="is_superuser"]')); $d->find_element('//*[@id="is_active"]')->click(); $d->find_element('//*[@id="save"]')->click();