From: dklawren Date: Tue, 4 Jun 2019 18:00:08 +0000 (-0400) Subject: Bug 1480469 - Upgrade Firefox on selenium tests X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c245d3123ed7253464081eebda9326d74a06c1b2;p=thirdparty%2Fbugzilla.git Bug 1480469 - Upgrade Firefox on selenium tests --- diff --git a/.circleci/checksetup_answers.legacy.txt b/.circleci/checksetup_answers.legacy.txt deleted file mode 100644 index 2a0486836..000000000 --- a/.circleci/checksetup_answers.legacy.txt +++ /dev/null @@ -1,11 +0,0 @@ -$answer{'ADMIN_EMAIL'} = 'admin@mozilla.bugs'; -$answer{'ADMIN_OK'} = 'Y'; -$answer{'ADMIN_PASSWORD'} = 'Te6Oovohch'; -$answer{'ADMIN_REALNAME'} = 'QA Admin'; -$answer{'NO_PAUSE'} = 1; -$answer{'bugzilla_version'} = '1'; -$answer{'create_htaccess'} = ''; -$answer{'cvsbin'} = '/usr/bin/cvs'; -$answer{'diffpath'} = '/usr/bin'; -$answer{'interdiffbin'} = '/usr/bin/interdiff'; -$answer{'utf8'} = 'utf8mb4'; diff --git a/.circleci/config.yml b/.circleci/config.yml index 9ef319400..e683f9842 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,6 +10,9 @@ defaults: image: mozillabteam/bmo-slim:20190404.1 user: app + selenium_firefox_image: &selenium_firefox_image + image: selenium/standalone-firefox:3.141.59 + mysql_image: &mysql_image image: mozillabteam/bmo-mysql:5.6 @@ -49,11 +52,10 @@ defaults: environment: <<: *bmo_env BZ_QA_CONF_FILE: /app/.circleci/selenium_test.conf - BZ_QA_ANSWERS_FILE: /app/.circleci/checksetup_answers.legacy.txt - BZ_QA_LEGACY_MODE: 1 + BZ_QA_ANSWERS_FILE: /app/.circleci/checksetup_answers.txt - <<: *mysql_image environment: *mysql_env - - image: selenium/standalone-firefox:2.53.1 + - <<: *selenium_firefox_image - image: memcached:latest default_qa_setup: &default_qa_setup @@ -223,7 +225,7 @@ jobs: - *default_qa_setup - run: | [[ -f build_info/only_version_changed.txt ]] && exit 0 - /app/scripts/entrypoint.pl load_test_data --legacy + /app/scripts/entrypoint.pl load_test_data - run: | [[ -f build_info/only_version_changed.txt ]] && exit 0 /app/scripts/entrypoint.pl test_selenium | tee artifacts/$CIRCLE_JOB.txt @@ -245,7 +247,7 @@ jobs: - <<: *mysql_image environment: *mysql_env - image: memcached:latest - - image: selenium/standalone-firefox:2.53.1 + - <<: *selenium_firefox_image steps: - checkout - attach_workspace: diff --git a/.circleci/selenium_test.conf b/.circleci/selenium_test.conf index 978ab6f5f..e70946239 100644 --- a/.circleci/selenium_test.conf +++ b/.circleci/selenium_test.conf @@ -16,7 +16,7 @@ 'host' => 'localhost', 'port' => 4444, 'browser_url' => 'http://bmo.test', - 'attachment_file' => 'https://raw.githubusercontent.com/mozilla-bteam/bmo/master/qa/config/patch.diff', + 'attachment_file' => '/app/qa/config/patch.diff', 'bugzilla_path' => '/app', 'test_bug_1' => 1, 'test_bug_2' => 2, diff --git a/Bugzilla/App/CGI.pm b/Bugzilla/App/CGI.pm index b35568710..3fc4c9130 100644 --- a/Bugzilla/App/CGI.pm +++ b/Bugzilla/App/CGI.pm @@ -42,6 +42,7 @@ sub setup_routes { $r->get('/__heartbeat__')->to('CGI#heartbeat_cgi'); $r->get('/robots.txt')->to('CGI#robots_cgi'); $r->any('/login')->to('CGI#index_cgi' => {'GoAheadAndLogIn' => '1'}); + $r->any('/logout')->to('CGI#index_cgi' => {'logout' => '1'}); $r->any('/:new_bug' => [new_bug => qr{new[-_]bug}])->to('CGI#new_bug_cgi'); } diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 09e3172a4..88cf7a307 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -3057,10 +3057,8 @@ sub _set_product { my $verified = $params->{product_change_confirmed}; -# BMO - if everything is ok then we can skip the verfication page when using bug_modal - if (Bugzilla->input_params->{format} - // '' eq 'modal' && !$verified && $component_ok && $version_ok && $milestone_ok) - { + # BMO - if everything is ok then we can skip the verfication page when using bug_modal + if (($params->{format} eq 'modal' || !$verified) && $component_ok && $version_ok && $milestone_ok) { $invalid_groups = $self->get_invalid_groups({bug_ids => \@idlist, product => $product}); my $has_invalid_group = 0; diff --git a/Bugzilla/Test/Selenium.pm b/Bugzilla/Test/Selenium.pm new file mode 100644 index 000000000..2a303f200 --- /dev/null +++ b/Bugzilla/Test/Selenium.pm @@ -0,0 +1,465 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::Test::Selenium; + +use 5.10.1; +use Bugzilla::Logging; +use Bugzilla::Util qw(trim); +use Mojo::File; +use Moo; +use Test2::V0; +use Test::Selenium::Remote::Driver; +use Try::Tiny; + +has 'driver_class' => (is => 'ro', default => 'Test::Selenium::Remote::Driver'); +has 'driver_args' => (is => 'ro', required => 1,); +has 'driver' => ( + is => 'lazy', + handles => [qw( + add_cookie + alert_text_like + get_all_cookies + get_ok + get_title + go_back_ok + refresh + title_is + title_isnt + title_like + )], +); + +sub click_ok { + my ($self, $locator, $arg1, $desc) = @_; + $arg1 ||= 'undefined'; + $desc ||= "Click ok: $locator"; + TRACE("click_ok: $locator, $arg1, $desc"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if (!$element) { + $locator =~ s/\@id/\@name/; + TRACE("click_ok new locator: $locator"); + } + $self->driver->click_element_ok($locator, 'xpath', $arg1, $desc); +} + +sub open_ok { + my ($self, $arg1, $arg2, $name) = @_; + $arg2 ||= 'undefined'; + $name ||= "open_ok: $arg1"; + TRACE("open_ok: $arg1, $arg2, $name"); + $self->get_ok($arg1, $name); +} + +sub type_ok { + my ($self, $locator, $text, $desc) = @_; + $desc ||= ''; + TRACE("type_ok: $locator, $text, $desc"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if (!$element) { + $locator =~ s/\@id/\@name/; + $element = $self->find_element($locator); + if (!$element) { + ok(0, $desc); + return; + } + } + $element->clear(); # Some fields have a default value + $self->driver->type_element_ok($locator, 'xpath', $text, $desc); +} + +sub wait_for_page_to_load_ok { + my ($self, $timeout) = @_; + TRACE("wait_for_page_to_load_ok: $timeout"); + ok($self->driver->set_timeout('page load', $timeout), + "Wait for page to load: $timeout"); +} + +sub wait_for_page_to_load { + my ($self, $timeout) = @_; + TRACE("wait_for_page_to_load: $timeout"); + $self->driver->set_timeout('page load', $timeout); +} + +sub is_text_present { + my ($self, $text) = @_; + TRACE("is_text_present: $text"); + return 0 unless $text; + my $body = $self->driver->get_body(); + if ($text =~ /^regexp:(.*)$/) { + return $body =~ /$1/ ? 1 : 0; + } + my $index = index $body, $text; + return ($index >= 0) ? 1 : 0; +} + +sub is_text_present_ok { + my ($self, $text) = @_; + TRACE("is_text_present_ok: $text"); + ok($self->is_text_present($text), "Text is present: $text"); +} + +sub find_element { + my ($self, $locator, $method) = @_; + $method ||= 'xpath'; + TRACE("find_element: $locator $method"); + try { + return $self->driver->find_element($locator, $method); + } + catch { + return undef; + }; +} + +sub is_element_present { + my ($self, $locator) = @_; + TRACE("is_element_present: $locator"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if (!$element) { + $locator =~ s/\@id/\@name/; + $element = $self->find_element($locator); + } + return $element; +} + +sub is_element_present_ok { + my ($self, $locator) = @_; + TRACE("is_element_present_ok: $locator"); + ok($self->is_element_present($locator), "Element is present: $locator"); +} + +sub is_enabled { + my ($self, $locator) = @_; + TRACE("is_enabled: $locator"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + return $element && $element->is_enabled ? 1 : 0; +} + +sub is_selected { + my ($self, $locator) = @_; + TRACE("is_selected: $locator"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if (!$element) { + $locator =~ s/\@id/\@name/; + $element = $self->find_element($locator); + } + return $element && $element->is_selected ? 1 : 0; +} + +sub get_body_text { + my ($self) = @_; + TRACE('get_body_text'); + return $self->driver->get_body(); +} + +sub get_value { + my ($self, $locator) = @_; + TRACE("get_value: $locator"); + $locator = $self->_fix_locator($locator, 'name'); + my $element = $self->find_element($locator); + if ($element) { + return $element->get_value(); + } + return ''; +} + +sub get_text { + my ($self, $locator) = @_; + TRACE("get_text: $locator"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if ($element) { + return $element->get_text(); + } + return ''; +} + +sub selected_label_is { + my ($self, $id, $label) = @_; + TRACE("selected_label_is: $id, $label"); + my $locator = qq{//select[\@id="$id"]}; + my $element = $self->find_element($locator); + if (!$element) { + $locator =~ s/\@id/\@name/; + $element = $self->find_element($locator); + } + my @options; + try { + @options = $self->driver->find_elements($locator . '/option'); + }; + foreach my $option (@options) { + my $text = trim($option->get_text()); + if ($text eq $label && $option->get_property('selected')) { + ok(1, "Selected label is: $label"); + return; + } + } + ok(0, "Selected label is: $label"); +} + +sub get_selected_labels { + my ($self, $locator) = @_; + TRACE("get_selected_labels: $locator"); + $locator = $self->_fix_locator($locator); + my @elements; + try { + @elements = $self->driver->find_elements($locator . '/option'); + }; + if (@elements) { + my @selected; + foreach my $element (@elements) { + next if !$element->is_selected(); + push @selected, $element->get_text(); + } + return @selected; + } + return undef; +} + +sub get_select_options { + my ($self, $locator) = @_; + TRACE("get_select_options: $locator"); + $locator = $self->_fix_locator($locator); + my @elements; + try { + @elements = $self->driver->find_elements($locator . '/option'); + }; + if (@elements) { + my @options; + foreach my $element (@elements) { + push @options, $element->get_text(); + } + return @options; + } + return undef; +} + +sub remove_all_selections { + my ($self, $id) = @_; + TRACE("remove_all_selections: $id"); + my $locator = $self->_fix_locator($id); + if ($self->find_element($locator)) { + $self->driver->execute_script( + 'document.getElementById(arguments[0]).selectedIndex = -1;', $id); + sleep(1); # FIXME: timing issue when running under CircleCI + return 1; + } + return 0; +} + +sub remove_all_selections_ok { + my ($self, $id) = @_; + TRACE("remove_all_selections_ok: $id"); + ok($self->remove_all_selections($id), "Remove all selections ok: $id"); +} + +sub is_checked { + my ($self, $locator) = @_; + TRACE("is_checked: $locator"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if (!$element) { + $locator =~ s/\@id/\@name/; + $element = $self->find_element($locator); + } + if ($element) { + return $element->is_selected() ? 1 : 0; + } + return 0; +} + +sub is_checked_ok { + my ($self, $locator) = @_; + TRACE("is_checked_ok: $locator"); + ok($self->is_checked($locator), "Is checked: $locator"); +} + +sub select_ok { + my ($self, $locator, $label) = @_; + TRACE("select_ok: $locator, $label"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if (!$element) { + $locator =~ s/\@id/\@name/; + $element = $self->find_element($locator); + } + my @options; + try { + @options = $self->driver->find_elements($locator . '/option'); + }; + my ($is_label, $is_value); + if ($label =~ /^label=(.*)$/) { + $label = $1; + $is_label = 1; + } + elsif ($label =~ /^value=(.*)$/) { + $label = $1; + $is_value = 1; + } + foreach my $option (@options) { + my $value; + if ($is_label) { + $value = $option->get_text(); + } + elsif ($is_value) { + $value = $option->get_value(); + } + else { + $value = $option->get_text(); + } + $value = trim($value); + if ($value eq $label) { + if ($option->get_property('selected')) { + ok(1, "Set selected: $label"); + } + else { + ok($option->click(), "Set selected: $label"); + } + return; + } + } + ok(0, "Set selected: $label"); +} + +sub check_ok { + my ($self, $locator) = @_; + TRACE("check_ok: $locator"); + ok($self->_toggle_check($locator, 1), "Check OK: $locator"); +} + +sub uncheck_ok { + my ($self, $locator) = @_; + TRACE("uncheck_ok: $locator"); + ok($self->_toggle_check($locator, 0), "Uncheck OK: $locator"); +} + +sub get_location { + my ($self) = @_; + TRACE('get_location'); + return $self->driver->get_current_url(); +} + +sub value_is { + my ($self, $locator, $value) = @_; + TRACE("value_is: $locator $value"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if (!$element) { + $locator =~ s/\@id/\@name/; + $element = $self->find_element($locator); + } + + # checkboxes + if ($value eq 'on') { + ok($element->is_selected(), 'Value is on'); + } + elsif ($value eq 'off') { + ok(!$element->is_selected(), 'Value is off'); + } + else { + # other + ok($element->get_value() eq $value, "Value is: $value"); + } +} + +sub get_attribute { + my ($self, $locator) = @_; + TRACE("get_attribute: $locator"); + my $attr; + ($locator, $attr) = ($locator =~ /(.*)@([^@]+)$/); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if ($element) { + return $element->get_attribute($attr); + } + return undef; +} + +sub submit { + my ($self, $locator) = @_; + TRACE("submit: $locator"); + $locator = $self->_fix_locator($locator); + $self->find_element($locator)->submit(); +} + +sub is_editable { + my ($self, $locator) = @_; + TRACE("is_editable: $locator"); + $locator = $self->_fix_locator($locator); + my $element = $self->find_element($locator); + if ($element) { + TRACE("is_editable found element"); + return $element->is_enabled() ? 1 : 0; + } + return 0; +} + +sub is_editable_ok { + my ($self, $locator) = @_; + TRACE("is_editable_ok: $locator"); + ok($self->is_editable($locator), "Is editable: $locator"); +} + +# Here we simply load the attachment text into the textarea of +# attachment page for Bugzilla or the enter bug page. We do this +# currently since Firefox is actually running in the Selenium +# container and not the same host as the test scripts. Therefore +# specifying the path the attachment file using the Browse button +# will not work as the file is not in the same container as Firefox. +sub attach_file { + my ($self, $locator, $filename) = @_; + my $path = Mojo::File->new($filename); + $self->type_ok('att-textarea', $path->slurp, 'Add attachment data'); +} + +# Private Helpers + +sub _build_driver { + my ($self) = @_; + $self->driver_class->new(%{$self->driver_args}); +} + +sub _fix_locator { + my ($self, $locator, $type) = @_; + $type ||= 'id'; + TRACE("_fix_locator old: $locator type: $type"); + if ($locator =~ /^link=(.*)$/) { + $locator = qq{//a[normalize-space(text())="$1"]}; + } + if ($locator =~ /^name=(.*)$/) { + $locator = qq{//input[\@name="$1"]}; + } + if ($locator !~ /^\/\//) { + $locator = qq{//*[\@$type="$locator"]}; + } + TRACE("_fix_locator new: $locator"); + return $locator; +} + +sub _toggle_check { + my ($self, $locator, $check) = @_; + $locator = $self->_fix_locator($locator, 'id'); + my $element = $self->find_element($locator); + if (!$element) { + $locator =~ s/\@id/\@name/; + $element = $self->find_element($locator); + } + if ($element) { + if (($check && !$element->is_selected) || (!$check && $element->is_selected)) { + $element->toggle(); + } + return 1; + } + return 0; +} + +1; diff --git a/extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl index ceb6e3b62..7d3638c33 100644 --- a/extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl @@ -15,7 +15,7 @@ [% FOREACH cc IN cc_list %]
- [% IF bug.user.canedit %] + [% IF bug.user.canedit OR bug.cc.contains(user.login) %] diff --git a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl index 548c33a36..973f7b2ed 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -1125,6 +1125,7 @@ [% WRAPPER bug_modal/field.html.tmpl container = 1 label = "Votes" + name = "votes" help = "https://wiki.mozilla.org/BMO/UserGuide/BugFields#votes" %] [% bug.votes FILTER html %] diff --git a/qa/config/generate_test_data.pl b/qa/config/generate_test_data.pl index 895a08386..3cfd0d8d1 100644 --- a/qa/config/generate_test_data.pl +++ b/qa/config/generate_test_data.pl @@ -753,7 +753,7 @@ foreach my $flag (@flagtypes) { ########################################################################## my @fields = ( { - name => 'cf_QA_status', + name => 'cf_qa_status', description => 'QA Status', type => FIELD_TYPE_MULTI_SELECT, sortkey => 100, @@ -790,8 +790,7 @@ foreach my $f (@fields) { # that 'values' is not an existing column name. delete $f->{values}; } - Bugzilla::Field->create($f); - my $field = Bugzilla::Field->new({name => $f->{name}}); + my $field = Bugzilla::Field->create($f); # Now populate the table with valid values, if necessary. next unless scalar @values; diff --git a/qa/config/selenium_test.conf b/qa/config/selenium_test.conf index f76afb671..7c9cc9fd7 100644 --- a/qa/config/selenium_test.conf +++ b/qa/config/selenium_test.conf @@ -16,7 +16,7 @@ 'host' => 'localhost', 'port' => 4444, 'browser_url' => 'http://localhost', - 'attachment_file' => 'https://raw.githubusercontent.com/mozilla-bteam/bmo/master/qa/config/patch.diff', + 'attachment_file' => '/app/qa/config/patch.diff', 'bugzilla_path' => '/var/www/html/bmo', 'test_bug_1' => 1, 'test_bug_2' => 2, diff --git a/qa/t/archived/test_email_preferences.t b/qa/t/archived/test_email_preferences.t index d99f2b7a6..a9f7006e3 100644 --- a/qa/t/archived/test_email_preferences.t +++ b/qa/t/archived/test_email_preferences.t @@ -52,6 +52,7 @@ my @email_normal = ($config->{editbugs_user_login}); # Set admin Email Prefs (via link in footer) log_in($sel, $config, 'admin'); +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); diff --git a/qa/t/lib/QA/Util.pm b/qa/t/lib/QA/Util.pm index 394c29186..28ff07e57 100644 --- a/qa/t/lib/QA/Util.pm +++ b/qa/t/lib/QA/Util.pm @@ -16,7 +16,9 @@ use Test::WWW::Selenium; use MIME::Base64 qw(decode_base64); use Sys::Hostname qw(hostname); use Socket qw(inet_ntoa); -use WWW::Selenium::Util qw(server_is_running); +use Bugzilla::RNG; +use Bugzilla::Test::Selenium; +use Selenium::Firefox::Profile; use URI; use URI::QueryParam; @@ -62,7 +64,6 @@ use constant WAIT_TIME => 60000; use constant CONF_FILE => $ENV{BZ_QA_CONF_FILE} // "../config/selenium_test.conf"; use constant CHROME_MODE => 1; -use constant NDASH => chr(0x2013); ##################### # Utility Functions # @@ -71,7 +72,7 @@ use constant NDASH => chr(0x2013); sub random_string { my $size = shift || 30; # default to 30 chars if nothing specified return - join("", map { ('0' .. '9', 'a' .. 'z', 'A' .. 'Z')[rand 62] } (1 .. $size)); + join("", map { ('0' .. '9', 'a' .. 'z', 'A' .. 'Z')[Bugzilla::RNG::rand 62] } (1 .. $size)); } # Remove consecutive as well as leading and trailing whitespaces. @@ -118,18 +119,17 @@ sub get_selenium { my $chrome_mode = shift; my $config = get_config(); - if (!server_is_running) { - die "Selenium Server isn't running!"; - } + my $sel = Bugzilla::Test::Selenium->new({ + driver_args => { + base_url => $config->{browser_url}, + browser => 'firefox', + version => '', + javascript => 1 + } + }); - my $sel = Test::WWW::Selenium->new( - host => $config->{host}, - port => $config->{port}, - browser => $chrome_mode - ? $config->{experimental_browser_launcher} - : $config->{browser}, - browser_url => $config->{browser_url} - ); + $sel->driver->set_timeout('implicit', 600); + $sel->driver->set_timeout('page load', 60000); return ($sel, $config); } @@ -170,10 +170,9 @@ sub get_rpc_clients { ################################ sub go_to_home { - my ($sel, $config) = @_; - $sel->open_ok("/", - undef, "Go to the home page"); - $sel->set_speed(500); + my ($sel) = @_; + $sel->open_ok("/home", undef, "Go to the home page"); + $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bugzilla Main Page"); } @@ -181,7 +180,7 @@ sub screenshot_page { my ($sel, $filename) = @_; open my $fh, '>:raw', $filename or die "unable to write $filename: $!"; binmode $fh; - print $fh decode_base64($sel->capture_entire_page_screenshot_to_string()); + print $fh decode_base64($sel->driver->screenshot()); close $fh; } @@ -189,8 +188,7 @@ sub screenshot_page { sub log_in { my ($sel, $config, $user) = @_; - $sel->open_ok("/login", - undef, "Go to the home page"); + $sel->open_ok("/login", undef, "Go to the home page"); $sel->title_is("Log in to Bugzilla"); $sel->type_ok( "Bugzilla_login", @@ -210,8 +208,7 @@ sub log_in { # Log out. Will fail if you are not logged in. sub logout { my $sel = shift; - - $sel->click_ok("link=Log out", undef, "Logout"); + $sel->open_ok('/logout', undef, "Logout"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Logged Out"); } @@ -221,9 +218,19 @@ sub file_bug_in_product { my ($sel, $product, $classification) = @_; my $config = get_config(); + $sel->add_cookie('TUI', + 'expert_fields=1&history_query=1&people_query=1&information_query=1&custom_search_query=1' + ); + $classification ||= "Unclassified"; $sel->click_ok('//*[@class="link-file"]//a', undef, "Go create a new bug"); $sel->wait_for_page_to_load(WAIT_TIME); + + # Use normal bug form instead of helper + if ($sel->is_text_present('Switch to the advanced bug entry form')) { + $sel->click_ok('//a[@id="advanced_link"]', undef, 'Switch to the advanced bug entry form'); + } + my $title = $sel->get_title(); if ($sel->is_text_present("Select Classification")) { ok(1, @@ -234,14 +241,13 @@ sub file_bug_in_product { } if ($sel->is_text_present("Which product is affected by the problem")) { ok(1, "Which product is affected by the problem"); - $sel->click_ok("link=Other Products", undef, "Choose full product list"); + $sel->click_ok('//a/span[contains(text(),"Other Products")]', undef, "Choose full product list"); $sel->wait_for_page_to_load(WAIT_TIME); $title = $sel->get_title(); } if ($sel->is_text_present($product)) { ok(1, "Display the list of enterable products"); - $sel->open_ok( - "/enter_bug.cgi?product=$product&format=__default__", + $sel->open_ok("/enter_bug.cgi?product=$product&format=__default__", undef, "Choose product $product" ); @@ -253,22 +259,16 @@ sub file_bug_in_product { ); } $sel->title_is("Enter Bug: $product", "Display form to enter bug data"); - - # Always make sure all fields are visible - if ($sel->is_element_present('//input[@value="Show Advanced Fields"]')) { - $sel->click_ok('//input[@value="Show Advanced Fields"]'); - } + sleep(1); # FIXME: Delay for slow page performance } sub create_bug { my ($sel, $bug_summary) = @_; - my $ndash = NDASH; - $sel->click_ok('commit'); $sel->wait_for_page_to_load_ok(WAIT_TIME); - my $bug_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); + my $bug_id = $sel->find_element('//input[@name="id" and @type="hidden"]')->get_value(); $sel->title_like( - qr/$bug_id $ndash( \(.*\))? $bug_summary/, + qr/$bug_id -( \(.*\))? $bug_summary/, "Bug $bug_id created with summary '$bug_summary'" ); return $bug_id; @@ -276,7 +276,7 @@ sub create_bug { sub edit_bug { my ($sel, $bug_id, $bug_summary, $options) = @_; - my $btn_id = $options ? $options->{id} : 'commit'; + my $btn_id = $options ? $options->{id} : 'bottom-save-btn'; $sel->click_ok($btn_id); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug_id"); @@ -284,30 +284,33 @@ sub edit_bug { sub edit_bug_and_return { my ($sel, $bug_id, $bug_summary, $options) = @_; - my $ndash = NDASH; edit_bug($sel, $bug_id, $bug_summary, $options); - $sel->click_ok("//a[contains(\@href, '/show_bug.cgi?id=$bug_id')]"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("$bug_id $ndash $bug_summary", "Returning back to bug $bug_id"); + go_to_bug($sel, $bug_id); } # Go to show_bug.cgi. sub go_to_bug { - my ($sel, $bug_id) = @_; + my ($sel, $bug_id, $no_edit) = @_; $sel->type_ok("quicksearch_top", $bug_id); - $sel->submit("header-search"); + $sel->driver->find_element('//*[@id="quicksearch_top"]')->submit; $sel->wait_for_page_to_load_ok(WAIT_TIME); + check_page_load($sel, + qq{http://HOSTNAME/show_bug.cgi?id=$bug_id}); my $bug_title = $sel->get_title(); utf8::encode($bug_title) if utf8::is_utf8($bug_title); $sel->title_like(qr/^$bug_id /, $bug_title); + sleep(1); # FIXME: Sometimes we try to click edit bug before it is ready so wait a second + $sel->click_ok('mode-btn-readonly', 'Click Edit Bug') if !$no_edit; + $sel->click_ok('action-menu-btn', 'Expand action menu'); + $sel->click_ok('action-expand-all', 'Expand all modal panels'); } # Go to admin.cgi. sub go_to_admin { my $sel = shift; - $sel->click_ok("link=Administration", undef, "Go to the Admin page"); + $sel->open_ok("/admin.cgi", undef, "Go to the Admin page"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_like(qr/^Administer your installation/, "Display admin.cgi"); } @@ -363,6 +366,9 @@ sub add_product { sub open_advanced_search_page { my $sel = shift; + $sel->add_cookie('TUI', + 'expert_fields=1&history_query=1&people_query=1&information_query=1&custom_search_query=1' + ); $sel->click_ok('//*[@class="link-search"]//a'); $sel->wait_for_page_to_load(WAIT_TIME); my $title = $sel->get_title(); @@ -371,7 +377,7 @@ sub open_advanced_search_page { $sel->click_ok("link=Advanced Search"); $sel->wait_for_page_to_load(WAIT_TIME); } - $sel->title_is("Search for bugs", "Display the Advanced search form"); + sleep(1); # FIXME: Delay for slow page performance } # $params is a hashref of the form: @@ -432,16 +438,24 @@ sub set_parameters { } } -my @ANY_KEYS = qw( t token ); +my @ANY_KEYS = qw( t token list_id ); sub check_page_load { - my ($sel, $wait, $expected) = @_; + my ($sel, $expected) = @_; + # FIXME: For some reason in some cases I need this otherwise + # it thinks it is still on the previous page + sleep(1); my $expected_uri = URI->new($expected); - $sel->wait_for_page_to_load_ok($wait); my $uri = URI->new($sel->get_location); foreach my $u ($expected_uri, $uri) { - $u->host('HOSTNAME'); + $u->host('HOSTNAME:8000'); + # Remove list id from newquery param + if ($u->query_param('newquery')) { + my $newquery = $u->query_param('newquery'); + $newquery =~ s/list_id=[^&]+//g; + $u->query_param(newquery => $newquery); + } foreach my $any_key (@ANY_KEYS) { if ($u->query_param($any_key)) { $u->query_param($any_key => '__ANYTHING__'); diff --git a/qa/t/test_bmo_autolinkification.t b/qa/t/test_bmo_autolinkification.t index e156720dc..ee947f563 100644 --- a/qa/t/test_bmo_autolinkification.t +++ b/qa/t/test_bmo_autolinkification.t @@ -26,32 +26,44 @@ $sel->title_like(qr/\d+ \S $bug_summary/, "Bug created"); my $bug_id = $sel->get_value("//input[\@name='id' and \@type='hidden']"); $sel->type_ok("comment", "bp-63f096f7-253b-4ee2-ae3d-8bb782090824"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/\d+ \S $bug_summary/, "crash report added"); $sel->click_ok("link=bug $bug_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->attribute_is('link=bp-63f096f7-253b-4ee2-ae3d-8bb782090824@href', +attribute_is($sel, 'bp-63f096f7-253b-4ee2-ae3d-8bb782090824', 'https://crash-stats.mozilla.org/report/index/63f096f7-253b-4ee2-ae3d-8bb782090824' ); $sel->type_ok("comment", "CVE-2010-2884"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/\d+ \S $bug_summary/, "cve added"); $sel->click_ok("link=bug $bug_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->attribute_is('link=CVE-2010-2884@href', + +attribute_is($sel, 'CVE-2010-2884', 'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-2884'); $sel->type_ok("comment", "r12345"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/\d+ \S $bug_summary/, "svn revision added"); $sel->click_ok("link=bug $bug_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->attribute_is('link=r12345@href', + +attribute_is($sel, 'r12345', 'https://viewvc.svn.mozilla.org/vc?view=rev&revision=12345'); logout($sel); +sub attribute_is { + my ($sel, $text, $href) = @_; + my $element = $sel->find_element(qq{//a[contains(text(),"$text")]}); + if ($element) { + ok($element->get_attribute('href') eq $href, "Attribute is: $href"); + return; + } + ok(0, "Attribute is: $href"); +} + diff --git a/qa/t/test_bmo_enter_new_bug.t b/qa/t/test_bmo_enter_new_bug.t index 3c3343292..bff6a2ec1 100644 --- a/qa/t/test_bmo_enter_new_bug.t +++ b/qa/t/test_bmo_enter_new_bug.t @@ -90,9 +90,7 @@ _check_product('Marketing'); _check_component('Marketing', 'Trademark Permissions'); _check_group('marketing-private'); -$sel->open_ok( - "/enter_bug.cgi?product=Marketing&format=trademark" -); +$sel->open_ok("/enter_bug.cgi?product=Marketing&format=trademark"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Trademark Usage Requests", "Open custom bug entry form - trademark"); @@ -181,9 +179,7 @@ _check_component('mozilla.org', 'Discussion Forums'); _check_version('mozilla.org', 'other'); _check_component('mozilla.org', 'Discussion Forums'); -$sel->open_ok( - "/enter_bug.cgi?product=mozilla.org&format=mozlist" -); +$sel->open_ok("/enter_bug.cgi?product=mozilla.org&format=mozlist"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Mozilla Discussion Forum", "Open custom bug entry form - mozlist"); @@ -233,8 +229,7 @@ _check_product('Legal'); _check_component('Legal', 'Contract Request'); _check_group('mozilla-employee-confidential'); -$sel->open_ok( - "/enter_bug.cgi?product=Legal&format=legal"); +$sel->open_ok("/enter_bug.cgi?product=Legal&format=legal"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Mozilla Corporation Legal Requests", "Open custom bug entry form - legal"); @@ -284,8 +279,8 @@ sub _check_product { $sel->type_ok("description", $product_description); $sel->type_ok("version", $version) if $version; $sel->select_ok("security_group_id", "label=core-security"); - $sel->select_ok("default_op_sys_id", "Unspecified"); - $sel->select_ok("default_platform_id", "Unspecified"); + $sel->select_ok("default_op_sys_id", "label=Unspecified"); + $sel->select_ok("default_platform_id", "label=Unspecified"); $sel->click_ok('//input[@type="submit" and @value="Add"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $text = trim($sel->get_text("message")); @@ -320,12 +315,6 @@ sub _check_component { return 1; } - # Add the watch user for component watching - my $watch_user = lc $component . "@" . lc $product . ".bugs"; - $watch_user =~ s/ & /-/; - $watch_user =~ s/\s+/\-/g; - $watch_user =~ s/://g; - go_to_admin($sel); $sel->click_ok("link=components"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -340,9 +329,6 @@ sub _check_component { $sel->type_ok("component", $component); $sel->type_ok("description", $component_description); $sel->type_ok("initialowner", $config->{'admin_user_login'}); - $sel->uncheck_ok("watch_user_auto"); - $sel->type_ok("watch_user", $watch_user); - $sel->check_ok("watch_user_auto"); $sel->click_ok('//input[@type="submit" and @value="Add"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Component Created"); diff --git a/qa/t/test_bmo_retire_values.t b/qa/t/test_bmo_retire_values.t index 14a5f5646..f8ca8b949 100644 --- a/qa/t/test_bmo_retire_values.t +++ b/qa/t/test_bmo_retire_values.t @@ -73,9 +73,6 @@ $sel->title_is("Add component to the TestProduct product"); $sel->type_ok("component", "TempComponent"); $sel->type_ok("description", "Temp component"); $sel->type_ok("initialowner", $admin_user_login); -$sel->uncheck_ok("watch_user_auto"); -$sel->type_ok("watch_user", 'tempcomponent@testproduct.bugs'); -$sel->check_ok("watch_user_auto"); $sel->click_ok('//input[@type="submit" and @value="Add"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Component Created"); @@ -121,16 +118,6 @@ go_to_bug($sel, $bug_id); # make sure the component is still tempcomponent $sel->selected_label_is("component", 'TempComponent'); -# update -$sel->click_ok("commit"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->is_text_present_ok("Changes submitted for bug $bug_id"); -$sel->click_ok("link=bug $bug_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); - -# make sure the component is still tempcomponent -ok($sel->get_selected_labels("component"), 'TempComponent'); - # try creating new bug with TempComponent file_bug_in_product($sel, "TestProduct"); @@ -247,18 +234,18 @@ go_to_bug($sel, $bug_id); $sel->selected_label_is("version", 'TempVersion'); # update -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug_id"); -$sel->click_ok("link=bug $bug_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); + +go_to_bug($sel, $bug_id); # make sure the version is still tempversion $sel->selected_label_is("version", 'TempVersion'); # change the version so it can be deleted $sel->select_ok("version", "label=unspecified"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug_id"); @@ -381,11 +368,11 @@ go_to_bug($sel, $bug_id); $sel->selected_label_is("target_milestone", 'TempMilestone'); # update -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug_id"); -$sel->click_ok("link=bug $bug_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); + +go_to_bug($sel, $bug_id); # make sure the milestone is still tempmilestone $sel->selected_label_is("target_milestone", 'TempMilestone'); diff --git a/qa/t/test_bug_edit.t b/qa/t/test_bug_edit.t index bf68a24aa..765a531bc 100644 --- a/qa/t/test_bug_edit.t +++ b/qa/t/test_bug_edit.t @@ -19,11 +19,15 @@ log_in($sel, $config, 'admin'); set_parameters($sel, {"Bug Fields" => {"usestatuswhiteboard-on" => undef}}); # Clear the saved search, in case this test didn't complete previously. -if ($sel->is_text_present("My bugs from QA_Selenium")) { - $sel->click_ok("link=My bugs from QA_Selenium"); +$sel->click_ok('quicksearch_top'); +if ($sel->is_element_present( + '//a[normalize-space(text())="My bugs from QA_Selenium" and @role="option"]')) +{ + $sel->click_ok( + '//a[normalize-space(text())="My bugs from QA_Selenium" and @role="option"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: My bugs from QA_Selenium"); - $sel->click_ok("link=Forget Search 'My bugs from QA_Selenium'"); + $sel->click_ok('forget-search', 'Forget Search'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search is gone"); $sel->is_text_present_ok("OK, the My bugs from QA_Selenium search is gone"); @@ -32,11 +36,11 @@ if ($sel->is_text_present("My bugs from QA_Selenium")) { # Just in case the test failed before completion previously, reset the CANEDIT bit. go_to_admin($sel); $sel->click_ok("link=Groups"); -check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/editgroups.cgi}); +check_page_load($sel, q{http://HOSTNAME/editgroups.cgi}); $sel->title_is("Edit Groups"); $sel->click_ok("link=Master"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/editgroups.cgi?action=changeform&group=25}); +check_page_load($sel, + q{http://HOSTNAME/editgroups.cgi?action=changeform&group=25}); $sel->title_is("Change Group: Master"); my $group_url = $sel->get_location(); $group_url =~ /group=(\d+)$/; @@ -54,84 +58,58 @@ $sel->select_ok("bug_severity", "label=critical"); $sel->type_ok("short_desc", "Test bug editing"); $sel->type_ok("comment", "ploc"); $sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=__BUG_ID__}); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=__BUG_ID__}); my $bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); $sel->is_text_present_ok('has been added to the database', "Bug $bug1_id created"); # Now edit field values of the bug you just filed. +go_to_bug($sel, $bug1_id); $sel->select_ok("rep_platform", "label=Other"); $sel->select_ok("op_sys", "label=Other"); $sel->select_ok("priority", "label=Highest"); -$sel->select_ok("bug_type", "label=defect"); +$sel->check_ok('//input[@name="bug_type" and @value="defect"]'); $sel->select_ok("bug_severity", "label=blocker"); $sel->type_ok("bug_file_loc", "foo.cgi?action=bar"); $sel->type_ok("status_whiteboard", "[Selenium was here]"); $sel->type_ok("comment", "new comment from me :)"); $sel->select_ok("bug_status", "label=RESOLVED"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); # Now move the bug into another product, which has a mandatory group. -$sel->click_ok("link=bug $bug1_id"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); -$sel->title_like(qr/^$bug1_id /); -$sel->select_ok("product", "label=QA-Selenium-TEST"); -$sel->type_ok("comment", "moving to QA-Selenium-TEST"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/process_bug.cgi}); -$sel->title_is("Verify New Product Details..."); +go_to_bug($sel, $bug1_id); +$sel->select_ok("product", "label=QA-Selenium-TEST"); $sel->select_ok("component", "label=QA-Selenium-TEST"); -$sel->is_element_present_ok( - '//input[@type="checkbox" and @name="groups" and @value="QA-Selenium-TEST"]'); -ok( - !$sel->is_editable( - '//input[@type="checkbox" and @name="groups" and @value="QA-Selenium-TEST"]'), - "QA-Selenium-TEST group not editable" -); -$sel->is_checked_ok( - '//input[@type="checkbox" and @name="groups" and @value="QA-Selenium-TEST"]', - "QA-Selenium-TEST group is selected"); -$sel->click_ok("change_product"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->type_ok("comment", "moving to QA-Selenium-TEST"); +$sel->click_ok('bottom-save-btn', 'Save changes'); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); -$sel->title_like(qr/^$bug1_id /); -$sel->select_ok("bug_type", "label=defect"); + +go_to_bug($sel, $bug1_id); +$sel->check_ok('//input[@name="bug_type" and @value="defect"]'); $sel->select_ok("bug_severity", "label=normal"); $sel->select_ok("priority", "label=High"); $sel->select_ok("rep_platform", "label=All"); $sel->select_ok("op_sys", "label=All"); -$sel->click_ok("cc_edit_area_showhide"); -$sel->type_ok("newcc", $config->{admin_user_login}); +$sel->click_ok("add-cc-btn", "Show add cc field"); +$sel->type_ok("add-cc", $config->{admin_user_login}); $sel->type_ok("comment", "Unchecking the reporter_accessible checkbox"); # This checkbox is checked by default. $sel->click_ok("reporter_accessible"); $sel->select_ok("bug_status", "label=VERIFIED"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); $sel->type_ok("comment", "I am the reporter, but I can see the bug anyway as I belong to the mandatory group" ); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); logout($sel); @@ -140,28 +118,22 @@ logout($sel); log_in($sel, $config, 'admin'); go_to_bug($sel, $bug1_id); -$sel->select_ok("bug_type", "label=defect"); +$sel->check_ok('//input[@name="bug_type" and @value="defect"]'); $sel->select_ok("bug_severity", "label=blocker"); $sel->select_ok("priority", "label=Highest"); $sel->type_ok("status_whiteboard", "[Selenium was here][admin too]"); $sel->select_ok("bug_status", "label=CONFIRMED"); -$sel->click_ok("bz_assignee_edit_action"); $sel->type_ok("assigned_to", $config->{admin_user_login}); $sel->type_ok("comment", "I have editbugs privs. Taking!"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); -$sel->title_like(qr/^$bug1_id /); -$sel->click_ok("cc_edit_area_showhide"); -$sel->type_ok("newcc", $config->{unprivileged_user_login}); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +go_to_bug($sel, $bug1_id); +$sel->click_ok("add-cc-btn", "Show add cc field"); +$sel->type_ok("add-cc", $config->{unprivileged_user_login}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); logout($sel); @@ -181,9 +153,8 @@ $sel->click_ok("cclist_accessible"); $sel->type_ok("comment", "I am allowed to turn off cclist_accessible despite not being in the mandatory group" ); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); logout($sel); @@ -191,9 +162,8 @@ logout($sel); log_in($sel, $config, 'unprivileged'); $sel->type_ok("quicksearch_top", $bug1_id); -$sel->submit("header-search"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->submit("quicksearch_top"); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->title_is("Access Denied"); $sel->is_text_present_ok("You are not authorized to access bug $bug1_id"); logout($sel); @@ -202,17 +172,17 @@ logout($sel); log_in($sel, $config, 'admin'); go_to_bug($sel, $bug1_id); -$sel->select_ok("product", "label=TestProduct"); +$sel->select_ok("product", "label=TestProduct"); +$sel->select_ok("component", "label=TestComponent"); # When selecting a new product, Bugzilla tries to reassign the bug by default, # so we have to uncheck it. -$sel->click_ok("set_default_assignee"); -$sel->uncheck_ok("set_default_assignee"); +$sel->click_ok("set-default-assignee"); +$sel->uncheck_ok("set-default-assignee"); $sel->type_ok("comment", "-> Moving back to Testproduct."); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/process_bug.cgi}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, q{http://HOSTNAME/process_bug.cgi}); $sel->title_is("Verify New Product Details..."); -$sel->select_ok("component", "label=TestComponent"); $sel->is_text_present_ok( "These groups are not legal for the 'TestProduct' product or you are not allowed to restrict bugs to these groups" ); @@ -239,20 +209,15 @@ ok( "Master group not selected by default" ); $sel->click_ok("change_product"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); $sel->click_ok("cclist_accessible"); $sel->type_ok("comment", "I am allowed to turn off cclist_accessible despite not being in the mandatory group" ); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); logout($sel); @@ -262,7 +227,7 @@ logout($sel); log_in($sel, $config, 'unprivileged'); go_to_bug($sel, $bug1_id); $sel->type_ok("comment", - "I have no privs, I can only comment (and remove people from the CC list)"); + "I have no privs, I can only comment (and remove myself from the CC list)"); ok(!$sel->is_element_present('//select[@name="product"]'), "Product field not editable"); ok(!$sel->is_element_present('//select[@name="bug_type"]'), @@ -275,12 +240,19 @@ ok(!$sel->is_element_present('//select[@name="op_sys"]'), "OS field not editable"); ok(!$sel->is_element_present('//select[@name="rep_platform"]'), "Hardware field not editable"); -$sel->click_ok("cc_edit_area_showhide"); -$sel->add_selection_ok("cc", "label=" . $config->{admin_user_login}); -$sel->click_ok("removecc"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->click_ok("cc-summary"); + +# display all links for removing a cc list member +$sel->driver->execute_script(' + var remove_cc_elements = document.getElementsByClassName("cc-remove"); + for (var i = 0; i < remove_cc_elements.length; i++) { + remove_cc_elements[i].removeAttribute("style"); + }'); +$sel->click_ok('//a[@class="cc-remove" and @data-login="' + . $config->{unprivileged_user_login} + . '"]'); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); logout($sel); @@ -289,22 +261,21 @@ logout($sel); log_in($sel, $config, 'admin'); edit_product($sel, "TestProduct"); $sel->click_ok("link=Edit Group Access Controls:"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/editproducts.cgi?action=editgroupcontrols&product=TestProduct} +check_page_load($sel, + q{http://HOSTNAME/editproducts.cgi?action=editgroupcontrols&product=TestProduct} ); $sel->title_is("Edit Group Controls for TestProduct"); $sel->check_ok("canedit_$master_gid"); $sel->click_ok("submit"); -check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/editproducts.cgi}); +check_page_load($sel, q{http://HOSTNAME/editproducts.cgi}); $sel->title_is("Update group access controls for TestProduct"); # The user is in the master group, so he can comment. go_to_bug($sel, $bug1_id); $sel->type_ok("comment", "Do nothing except adding a comment..."); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); logout($sel); @@ -313,8 +284,8 @@ logout($sel); log_in($sel, $config, 'QA_Selenium_TEST'); go_to_bug($sel, $bug1_id); $sel->type_ok("comment", "Just a comment too..."); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/process_bug.cgi}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, q{http://HOSTNAME/process_bug.cgi}); $sel->title_is("Product Edit Access Denied"); $sel->is_text_present_ok( "You are not permitted to edit bugs in product TestProduct."); @@ -326,37 +297,39 @@ log_in($sel, $config, 'admin'); open_advanced_search_page($sel); screenshot_page($sel, '/app/artifacts/line259.png'); $sel->remove_all_selections_ok("product"); -$sel->add_selection_ok("product", "TestProduct"); +$sel->select_ok("product", "label=TestProduct"); $sel->remove_all_selections_ok("bug_status"); $sel->remove_all_selections_ok("resolution"); screenshot_page($sel, '/app/artifacts/line264.png'); $sel->is_checked_ok("emailassigned_to1"); -$sel->select_ok("emailtype1", "label=is"); +$sel->select_ok("emailtype1", "value=exact"); $sel->type_ok("email1", $config->{admin_user_login}); $sel->check_ok("emailassigned_to2"); $sel->check_ok("emailqa_contact2"); $sel->check_ok("emailcc2"); -$sel->select_ok("emailtype2", "label=is"); +$sel->select_ok("emailtype2", "value=exact"); $sel->type_ok("email2", $config->{QA_Selenium_TEST_user_login}); screenshot_page($sel, '/app/artifacts/line271.png'); $sel->click_ok("Search"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/buglist.cgi?emailreporter2=1&emailtype2=exact&order=Importance&list_id=15&emailtype1=exact&emailcc2=1&query_format=advanced&emailassigned_to1=1&emailqa_contact2=1&email2=QA-Selenium-TEST%40mozilla.test&email1=admin%40mozilla.test&emailassigned_to2=1&product=TestProduct} +check_page_load($sel, + q{http://HOSTNAME/buglist.cgi?emailreporter2=1&emailtype2=exact&order=Importance&list_id=15&emailtype1=exact&emailcc2=1&query_format=advanced&emailassigned_to1=1&emailqa_contact2=1&email2=QA-Selenium-TEST%40mozilla.test&email1=admin%40mozilla.test&emailassigned_to2=1&product=TestProduct} ); $sel->title_is("Bug List"); screenshot_page($sel, '/app/artifacts/line275.png'); $sel->is_text_present_ok("One bug found."); $sel->type_ok("save_newqueryname", "My bugs from QA_Selenium"); $sel->click_ok("remember"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/buglist.cgi?newquery=email1%3Dadmin%2540mozilla.test%26email2%3DQA-Selenium-TEST%2540mozilla.test%26emailassigned_to1%3D1%26emailassigned_to2%3D1%26emailcc2%3D1%26emailqa_contact2%3D1%26emailreporter2%3D1%26emailtype1%3Dexact%26emailtype2%3Dexact%26list_id%3D15%26product%3DTestProduct%26query_format%3Dadvanced%26order%3Dpriority%252Cbug_severity&cmdtype=doit&remtype=asnamed&token=1531926552-dc69995d79c786af046436ec6717000b&newqueryname=My%20bugs%20from%20QA_Selenium&list_id=16} +check_page_load($sel, + q{http://HOSTNAME/buglist.cgi?newquery=email1%3Dadmin%2540mozilla.test%26email2%3DQA-Selenium-TEST%2540mozilla.test%26emailassigned_to1%3D1%26emailassigned_to2%3D1%26emailcc2%3D1%26emailqa_contact2%3D1%26emailreporter2%3D1%26emailtype1%3Dexact%26emailtype2%3Dexact%26list_id%3D15%26product%3DTestProduct%26query_format%3Dadvanced%26order%3Dpriority%252Cbug_severity&cmdtype=doit&remtype=asnamed&token=1531926552-dc69995d79c786af046436ec6717000b&newqueryname=My%20bugs%20from%20QA_Selenium&list_id=16} ); $sel->title_is("Search created"); $sel->is_text_present_ok( "OK, you have a new search named My bugs from QA_Selenium."); -$sel->click_ok("link=My bugs from QA_Selenium"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=17} +$sel->click_ok( + '//a[normalize-space(text())="My bugs from QA_Selenium" and not(@role="option")]' +); +check_page_load($sel, + q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=17} ); $sel->title_is("Bug List: My bugs from QA_Selenium"); logout($sel); @@ -372,9 +345,8 @@ $sel->type_ok("short_desc", "New bug from me"); # We turned on the CANEDIT bit for TestProduct. $sel->type_ok("comment", "I can enter a new bug, but not edit it, right?"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=__BUG_ID__}); +$sel->click_ok('commit'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=__BUG_ID__}); my $bug2_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); $sel->is_text_present_ok('has been added to the database', "Bug $bug2_id created"); @@ -382,21 +354,19 @@ $sel->is_text_present_ok('has been added to the database', # Clicking the "Back" button and resubmitting the form again should trigger a suspicous action error. $sel->go_back_ok(); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/enter_bug.cgi?product=TestProduct&format=__default__} -); +check_page_load($sel, + q{http://HOSTNAME/enter_bug.cgi?product=TestProduct&format=__default__}); $sel->title_is("Enter Bug: TestProduct"); $sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/post_bug.cgi}); +check_page_load($sel, q{http://HOSTNAME/post_bug.cgi}); $sel->title_is("Suspicious Action"); $sel->is_text_present_ok("you have no valid token for the create_bug action"); $sel->click_ok('//input[@value="Confirm Changes"]'); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/show_bug.cgi?id=14}); +check_page_load($sel, q{http://HOSTNAME/show_bug.cgi?id=__BUG_ID__}); $sel->is_text_present_ok('has been added to the database', 'Bug created'); $sel->type_ok("comment", "New comment not allowed"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/process_bug.cgi}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, q{http://HOSTNAME/process_bug.cgi}); $sel->title_is("Product Edit Access Denied"); $sel->is_text_present_ok( "You are not permitted to edit bugs in product TestProduct."); @@ -406,59 +376,56 @@ logout($sel); log_in($sel, $config, 'admin'); go_to_bug($sel, $bug2_id); -$sel->click_ok("bz_assignee_edit_action"); $sel->type_ok("assigned_to", $config->{admin_user_login}); $sel->type_ok("comment", "Taking!"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug2_id}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug2_id}); $sel->is_text_present_ok("Changes submitted for bug $bug2_id"); # Test mass-change. -$sel->click_ok("link=My bugs from QA_Selenium"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="My bugs from QA_Selenium" and @role="option"]'); screenshot_page($sel, '/app/artifacts/line344.png'); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=19} +check_page_load($sel, + q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=19} ); screenshot_page($sel, '/app/artifacts/line346.png'); $sel->title_is("Bug List: My bugs from QA_Selenium"); screenshot_page($sel, '/app/artifacts/line348.png'); $sel->is_text_present_ok("2 bugs found"); screenshot_page($sel, '/app/artifacts/line350.png'); -$sel->click_ok("link=Change Several Bugs at Once"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/buglist.cgi?email1=admin%40mozilla.test&email2=QA-Selenium-TEST%40mozilla.test&emailassigned_to1=1&emailassigned_to2=1&emailcc2=1&emailqa_contact2=1&emailreporter2=1&emailtype1=exact&emailtype2=exact&product=TestProduct&query_format=advanced&order=priority%2Cbug_severity&tweak=1&list_id=20} +$sel->click_ok('change-several'); +check_page_load($sel, + q{http://HOSTNAME/buglist.cgi?email1=admin%40mozilla.test&email2=QA-Selenium-TEST%40mozilla.test&emailassigned_to1=1&emailassigned_to2=1&emailcc2=1&emailqa_contact2=1&emailreporter2=1&emailtype1=exact&emailtype2=exact&product=TestProduct&query_format=advanced&order=priority%2Cbug_severity&tweak=1&list_id=20} ); $sel->title_is("Bug List"); $sel->click_ok("check_all"); $sel->type_ok("comment", 'Mass change"'); $sel->select_ok("bug_status", "label=RESOLVED"); $sel->select_ok("resolution", "label=WORKSFORME"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/process_bug.cgi}); +$sel->click_ok('commit', 'Save changes'); +check_page_load($sel, q{http://HOSTNAME/process_bug.cgi}); $sel->title_is("Bugs processed"); -$sel->click_ok("link=bug $bug1_id"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); -$sel->title_like(qr/$bug1_id /); +go_to_bug($sel, $bug1_id); $sel->selected_label_is("resolution", "WORKSFORME"); $sel->select_ok("resolution", "label=INVALID"); -$sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); +$sel->click_ok('bottom-save-btn', 'Save changes'); +check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); -$sel->title_like(qr/$bug1_id /); +go_to_bug($sel, $bug1_id); $sel->selected_label_is("resolution", "INVALID"); -$sel->click_ok("link=History"); -check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_activity.cgi?id=$bug1_id}); +$sel->click_ok('action-menu-btn', 'Expand action menu'); +$sel->click_ok('action-history', 'Show bug history'); + +# Clicking history opens a new tab +my $windows = $sel->driver->get_window_handles; +$sel->driver->switch_to_window($windows->[1]); +check_page_load($sel, qq{http://HOSTNAME/show_activity.cgi?id=$bug1_id}); $sel->title_is("Changes made to bug $bug1_id"); $sel->is_text_present_ok("URL foo.cgi?action=bar"); $sel->is_text_present_ok("Severity critical blocker"); @@ -467,6 +434,10 @@ $sel->is_text_present_ok( $sel->is_text_present_ok("Product QA-Selenium-TEST TestProduct"); $sel->is_text_present_ok("Status CONFIRMED RESOLVED"); +# Close tab and switch back +$sel->driver->close; +$sel->driver->switch_to_window($windows->[0]); + # Last step: move bugs to another DB, if the extension is enabled. # if ($config->{test_extensions}) { @@ -478,11 +449,12 @@ $sel->is_text_present_ok("Status CONFIRMED RESOLVED"); # # # Mass-move has been removed, see 581690. # # Restore these tests once this bug is fixed. -# # $sel->click_ok("link=My bugs from QA_Selenium"); +# # $sel->click_ok('quicksearch_top'); +# # $sel->click_ok('//a[normalize-space(text())="My bugs from QA_Selenium" and @role="option"]'); # # $sel->wait_for_page_to_load_ok(WAIT_TIME); # # $sel->title_is("Bug List: My bugs from QA_Selenium"); # # $sel->is_text_present_ok("2 bugs found"); -# # $sel->click_ok("link=Change Several Bugs at Once"); +# # $sel->click_ok('change-several', 'Change Several Bugs at Once'); # # $sel->wait_for_page_to_load_ok(WAIT_TIME); # # $sel->title_is("Bug List"); # # $sel->click_ok("check_all"); @@ -492,18 +464,14 @@ $sel->is_text_present_ok("Status CONFIRMED RESOLVED"); # # $sel->title_is("Bugs processed"); # # $sel->is_text_present_ok("Bug $bug1_id has been moved to another database"); # # $sel->is_text_present_ok("Bug $bug2_id has been moved to another database"); -# # $sel->click_ok("link=Bug $bug2_id"); -# # $sel->wait_for_page_to_load_ok(WAIT_TIME); -# # $sel->title_like(qr/^$bug2_id/); +# # go_to_bug($sel, $bug2_id); # # $sel->selected_label_is("resolution", "MOVED"); # # go_to_bug($sel, $bug2_id); # $sel->click_ok('oldbugmove'); # $sel->wait_for_page_to_load_ok(WAIT_TIME); # $sel->is_text_present_ok("Changes submitted for bug $bug2_id"); -# $sel->click_ok("link=bug $bug2_id"); -# $sel->wait_for_page_to_load_ok(WAIT_TIME); -# $sel->title_like(qr/$bug2_id /); +# go_to_bug($sel, $bug2_id); # $sel->selected_label_is("resolution", "MOVED"); # $sel->is_text_present_ok("Bug moved to http://www.foo.com/."); # @@ -518,20 +486,14 @@ foreach my $params (["no_token_single_bug", ""], ["invalid_token_single_bug", "&token=1"]) { my ($comment, $token) = @$params; - $sel->open_ok( - "/process_bug.cgi?id=$bug1_id&comment=$comment$token", - undef, "Edit a single bug with " . ($token ? "an invalid" : "no") . " token" - ); + $sel->open_ok("/process_bug.cgi?id=$bug1_id&comment=$comment$token", + undef, "Edit a single bug with " . ($token ? "an invalid" : "no") . " token"); $sel->title_is("Suspicious Action"); $sel->is_text_present_ok($token ? "an invalid token" : "web browser directly"); $sel->click_ok("confirm"); - check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); + check_page_load($sel, qq{http://HOSTNAME/show_bug.cgi?id=$bug1_id}); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); - $sel->click_ok("link=bug $bug1_id"); - check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug1_id}); - $sel->title_like(qr/^$bug1_id /); + go_to_bug($sel, $bug1_id); $sel->is_text_present_ok($comment); } @@ -541,56 +503,56 @@ foreach my $params (["no_token_mass_change", ""], my ($comment, $token) = @$params; $sel->open_ok( "/process_bug.cgi?id_$bug1_id=1&id_$bug2_id=1&comment=$comment$token", - undef, "Mass change with " . ($token ? "an invalid" : "no") . " token" - ); + undef, "Mass change with " . ($token ? "an invalid" : "no") . " token"); $sel->title_is("Suspicious Action"); $sel->is_text_present_ok("no valid token for the buglist_mass_change action"); $sel->click_ok("confirm"); - check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/process_bug.cgi}); + check_page_load($sel, q{http://HOSTNAME/process_bug.cgi}); $sel->title_is("Bugs processed"); foreach my $bug_id ($bug1_id, $bug2_id) { - $sel->click_ok("link=bug $bug_id"); - check_page_load($sel, WAIT_TIME, - qq{http://HOSTNAME:8000/show_bug.cgi?id=$bug_id}); - $sel->title_like(qr/^$bug_id /); + go_to_bug($sel, $bug_id); $sel->is_text_present_ok($comment); next if $bug_id == $bug2_id; $sel->go_back_ok(); - check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/process_bug.cgi}); + check_page_load($sel, q{http://HOSTNAME/process_bug.cgi}); $sel->title_is("Bugs processed"); } } # Now move these bugs out of our radar. -$sel->click_ok("link=My bugs from QA_Selenium"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=21} +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="My bugs from QA_Selenium" and @role="option"]'); +check_page_load($sel, + q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=21} ); $sel->title_is("Bug List: My bugs from QA_Selenium"); $sel->is_text_present_ok("2 bugs found"); -$sel->click_ok("link=Change Several Bugs at Once"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/buglist.cgi?email1=admin%40mozilla.test&email2=QA-Selenium-TEST%40mozilla.test&emailassigned_to1=1&emailassigned_to2=1&emailcc2=1&emailqa_contact2=1&emailreporter2=1&emailtype1=exact&emailtype2=exact&product=TestProduct&query_format=advanced&order=priority%2Cbug_severity&tweak=1&list_id=22} +$sel->click_ok('change-several', 'Change Several Bugs at Once'); +check_page_load($sel, + q{http://HOSTNAME/buglist.cgi?email1=admin%40mozilla.test&email2=QA-Selenium-TEST%40mozilla.test&emailassigned_to1=1&emailassigned_to2=1&emailcc2=1&emailqa_contact2=1&emailreporter2=1&emailtype1=exact&emailtype2=exact&product=TestProduct&query_format=advanced&order=priority%2Cbug_severity&tweak=1&list_id=22} ); $sel->title_is("Bug List"); $sel->click_ok("check_all"); $sel->type_ok("comment", "Reassigning to the reporter"); $sel->type_ok("assigned_to", $config->{QA_Selenium_TEST_user_login}); $sel->click_ok("commit"); -check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/process_bug.cgi}); +check_page_load($sel, q{http://HOSTNAME/process_bug.cgi}); $sel->title_is("Bugs processed"); # Now delete the saved search. -$sel->click_ok("link=My bugs from QA_Selenium"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=23} +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="My bugs from QA_Selenium" and @role="option"]'); +check_page_load($sel, + q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=23} ); $sel->title_is("Bug List: My bugs from QA_Selenium"); -$sel->click_ok("link=Forget Search 'My bugs from QA_Selenium'"); -check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=My%20bugs%20from%20QA_Selenium&token=1531926582-f228fa8ebc2f2b3970f2a791e54534ec&list_id=24} +$sel->click_ok('forget-search', 'Forget Search'); +check_page_load($sel, + q{http://HOSTNAME/buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=My%20bugs%20from%20QA_Selenium&token=1531926582-f228fa8ebc2f2b3970f2a791e54534ec&list_id=24} ); $sel->title_is("Search is gone"); $sel->is_text_present_ok("OK, the My bugs from QA_Selenium search is gone"); @@ -604,12 +566,12 @@ sub clear_canedit_on_testproduct { edit_product($sel, "TestProduct"); $sel->click_ok("link=Edit Group Access Controls:"); - check_page_load($sel, WAIT_TIME, - q{http://HOSTNAME:8000/editproducts.cgi?action=editgroupcontrols&product=TestProduct} + check_page_load($sel, + q{http://HOSTNAME/editproducts.cgi?action=editgroupcontrols&product=TestProduct} ); $sel->title_is("Edit Group Controls for TestProduct"); $sel->uncheck_ok("canedit_$master_gid"); $sel->click_ok("submit"); - check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/editproducts.cgi}); + check_page_load($sel, q{http://HOSTNAME/editproducts.cgi}); $sel->title_is("Update group access controls for TestProduct"); } diff --git a/qa/t/test_classifications.t b/qa/t/test_classifications.t index c2ed89edf..0275d3f80 100644 --- a/qa/t/test_classifications.t +++ b/qa/t/test_classifications.t @@ -31,18 +31,14 @@ $sel->title_is("Select classification"); # Accessing action=delete directly must 1) trigger the security check page, # and 2) automatically reclassify products in this classification. if ($sel->is_text_present("cone")) { - $sel->open_ok( - "/editclassifications.cgi?action=delete&classification=cone" - ); + $sel->open_ok("/editclassifications.cgi?action=delete&classification=cone"); $sel->title_is("Suspicious Action"); $sel->click_ok("confirm"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Classification Deleted"); } if ($sel->is_text_present("ctwo")) { - $sel->open_ok( - "/editclassifications.cgi?action=delete&classification=ctwo" - ); + $sel->open_ok("/editclassifications.cgi?action=delete&classification=ctwo"); $sel->title_is("Suspicious Action"); $sel->click_ok("confirm"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -134,7 +130,7 @@ $sel->click_ok( ); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Reclassify products"); -$sel->add_selection_ok("myprodlist", "label=TestProduct"); +$sel->select_ok("myprodlist", "label=TestProduct"); $sel->click_ok("remove_products"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Reclassify products"); diff --git a/qa/t/test_config.t b/qa/t/test_config.t index 6297d1182..cd9f23fa6 100644 --- a/qa/t/test_config.t +++ b/qa/t/test_config.t @@ -23,16 +23,15 @@ logout($sel); # Accessing config.cgi should display no sensitive data. -$sel->open_ok("/config.cgi", - undef, "Go to config.cgi (JS format)"); -$sel->is_text_present_ok("var status = [ ];"); -$sel->is_text_present_ok("var status_open = [ ];"); -$sel->is_text_present_ok("var status_closed = [ ];"); -$sel->is_text_present_ok("var resolution = [ ];"); -$sel->is_text_present_ok("var keyword = [ ];"); -$sel->is_text_present_ok("var platform = [ ];"); -$sel->is_text_present_ok("var severity = [ ];"); -$sel->is_text_present_ok("var field = [\n];"); +$sel->open_ok("/config.cgi", undef, "Go to config.cgi (JS format)"); +$sel->is_text_present_ok("var status"); +$sel->is_text_present_ok("var status_open"); +$sel->is_text_present_ok("var status_closed"); +$sel->is_text_present_ok("var resolution"); +$sel->is_text_present_ok("var keyword"); +$sel->is_text_present_ok("var platform"); +$sel->is_text_present_ok("var severity"); +$sel->is_text_present_ok("var field"); ok(!$sel->is_text_present("cf_"), "No custom field displayed"); ok(!$sel->is_text_present("component["), "No component displayed"); @@ -40,7 +39,7 @@ ok(!$sel->is_text_present("version["), "No version displayed"); ok(!$sel->is_text_present("target_milestone["), "No target milestone displayed"); -# Turn on 'requirelogin' and log out. +# Turn off 'requirelogin' and log out. log_in($sel, $config, 'admin'); set_parameters($sel, {"User Authentication" => {"requirelogin-off" => undef}}); diff --git a/qa/t/test_create_user_accounts.t b/qa/t/test_create_user_accounts.t index c03551ffd..d546f048b 100644 --- a/qa/t/test_create_user_accounts.t +++ b/qa/t/test_create_user_accounts.t @@ -92,9 +92,8 @@ foreach my $account (@accounts) { $sel->type_ok("login", $account); $sel->check_ok("etiquette", "Agree to abide by code of conduct"); $sel->click_ok('//input[@value="Create Account"]'); - ok( - $sel->get_alert() - =~ /The e-mail address doesn't pass our syntax checking for a legal email address/, + $sel->alert_text_like( + qr/The e-mail address doesn't pass our syntax checking for a legal email address/, 'Invalid email address detected' ); } diff --git a/qa/t/test_custom_fields.t b/qa/t/test_custom_fields.t index 62fdfaa25..2db50944c 100644 --- a/qa/t/test_custom_fields.t +++ b/qa/t/test_custom_fields.t @@ -23,7 +23,7 @@ my $bug_summary = "What's your ID?"; $sel->type_ok("short_desc", $bug_summary); $sel->type_ok("comment", "Use the ID of this bug to generate a unique custom field name."); -$sel->type_ok("bug_severity", "label=normal"); +$sel->select_ok("bug_severity", "label=normal"); my $bug1_id = create_bug($sel, $bug_summary); # Create custom fields @@ -210,6 +210,7 @@ my $bug2_id = create_bug($sel, $bug_summary2); # Both fields are editable. +go_to_bug($sel, $bug2_id); $sel->type_ok("cf_qa_freetext_$bug1_id", "bonsai"); $sel->selected_label_is("cf_qa_list_$bug1_id", "---"); $sel->select_ok("bug_status", "label=SUSPENDED"); @@ -218,7 +219,9 @@ edit_bug($sel, $bug2_id); go_to_bug($sel, $bug1_id); $sel->type_ok("cf_qa_freetext_$bug1_id", "dumbo"); $sel->select_ok("cf_qa_list_$bug1_id", "label=storage"); -$sel->is_text_present_ok("IsRef$bug1_id: $bug2_id"); + +# FIXME: The reverse description is not displaying properly on bug modal page +#$sel->is_text_present_ok("IsRef$bug1_id: $bug2_id"); $sel->select_ok("bug_status", "RESOLVED"); $sel->select_ok("resolution", "UPSTREAM"); edit_bug_and_return($sel, $bug1_id, $bug_summary); @@ -233,7 +236,7 @@ edit_bug($sel, $bug2_id); open_advanced_search_page($sel); $sel->remove_all_selections_ok("product"); -$sel->add_selection_ok("product", "TestProduct"); +$sel->select_ok("product", "label=TestProduct"); $sel->remove_all_selections("bug_status"); $sel->remove_all_selections("resolution"); $sel->select_ok("f1", "label=List$bug1_id"); @@ -248,7 +251,7 @@ $sel->is_text_present_ok("Et de un"); # Now edit custom fields in mass changes. -$sel->click_ok("link=Change Several Bugs at Once"); +$sel->click_ok('change-several', 'Change Several Bugs at Once'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List"); $sel->click_ok("check_all"); @@ -257,91 +260,90 @@ $sel->type_ok("cf_qa_freetext_$bug1_id", "thanks"); $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bugs processed"); -$sel->click_ok("link=bug $bug2_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug2_id/); +go_to_bug($sel, $bug2_id); $sel->value_is("cf_qa_freetext_$bug1_id", "thanks"); $sel->selected_label_is("cf_qa_list_$bug1_id", "---"); $sel->select_ok("cf_qa_list_$bug1_id", "label=storage"); edit_bug($sel, $bug2_id); # Let's now test custom field visibility. - -go_to_admin($sel); -$sel->click_ok("link=Custom Fields"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Custom Fields"); -$sel->click_ok("link=cf_qa_list_$bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Edit the Custom Field 'cf_qa_list_$bug1_id' (List$bug1_id)"); -$sel->select_ok("visibility_field_id", "label=Severity (bug_severity)"); -$sel->select_ok("visibility_values", "label=critical"); -$sel->click_ok("edit"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Custom Field Updated"); - -go_to_bug($sel, $bug1_id); -$sel->is_element_present_ok("cf_qa_list_$bug1_id", - "List$bug1_id is in the DOM of the page..."); -ok(!$sel->is_visible("cf_qa_list_$bug1_id"), - "... but is not displayed with severity = 'normal'"); -$sel->select_ok("bug_severity", "major"); -ok(!$sel->is_visible("cf_qa_list_$bug1_id"), "... nor with severity = 'major'"); -$sel->select_ok("bug_severity", "critical"); -$sel->is_visible_ok("cf_qa_list_$bug1_id", - "... but is visible with severity = 'critical'"); -edit_bug_and_return($sel, $bug1_id, $bug_summary); -$sel->is_visible_ok("cf_qa_list_$bug1_id"); - -go_to_bug($sel, $bug2_id); -$sel->is_visible_ok("cf_qa_list_$bug1_id"); -$sel->select_ok("bug_severity", "minor"); -ok(!$sel->is_visible("cf_qa_list_$bug1_id"), - "List$bug1_id is not displayed with severity = 'minor'"); -edit_bug_and_return($sel, $bug2_id, $bug_summary2); -ok(!$sel->is_visible("cf_qa_list_$bug1_id"), - "List$bug1_id is not displayed with severity = 'minor'"); - -# Add a new value which is only listed under some condition. - -go_to_admin($sel); -$sel->click_ok("link=Custom Fields"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Custom Fields"); -$sel->click_ok("link=cf_qa_list_$bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Edit the Custom Field 'cf_qa_list_$bug1_id' (List$bug1_id)"); -$sel->select_ok("value_field_id", "label=Resolution (resolution)"); -$sel->click_ok("edit"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Custom Field Updated"); -$sel->click_ok("link=cf_qa_list_$bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Edit the Custom Field 'cf_qa_list_$bug1_id' (List$bug1_id)"); -$sel->click_ok("link=Edit legal values for this field"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is( - "Select value for the 'List$bug1_id' (cf_qa_list_$bug1_id) field"); -$sel->click_ok("link=Add"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Add Value for the 'List$bug1_id' (cf_qa_list_$bug1_id) field"); -$sel->type_ok("value", "ghost"); -$sel->type_ok("sortkey", "500"); -$sel->select_ok("visibility_value_id", "label=FIXED"); -$sel->click_ok("id=create"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("New Field Value Created"); - -go_to_bug($sel, $bug1_id); -my @labels = $sel->get_select_options("cf_qa_list_$bug1_id"); -ok(grep(/^ghost$/, @labels), "ghost is in the DOM of the page..."); -my $disabled = $sel->get_attribute("v4_cf_qa_list_$bug1_id\@disabled"); -ok(defined $disabled, "... but is not available for selection by default"); -$sel->select_ok("bug_status", "label=RESOLVED"); -$sel->select_ok("resolution", "label=FIXED"); -$sel->select_ok("cf_qa_list_$bug1_id", "label=ghost"); -edit_bug_and_return($sel, $bug1_id, $bug_summary); -$sel->selected_label_is("cf_qa_list_$bug1_id", "ghost"); +# FIXME: Dynamic field visibility is not yet supported by bug modal show bug + +# go_to_admin($sel); +# $sel->click_ok("link=Custom Fields"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is("Custom Fields"); +# $sel->click_ok("link=cf_qa_list_$bug1_id"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is("Edit the Custom Field 'cf_qa_list_$bug1_id' (List$bug1_id)"); +# $sel->select_ok("visibility_field_id", "label=Severity (bug_severity)"); +# $sel->select_ok("visibility_values", "label=critical"); +# $sel->click_ok("edit"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is("Custom Field Updated"); + +# go_to_bug($sel, $bug1_id); +# $sel->is_element_present_ok("cf_qa_list_$bug1_id", +# "List$bug1_id is in the DOM of the page..."); +# ok(!$sel->is_element_present("cf_qa_list_$bug1_id"), +# "... but is not displayed with severity = 'normal'"); +# $sel->select_ok("bug_severity", "major"); +# ok(!$sel->is_element_present("cf_qa_list_$bug1_id"), "... nor with severity = 'major'"); +# $sel->select_ok("bug_severity", "critical"); +# $sel->is_element_present_ok("cf_qa_list_$bug1_id", +# "... but is visible with severity = 'critical'"); +# edit_bug_and_return($sel, $bug1_id, $bug_summary); +# $sel->is_element_present_ok("cf_qa_list_$bug1_id"); + +# go_to_bug($sel, $bug2_id); +# $sel->is_element_present_ok("cf_qa_list_$bug1_id"); +# $sel->select_ok("bug_severity", "minor"); +# ok(!$sel->is_element_present("cf_qa_list_$bug1_id"), +# "List$bug1_id is not displayed with severity = 'minor'"); +# edit_bug_and_return($sel, $bug2_id, $bug_summary2); +# ok(!$sel->is_element_present("cf_qa_list_$bug1_id"), +# "List$bug1_id is not displayed with severity = 'minor'"); + +# # Add a new value which is only listed under some condition. + +# go_to_admin($sel); +# $sel->click_ok("link=Custom Fields"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is("Custom Fields"); +# $sel->click_ok("link=cf_qa_list_$bug1_id"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is("Edit the Custom Field 'cf_qa_list_$bug1_id' (List$bug1_id)"); +# $sel->select_ok("value_field_id", "label=Resolution (resolution)"); +# $sel->click_ok("edit"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is("Custom Field Updated"); +# $sel->click_ok("link=cf_qa_list_$bug1_id"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is("Edit the Custom Field 'cf_qa_list_$bug1_id' (List$bug1_id)"); +# $sel->click_ok("link=Edit legal values for this field"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is( +# "Select value for the 'List$bug1_id' (cf_qa_list_$bug1_id) field"); +# $sel->click_ok("link=Add"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is("Add Value for the 'List$bug1_id' (cf_qa_list_$bug1_id) field"); +# $sel->type_ok("value", "ghost"); +# $sel->type_ok("sortkey", "500"); +# $sel->select_ok("visibility_value_id", "label=FIXED"); +# $sel->click_ok("id=create"); +# $sel->wait_for_page_to_load_ok(WAIT_TIME); +# $sel->title_is("New Field Value Created"); + +# go_to_bug($sel, $bug1_id); +# my @labels = $sel->get_select_options("cf_qa_list_$bug1_id"); +# ok(grep(/^ghost$/, @labels), "ghost is in the DOM of the page..."); +# my $disabled = $sel->get_attribute("v4_cf_qa_list_$bug1_id\@disabled"); +# ok(defined $disabled, "... but is not available for selection by default"); +# $sel->select_ok("bug_status", "label=RESOLVED"); +# $sel->select_ok("resolution", "label=FIXED"); +# $sel->select_ok("cf_qa_list_$bug1_id", "label=ghost"); +# edit_bug_and_return($sel, $bug1_id, $bug_summary); +# $sel->selected_label_is("cf_qa_list_$bug1_id", "ghost"); # Delete an unused field value. @@ -405,8 +407,8 @@ $sel->is_text_present_ok("Freetext$bug1_id: thanks"); log_in($sel, $config, 'unprivileged'); go_to_bug($sel, $bug1_id); $sel->is_text_present_ok("Freetext$bug1_id: thanks"); -$sel->click_ok("cc_edit_area_showhide"); -$sel->type_ok("newcc", $config->{unprivileged_user_login}); +$sel->click_ok("add-cc-btn"); +$sel->type_ok("add-cc", $config->{unprivileged_user_login}); edit_bug($sel, $bug1_id); logout($sel); diff --git a/qa/t/test_custom_fields_admin.t b/qa/t/test_custom_fields_admin.t index 541793f6b..b095bdbcc 100644 --- a/qa/t/test_custom_fields_admin.t +++ b/qa/t/test_custom_fields_admin.t @@ -9,6 +9,8 @@ use strict; use warnings; use lib qw(lib ../../lib ../../local/lib/perl5); +use Bugzilla::RNG; + use Test::More "no_plan"; use QA::Util; @@ -29,7 +31,7 @@ my @types = ( "Free Text", "Multiple-Selection Box", "Drop Down", "Date/Time" ); -my $counter = int(rand(10000)); +my $counter = int(Bugzilla::RNG::rand(10000)); foreach my $type (@types) { my $fname = "cf_field" . ++$counter; diff --git a/qa/t/test_default_groups.t b/qa/t/test_default_groups.t index 3c16087bf..8713ee577 100644 --- a/qa/t/test_default_groups.t +++ b/qa/t/test_default_groups.t @@ -24,8 +24,8 @@ add_product($sel); $sel->type_ok("product", "ready_to_die"); $sel->type_ok("description", "will die"); $sel->select_ok("security_group_id", "label=core-security"); -$sel->select_ok("default_op_sys_id", "Unspecified"); -$sel->select_ok("default_platform_id", "Unspecified"); +$sel->select_ok("default_op_sys_id", "label=Unspecified"); +$sel->select_ok("default_platform_id", "label=Unspecified"); $sel->click_ok('//input[@value="Add"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Product Created"); @@ -85,8 +85,8 @@ add_product($sel); $sel->type_ok("product", "ready_to_die"); $sel->type_ok("description", "will die"); $sel->select_ok("security_group_id", "label=core-security"); -$sel->select_ok("default_op_sys_id", "Unspecified"); -$sel->select_ok("default_platform_id", "Unspecified"); +$sel->select_ok("default_op_sys_id", "label=Unspecified"); +$sel->select_ok("default_platform_id", "label=Unspecified"); $sel->click_ok('//input[@value="Add"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Product Created"); @@ -175,8 +175,8 @@ add_product($sel); $sel->type_ok("product", "ready_to_die"); $sel->type_ok("description", "will die"); $sel->select_ok("security_group_id", "label=core-security"); -$sel->select_ok("default_op_sys_id", "Unspecified"); -$sel->select_ok("default_platform_id", "Unspecified"); +$sel->select_ok("default_op_sys_id", "label=Unspecified"); +$sel->select_ok("default_platform_id", "label=Unspecified"); $sel->click_ok('//input[@value="Add"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Product Created"); diff --git a/qa/t/test_dependencies.t b/qa/t/test_dependencies.t index 1deefb84e..3b208d561 100644 --- a/qa/t/test_dependencies.t +++ b/qa/t/test_dependencies.t @@ -34,7 +34,7 @@ $sel->check_ok('//input[@name="groups" and @value="Master"]'); my $bug2_id = create_bug($sel, $bug_summary2); go_to_bug($sel, $bug1_id); -$sel->click_ok("link=Mark as Duplicate"); +$sel->click_ok('//button[text()="DUPLICATE"]'); $sel->type_ok("dup_id", $bug2_id); edit_bug_and_return($sel, $bug1_id, $bug_summary); $sel->is_text_present_ok("secret_qa_bug_$bug1_id+1"); diff --git a/qa/t/test_edit_products_properties.t b/qa/t/test_edit_products_properties.t index 6848b444b..c2b0dcf53 100644 --- a/qa/t/test_edit_products_properties.t +++ b/qa/t/test_edit_products_properties.t @@ -69,8 +69,8 @@ if ($config->{test_extensions}) { } $sel->type_ok("version", "0.1a"); $sel->select_ok("security_group_id", "label=core-security"); -$sel->select_ok("default_op_sys_id", "Unspecified"); -$sel->select_ok("default_platform_id", "Unspecified"); +$sel->select_ok("default_op_sys_id", "label=Unspecified"); +$sel->select_ok("default_platform_id", "label=Unspecified"); $sel->click_ok('//input[@type="submit" and @value="Add"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $text = trim($sel->get_text("message")); @@ -85,9 +85,6 @@ $sel->title_is("Add component to the Kill me! product"); $sel->type_ok("component", "first comp"); $sel->type_ok("description", "comp 1"); $sel->type_ok("initialowner", $admin_user_login); -$sel->uncheck_ok("watch_user_auto"); -$sel->type_ok("watch_user", "first-comp\@kill-me.bugs"); -$sel->check_ok("watch_user_auto"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Component Created"); @@ -103,9 +100,6 @@ $sel->title_is("Add component to the Kill me! product"); $sel->type_ok("component", "first comp"); $sel->type_ok("description", "comp 2"); $sel->type_ok("initialowner", $admin_user_login); -$sel->uncheck_ok("watch_user_auto"); -$sel->type_ok("watch_user", "first-comp\@kill-me.bugs"); -$sel->check_ok("watch_user_auto"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Component Already Exists"); @@ -119,9 +113,6 @@ $sel->type_ok("component", "second comp"); # FIXME - Re-enter the default assignee (regression due to bug 577574) $sel->type_ok("initialowner", $admin_user_login); $sel->type_ok("initialcc", $permanent_user); -$sel->uncheck_ok("watch_user_auto"); -$sel->type_ok("watch_user", "second-comp\@kill-me.bugs"); -$sel->check_ok("watch_user_auto"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Component Created"); @@ -129,7 +120,7 @@ $sel->title_is("Component Created"); # Add a new version. edit_product($sel, "Kill me!"); -$sel->click_ok("//a[contains(text(),'Edit\nversions:')]"); +$sel->click_ok("link=Edit versions:"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Select version of product 'Kill me!'"); $sel->click_ok("link=Add"); @@ -191,13 +182,18 @@ $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok('has been added to the database', 'Bug created'); my $bug1_id = $sel->get_value("//input[\@name='id' and \@type='hidden']"); -my @cc_list = $sel->get_select_options("cc"); +go_to_bug($sel, $bug1_id); +$sel->click_ok('cc-summary'); ok( - grep($_ eq $unprivileged_user_login, @cc_list), + $sel->find_element( + qq{//div[\@class="cc-user"]//a[\@data-user-email="$unprivileged_user_login"]}), "$unprivileged_user_login correctly added to the CC list" ); -ok(!grep($_ eq $permanent_user, @cc_list), - "$permanent_user not in the CC list for 'first comp' by default"); +ok( + !$sel->find_element( + qq{//div[\@class="cc-user"]//a[\@data-user-email="$permanent_user"]}), + "$permanent_user not in the CC list for 'first comp' by default" +); # File a second bug, and make sure users in the default CC list are added. file_bug_in_product($sel, "Kill me!"); @@ -208,9 +204,14 @@ $sel->type_ok("comment", "is the CC list populated correctly?"); $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok('has been added to the database', 'Bug created'); -@cc_list = $sel->get_select_options("cc"); -ok(grep($_ eq $permanent_user, @cc_list), - "$permanent_user in the CC list for 'second comp' by default"); +my $bug2_id = $sel->get_value("//input[\@name='id' and \@type='hidden']"); +go_to_bug($sel, $bug2_id); +$sel->click_ok('cc-summary'); +ok( + $sel->find_element( + qq{//div[\@class="cc-user"]//a[\@data-user-email="$permanent_user"]}), + "$permanent_user in the CC list for 'second comp' by default" +); # Edit product properties and set votes_to_confirm to 0, which has # the side-effect to disable auto-confirmation (new behavior compared @@ -260,7 +261,7 @@ if ($config->{test_extensions}) { $sel->is_text_present_ok("Updated number of votes needed to confirm a bug"); go_to_bug($sel, $bug1_id); - $sel->click_ok("link=vote"); + $sel->click_ok("vote-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Votes"); $sel->type_ok("bug_$bug1_id", 1); @@ -290,15 +291,16 @@ $sel->selected_label_is("bug_status", "CONFIRMED") if $config->{test_extensions}; $sel->select_ok("target_milestone", "label=pre-0.1"); $sel->select_ok("component", "label=second comp"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/$bug1_id /); -@cc_list = $sel->get_select_options("cc"); -ok(grep($_ eq $permanent_user, @cc_list), - "User $permanent_user automatically added to the CC list"); +go_to_bug($sel, $bug1_id); +$sel->click_ok('cc-summary'); +ok( + $sel->find_element( + qq{//div[\@class="cc-user"]//a[\@data-user-email="$permanent_user"]}), + "User $permanent_user automatically added to the CC list" +); # Delete the milestone the bug belongs to. This should retarget the bug # to the default milestone. @@ -331,7 +333,7 @@ ok( $sel->click_ok("link='Kill me nicely'"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Edit Product 'Kill me nicely'"); -$sel->click_ok("//a[contains(text(),'Edit\nversions:')]"); +$sel->click_ok("link=Edit versions:"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Select version of product 'Kill me nicely'"); $sel->click_ok( diff --git a/qa/t/test_flags.t b/qa/t/test_flags.t index 904584eed..0f71b050e 100644 --- a/qa/t/test_flags.t +++ b/qa/t/test_flags.t @@ -34,7 +34,7 @@ $sel->click_ok("categoryAction-include"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); $sel->remove_all_selections_ok("inclusion_to_remove"); -$sel->add_selection_ok("inclusion_to_remove", "label=__Any__:__Any__"); +$sel->select_ok("inclusion_to_remove", "label=__Any__:__Any__"); $sel->click_ok("categoryAction-removeInclusion"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); @@ -157,7 +157,7 @@ $sel->click_ok("categoryAction-include"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Attachments"); $sel->remove_all_selections_ok("inclusion_to_remove"); -$sel->add_selection_ok("inclusion_to_remove", "label=__Any__:__Any__"); +$sel->select_ok("inclusion_to_remove", "label=__Any__:__Any__"); $sel->click_ok("categoryAction-removeInclusion"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Attachments"); @@ -245,9 +245,7 @@ $sel->is_text_present_ok('has been added to the database', # All 3 bug flag types must be available; we are in the TestProduct product. -$sel->click_ok("link=Bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id .* test flags/); +go_to_bug($sel, $bug1_id); $sel->is_text_present_ok("SeleniumBugFlag1Test"); # We specify //select or //input, just to be sure. This is not required, though. @@ -275,22 +273,26 @@ $sel->select_ok("flag_type-$flagtype2_id", "label=?"); $sel->type_ok("requestee_type-$flagtype2_id", $config->{admin_user_login}); $sel->select_ok("flag_type-$flagtype3_id", "label=?"); $sel->type_ok("comment", "Setting all 3 flags to ?"); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); # We need to store the new flag IDs. -$sel->is_text_present_ok("$config->{admin_user_nick}: SeleniumBugFlag1Test"); +$sel->is_element_present_ok( + qq{//div[\@id="bug-flags"]/table/tbody/tr/td[\@class="flag-setter"]/div/a[\@data-user-email="$config->{admin_user_login}"]/../../../td[\@class="flag-name"]/*[text()="SeleniumBugFlag1Test"]} +); my $flag1_1_id = $sel->get_attribute('//select[@title="bugflag1"]@id'); $flag1_1_id =~ s/flag-//; -$sel->is_text_present_ok("$config->{admin_user_nick}: SeleniumBugFlag2Test"); +$sel->is_element_present_ok( + qq{//div[\@id="bug-flags"]/table/tbody/tr/td[\@class="flag-setter"]/div/a[\@data-user-email="$config->{admin_user_login}"]/../../../td[\@class="flag-name"]/*[text()="SeleniumBugFlag2Test"]} +); my $flag2_1_id = $sel->get_attribute('//select[@title="bugflag2"]@id'); $flag2_1_id =~ s/flag-//; -$sel->is_text_present_ok("$config->{admin_user_nick}: SeleniumBugFlag3Test"); +$sel->is_element_present_ok( + qq{//div[\@id="bug-flags"]/table/tbody/tr/td[\@class="flag-setter"]/div/a[\@data-user-email="$config->{admin_user_login}"]/../../../td[\@class="flag-name"]/a[normalize-space(text())="SeleniumBugFlag3Test"]} +); my $flag3_1_id = $sel->get_attribute('//select[@title="bugflag3"]@id'); $flag3_1_id =~ s/flag-//; @@ -302,12 +304,10 @@ ok( ); $sel->select_ok("flag_type-$flagtype1_id", "label=+"); $sel->select_ok("flag_type-$flagtype2_id", "label=-"); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); # Now let's test requestees. SeleniumBugFlag2Test requires the requestee # to be in the editbugs group. @@ -317,35 +317,43 @@ $sel->type_ok("requestee_type-$flagtype1_id", $config->{admin_user_login}); $sel->select_ok("flag_type-$flagtype2_id", "label=?"); $sel->type_ok("requestee_type-$flagtype2_id", $config->{unprivileged_user_login}); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Flag Requestee Not Authorized"); $sel->go_back_ok(); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^$bug1_id /); + +# FIXME: Two issues that need to be investigated +# 1. going back does not keep panels expanded +# 2. to get the requestee field to display for the addl flags, +# we have to set to X and then back to ? for each one. +$sel->click_ok('action-menu-btn', 'Expand action menu'); +$sel->click_ok('action-expand-all', 'Expand all modal panels'); +$sel->select_ok("flag_type-$flagtype1_id", "value=X"); +$sel->select_ok("flag_type-$flagtype1_id", "label=?"); +$sel->type_ok("requestee_type-$flagtype1_id", $config->{admin_user_login}); +$sel->select_ok("flag_type-$flagtype2_id", "value=X"); +$sel->select_ok("flag_type-$flagtype2_id", "label=?"); $sel->type_ok("requestee_type-$flagtype2_id", $config->{admin_user_login}); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); # Final tests for bug flags. $sel->select_ok("flag-$flag1_1_id", "value=X"); $sel->select_ok("flag-$flag2_1_id", "label=+"); $sel->select_ok("flag-$flag3_1_id", "label=-"); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); # Now we test attachment flags. -$sel->click_ok("link=Add an attachment"); +$sel->click_ok('attachments-add-link', 'Add an attachment'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); @@ -425,24 +433,24 @@ my $attachment3_id = $1; # Display the bug and check flags are correctly set. -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); -$sel->is_text_present_ok( - "$config->{admin_user_nick}: SeleniumAttachmentFlag1Test? ($config->{admin_user_nick})" -); -$sel->is_text_present_ok( - "$config->{admin_user_nick}: SeleniumAttachmentFlag2Test?"); -$sel->is_text_present_ok( - "$config->{admin_user_nick}: SeleniumAttachmentFlag1Test+"); +go_to_bug($sel, $bug1_id, 1); -# We marked the first attachment as obsolete, so it should have no flag on it. -$sel->is_text_present_ok("no flags"); +# FIME: OMG there must be a better way :( +$sel->is_element_present_ok( + qq{//div[\@class="attach-flag"]/div/span[text()="$config->{admin_user_nick}"]/../..//a[normalize-space(text())="SeleniumAttachmentFlag1Test?"]/../div[2]/span[text()="$config->{admin_user_nick}"]} +); +$sel->is_element_present_ok( + qq{//div[\@class="attach-flag"]/div/span[text()="$config->{admin_user_nick}"]/../..//a[normalize-space(text())="SeleniumAttachmentFlag2Test?"]} +); +$sel->is_element_present_ok( + qq{//div[\@class="attach-flag"]/div/span[text()="$config->{admin_user_nick}"]/../..//a[normalize-space(text())="SeleniumAttachmentFlag1Test+"]} +); # Make the bug public and log out. +$sel->click_ok('mode-btn-readonly', 'Click Edit Bug'); $sel->uncheck_ok('//input[@name="groups" and @value="Master"]'); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); logout($sel); @@ -454,12 +462,10 @@ go_to_bug($sel, $bug1_id); # No privs are required to clear this flag. $sel->select_ok("flag-$flag3_1_id", "value=X"); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); # editbugs privs are required to clear this flag, so no other option # should be displayed besides the currently set "+". @@ -487,10 +493,8 @@ $sel->is_element_present_ok( # Add an attachment and set flags on it. -$sel->click_ok("link=Bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id/); -$sel->click_ok("link=Add an attachment"); +go_to_bug($sel, $bug1_id); +$sel->click_ok('attachments-add-link', 'Add an attachment'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); @@ -501,10 +505,9 @@ $sel->type_ok('//input[@name="description"]', "patch, v4"); # canconfirm/editbugs privs are required to edit this flag. -ok( - !$sel->is_editable("flag_type-$aflagtype1_id"), - "Flag type non editable by powerless users" -); +$sel->is_element_present_ok( + qq{//select[\@id="flag_type-$aflagtype1_id"][\@disabled]}, + "Flag type non editable by powerless user"); # No privs are required to edit this flag. @@ -513,11 +516,10 @@ $sel->type_ok("comment", "granting again"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok('regexp:Attachment #\d+ to bug \d+ created'); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id/); -$sel->is_text_present_ok( - "$config->{unprivileged_user_nick}: SeleniumAttachmentFlag2Test+"); +go_to_bug($sel, $bug1_id, 1); +$sel->is_element_present_ok( + qq{//div[\@class="attach-flag"]/div/span[text()="$config->{unprivileged_user_nick}"]/../..//a[normalize-space(text())="SeleniumAttachmentFlag2Test+"]} +); logout($sel); # Final tests as an admin. He has editbugs privs, so he can edit diff --git a/qa/t/test_flags2.t b/qa/t/test_flags2.t index fb62a382d..ccb6eae00 100644 --- a/qa/t/test_flags2.t +++ b/qa/t/test_flags2.t @@ -34,7 +34,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); $sel->type_ok("name", "selenium"); $sel->type_ok("description", "Available in TestProduct and Another Product/c1"); -$sel->add_selection_ok("inclusion_to_remove", "label=__Any__:__Any__"); +$sel->select_ok("inclusion_to_remove", "label=__Any__:__Any__"); $sel->click_ok("categoryAction-removeInclusion"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); @@ -83,7 +83,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Attachments"); $sel->type_ok("name", "selenium_review"); $sel->type_ok("description", "Review flag used by Selenium"); -$sel->add_selection_ok("inclusion_to_remove", "label=__Any__:__Any__"); +$sel->select_ok("inclusion_to_remove", "label=__Any__:__Any__"); $sel->click_ok("categoryAction-removeInclusion"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Attachments"); @@ -147,10 +147,10 @@ my $aflagtype2_id = $1; file_bug_in_product($sel, 'TestProduct'); $sel->click_ok('//input[@value="Set bug flags"]'); $sel->select_ok("flag_type-$flagtype1_id", "label=+"); +$sel->click_ok('//input[@value="Add an attachment"]'); $sel->type_ok("short_desc", "The selenium flag should be kept on product change"); $sel->type_ok("comment", "pom"); -$sel->click_ok('//input[@value="Add an attachment"]'); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); $sel->type_ok('//input[@name="description"]', "small patch"); @@ -168,66 +168,67 @@ $sel->is_text_present_ok('has been added to the database', 'Bug created'); # Store the bug and flag IDs. my $bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); -$sel->click_ok("link=Bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); -$sel->is_text_present_ok("$config->{admin_user_nick}: selenium"); +go_to_bug($sel, $bug1_id); +$sel->is_element_present_ok( + qq{//div[\@id="bug-flags"]/table/tbody/tr/td[\@class="flag-setter"]/div/a[\@data-user-email="$config->{admin_user_login}"]/../../../td[\@class="flag-name"]/*[text()="selenium"]} +); my $flag1_id = $sel->get_attribute( '//select[@title="Available in TestProduct and Another Product/c1"]@id'); $flag1_id =~ s/flag-//; $sel->selected_label_is("flag-$flag1_id", "+"); -$sel->is_text_present_ok("$config->{admin_user_nick}: selenium_review-"); +$sel->is_element_present_ok( + qq{//div[\@class="attach-flag"]/div/span[text()="$config->{admin_user_nick}"]/../..//a[normalize-space(text())="selenium_review-"]} +); # Now move the bug into the 'Another Product' product. # Both the bug and attachment flags should survive. -$sel->select_ok("product", "label=Another Product"); +$sel->select_ok("product", "label=Another Product"); +$sel->select_ok("component", "label=c1"); $sel->type_ok("comment", "Moving to Another Product / c1. The flag should be preserved."); -$sel->click_ok("commit"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Verify New Product Details..."); -$sel->select_ok("component", "label=c1"); -$sel->click_ok("change_product"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); $sel->selected_label_is("flag-$flag1_id", "+"); -$sel->is_text_present_ok("$config->{admin_user_nick}: selenium_review-"); +$sel->is_element_present_ok( + qq{//div[\@class="attach-flag"]/div/span[text()="$config->{admin_user_nick}"]/../..//a[normalize-space(text())="selenium_review-"]} +); # Now moving the bug into the c2 component. The bug flag # won't survive, but the attachment flag should. $sel->type_ok("comment", "Moving to c2. The selenium flag will be deleted."); $sel->select_ok("component", "label=c2"); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); ok( !$sel->is_element_present("flag-$flag1_id"), "The selenium bug flag didn't survive" ); ok(!$sel->is_element_present("flag_type-$flagtype1_id"), "The selenium flag type doesn't exist"); -$sel->is_text_present_ok("$config->{admin_user_nick}: selenium_review-"); +$sel->is_element_present_ok( + qq{//div[\@class="attach-flag"]/div/span[text()="$config->{admin_user_nick}"]/../..//a[normalize-space(text())="selenium_review-"]} +); # File a bug in 'Another Product / c2' and assign it # to a powerless user, so that he can move it later. file_bug_in_product($sel, 'Another Product'); -$sel->click_ok('//input[@value="Set bug flags"]'); $sel->select_ok("component", "label=c2"); $sel->type_ok("assigned_to", $config->{unprivileged_user_login}); -ok(!$sel->is_editable("flag_type-$flagtype1_id"), - "The selenium bug flag type is displayed but not selectable"); +$sel->click_ok('//input[@value="Set bug flags"]'); +$sel->is_element_present_ok( + qq{//select[\@id="flag_type-$flagtype1_id"][\@disabled]}, + "The selenium bug flag type is not editable"); $sel->select_ok("component", "label=c1"); -$sel->is_editable_ok("flag_type-$flagtype1_id", - "The selenium bug flag type is not selectable"); +$sel->is_element_present_ok( + qq{//select[\@id="flag_type-$flagtype1_id"][not(\@disabled)]}, + "The selenium bug flag type is now editable"); $sel->select_ok("flag_type-$flagtype1_id", "label=?"); $sel->type_ok("requestee_type-$flagtype1_id", $config->{admin_user_login}); $sel->type_ok("short_desc", "Create a new selenium flag for c2"); @@ -239,10 +240,10 @@ $sel->is_text_present_ok('has been added to the database', 'Bug created'); # Store the bug and flag IDs. my $bug2_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); -$sel->click_ok("link=Bug $bug2_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug2_id /); -$sel->is_text_present_ok("$config->{admin_user_nick}: selenium"); +go_to_bug($sel, $bug2_id); +$sel->is_element_present_ok( + qq{//div[\@id="bug-flags"]/table/tbody/tr/td[\@class="flag-setter"]/div/a[\@data-user-email="$config->{admin_user_login}"]/../../../td[\@class="flag-name"]/*[text()="selenium"]} +); my $flag2_id = $sel->get_attribute( '//select[@title="Available in TestProduct and Another Product/c1"]@id'); $flag2_id =~ s/flag-//; @@ -260,7 +261,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); $sel->type_ok("name", "selenium"); $sel->type_ok("description", "Another flag with the selenium name"); -$sel->add_selection_ok("inclusion_to_remove", "label=__Any__:__Any__"); +$sel->select_ok("inclusion_to_remove", "label=__Any__:__Any__"); $sel->click_ok("categoryAction-removeInclusion"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); @@ -292,12 +293,10 @@ my $flagtype2_id = $1; go_to_bug($sel, $bug2_id); $sel->select_ok("component", "label=c2"); $sel->type_ok("comment", "The selenium flag should be preserved."); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug2_id"); -$sel->click_ok("link=bug $bug2_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug2_id /); +go_to_bug($sel, $bug2_id); $sel->selected_label_is("flag-$flag2_id", '?'); ok(!$sel->is_element_present("flag_type-$flagtype1_id"), "Flag type not available in c2"); @@ -309,32 +308,26 @@ logout($sel); log_in($sel, $config, 'unprivileged'); go_to_bug($sel, $bug2_id); $sel->select_ok("flag-$flag2_id", "label=+"); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug2_id"); -$sel->click_ok("link=bug $bug2_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug2_id /); +go_to_bug($sel, $bug2_id); $sel->selected_label_is("flag-$flag2_id", "+"); # But moving the bug into TestProduct will delete the flag # as the flag setter is not in the editbugs group. -$sel->select_ok("product", "label=TestProduct"); +$sel->select_ok("product", "label=TestProduct"); +$sel->select_ok("component", "label=TestComponent"); $sel->type_ok("comment", "selenium flag will be lost. I don't have editbugs privs."); -$sel->click_ok("commit"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Verify New Product Details..."); -$sel->click_ok("change_product"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug2_id"); -$sel->click_ok("link=bug $bug2_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug2_id /); +go_to_bug($sel, $bug2_id); ok(!$sel->is_element_present("flag-$flag2_id"), "Flag $flag2_id deleted"); -ok( - !$sel->is_editable("flag_type-$flagtype1_id"), +$sel->is_element_present_ok( + qq{//select[\@id="flag_type-$flagtype1_id"][\@disabled]}, "Flag type 'selenium' not editable by powerless users" ); ok(!$sel->is_element_present("flag_type-$flagtype2_id"), diff --git a/qa/t/test_groups.t b/qa/t/test_groups.t index d8a07ea10..9a92903b4 100644 --- a/qa/t/test_groups.t +++ b/qa/t/test_groups.t @@ -69,12 +69,12 @@ $sel->value_is("group_${group_id}", "on"); # Must be ON open_advanced_search_page($sel); $sel->remove_all_selections_ok("product"); -$sel->add_selection_ok("product", "TestProduct"); +$sel->select_ok("product", "label=TestProduct"); $sel->remove_all_selections("bug_status"); -$sel->add_selection_ok("bug_status", "UNCONFIRMED"); -$sel->add_selection_ok("bug_status", "CONFIRMED"); -$sel->select_ok("f1", "Group"); -$sel->select_ok("o1", "is equal to"); +$sel->select_ok("bug_status", "label=UNCONFIRMED"); +$sel->select_ok("bug_status", "label=CONFIRMED"); +$sel->select_ok("f1", "Group"); +$sel->select_ok("o1", "is equal to"); $sel->type_ok("v1", "Selenium-test"); $sel->click_ok("Search"); $sel->wait_for_page_to_load(WAIT_TIME); @@ -85,7 +85,8 @@ $sel->type_ok("save_newqueryname", "Selenium bugs"); $sel->click_ok("remember"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("OK, you have a new search named Selenium bugs"); -$sel->click_ok("link=Selenium bugs"); +$sel->click_ok( + '//a[normalize-space(text())="Selenium bugs" and not(@role="option")]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: Selenium bugs"); $sel->is_text_present_ok("One bug found"); @@ -127,7 +128,9 @@ $sel->is_text_present_ok('has been added to the database', # Make sure the new bug doesn't appear in the "Selenium bugs" saved search. -$sel->click_ok("link=Selenium bugs"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="Selenium bugs" and @role="option"]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: Selenium bugs"); $sel->is_text_present_ok("One bug found"); @@ -157,7 +160,9 @@ $sel->is_text_present_ok("The group will now be used for bugs"); # Make sure the second filed bug has not been added to the bug group. -$sel->click_ok("link=Selenium bugs"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="Selenium bugs" and @role="option"]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: Selenium bugs"); $sel->is_text_present_ok("One bug found"); @@ -188,7 +193,9 @@ $sel->is_text_present_ok( # All bugs being in TestProduct must now be restricted to the bug group. -$sel->click_ok("link=Selenium bugs"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="Selenium bugs" and @role="option"]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: Selenium bugs"); $sel->is_element_present_ok("b$bug1_id", undef, @@ -216,7 +223,9 @@ $sel->is_text_present_ok('has been added to the database', # Make sure all three bugs are listed as being restricted to the bug group. -$sel->click_ok("link=Selenium bugs"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="Selenium bugs" and @role="option"]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: Selenium bugs"); $sel->is_element_present_ok("b$bug1_id", undef, @@ -260,7 +269,9 @@ $sel->is_text_present_ok('has been added to the database', # The last bug must not be in the list. -$sel->click_ok("link=Selenium bugs"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="Selenium bugs" and @role="option"]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: Selenium bugs"); $sel->is_element_present_ok("b$bug1_id", undef, @@ -292,7 +303,9 @@ $sel->is_text_present_ok("The group will now be used for bugs"); # Make sure all bugs are restricted to the bug group. -$sel->click_ok("link=Selenium bugs"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="Selenium bugs" and @role="option"]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: Selenium bugs"); $sel->is_element_present_ok("b$bug1_id", undef, @@ -346,8 +359,8 @@ ok($error_msg =~ /^The Selenium-test group cannot be deleted/, "Group is in use - not deletable"); $sel->go_back_ok(); $sel->wait_for_page_to_load(WAIT_TIME); -$sel->check("removebugs"); -$sel->check("unbind"); +$sel->check_ok("removebugs"); +$sel->check_ok("unbind"); $sel->click_ok("delete"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Group Deleted"); @@ -355,11 +368,13 @@ $sel->is_text_present_ok("The group Selenium-test has been deleted."); # No more bugs listed in the saved search as the bug group is gone. -$sel->click_ok("link=Selenium bugs"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok( + '//a[normalize-space(text())="Selenium bugs" and @role="option"]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: Selenium bugs"); $sel->is_text_present_ok("Zarro Boogs found"); -$sel->click_ok("link=Forget Search 'Selenium bugs'"); +$sel->click_ok('forget-search', 'Forget Search'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Search is gone"); $sel->is_text_present_ok("OK, the Selenium bugs search is gone."); diff --git a/qa/t/test_keywords.t b/qa/t/test_keywords.t index 82fcd41f3..4349f342a 100644 --- a/qa/t/test_keywords.t +++ b/qa/t/test_keywords.t @@ -110,13 +110,13 @@ go_to_bug($sel, $test_bug_1); # If another script is playing with keywords too, don't mess with it. my $kw1 = $sel->get_text("keywords"); $sel->type_ok("keywords", "$kw1, key-selenium-kone"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $test_bug_1"); go_to_bug($sel, $test_bug_2); my $kw2 = $sel->get_text("keywords"); $sel->type_ok("keywords", "$kw2, key-selenium-kone, key-selenium-ktwo"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $test_bug_2"); @@ -131,9 +131,7 @@ $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List"); $sel->is_text_present_ok("2 bugs found"); -$sel->click_ok('//*[@class="link-search"]//a'); -$sel->wait_for_page_to_load(WAIT_TIME); -$sel->title_is("Search for bugs"); +open_advanced_search_page($sel); $sel->remove_all_selections("product"); $sel->remove_all_selections("bug_status"); @@ -144,9 +142,7 @@ $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List"); $sel->is_text_present_ok("One bug found"); -$sel->click_ok('//*[@class="link-search"]//a'); -$sel->wait_for_page_to_load(WAIT_TIME); -$sel->title_is("Search for bugs"); +open_advanced_search_page($sel); $sel->remove_all_selections("product"); $sel->remove_all_selections("bug_status"); diff --git a/qa/t/test_milestones.t b/qa/t/test_milestones.t index c9da02669..7a8b926ed 100644 --- a/qa/t/test_milestones.t +++ b/qa/t/test_milestones.t @@ -76,9 +76,10 @@ $sel->is_text_present_ok('has been added to the database', # 4th step: edit the bug (test musthavemilestoneonaccept ON). +go_to_bug($sel, $bug1_id); $sel->select_ok("bug_status", "label=IN_PROGRESS", "Change bug status to IN_PROGRESS"); -$sel->click_ok("commit", undef, "Save changes"); +$sel->click_ok("bottom-save-btn", undef, "Save changes"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is( "Milestone Required", @@ -91,7 +92,7 @@ $sel->is_text_present_ok("You must select a target milestone", go_to_bug($sel, $bug1_id); $sel->select_ok("target_milestone", "label=2.0", "Select a non-default milestone"); -$sel->click_ok("commit", undef, "Save changes (2nd attempt)"); +$sel->click_ok("bottom-save-btn", undef, "Save changes (2nd attempt)"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); @@ -121,8 +122,9 @@ $sel->is_text_present_ok('has been added to the database', # 6th step: edit the bug (test musthavemilestoneonaccept ON). +go_to_bug($sel, $bug2_id); $sel->select_ok("bug_status", "label=IN_PROGRESS"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn", undef, 'Save changes'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug2_id"); @@ -181,8 +183,7 @@ $sel->title_is("Milestone Deleted"); # 8th step: make sure the (now deleted) milestone of the bug has fallen back to the default milestone. -$sel->open_ok("/show_bug.cgi?id=$bug1_id"); -$sel->title_like(qr/^$bug1_id/); +go_to_bug($sel, $bug1_id); $sel->is_text_present_ok('regexp:Target Milestone:\W+---', undef, "Milestone has fallen back to the default milestone"); @@ -211,8 +212,9 @@ $sel->is_text_present_ok('has been added to the database', # 10th step: musthavemilestoneonaccept must have no effect as there is # no other milestone available besides the default one. +go_to_bug($sel, $bug3_id); $sel->select_ok("bug_status", "label=IN_PROGRESS"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn", undef, 'Save changes'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug3_id"); diff --git a/qa/t/test_private_attachments.t b/qa/t/test_private_attachments.t index 3c5de56e6..43a614f3e 100644 --- a/qa/t/test_private_attachments.t +++ b/qa/t/test_private_attachments.t @@ -37,8 +37,8 @@ set_parameters( file_bug_in_product($sel, "TestProduct"); $sel->type_ok("short_desc", "Some comments are private"); $sel->type_ok("comment", "and some attachments too, like this one."); -$sel->check_ok("comment_is_private"); $sel->click_ok('//input[@value="Add an attachment"]'); +$sel->check_ok("comment_is_private"); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); $sel->type_ok('//input[@name="description"]', "private attachment, v1"); $sel->check_ok('//input[@name="ispatch"]'); @@ -46,14 +46,15 @@ $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok('has been added to the database', 'Bug created'); my $bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); -$sel->is_text_present_ok("private attachment, v1 ("); +go_to_bug($sel, $bug1_id); +$sel->is_text_present_ok("private attachment, v1"); $sel->is_text_present_ok("and some attachments too, like this one."); $sel->is_checked_ok( - '//a[@id="comment_link_0"]/../..//div//input[@type="checkbox"]'); + '//div[@class="comment" and @data-no="0"]//input[@class="is-private"]'); # Now attach a public patch to the existing bug. -$sel->click_ok("link=Add an attachment"); +$sel->click_ok('attachments-add-link'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); @@ -76,14 +77,12 @@ my $attachment1_id = $1; # Be sure to redisplay the same bug, and make sure the new attachment is visible. -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id/); +go_to_bug($sel, $bug1_id); $sel->is_text_present_ok("public attachment, v2"); $sel->is_text_present_ok("this patch is public. Everyone can see it."); ok( !$sel->is_checked( - '//a[@id="comment_link_1"]/../..//div//input[@type="checkbox"]'), + '//div[@class="comment" and @data-no="1"]//input[@class="is-private"]'), "Public attachment is visible" ); logout($sel); @@ -91,9 +90,9 @@ logout($sel); # A logged out user cannot see the private attachment, only the public one. # Same for a user with no privs. -foreach my $user ('', 'unprivileged') { +foreach my $user (undef, 'unprivileged') { log_in($sel, $config, $user) if $user; - go_to_bug($sel, $bug1_id); + go_to_bug($sel, $bug1_id, ($user ? 0 : 1)); ok(!$sel->is_text_present("private attachment, v1"), "Private attachment not visible"); $sel->is_text_present_ok("public attachment, v2"); @@ -115,15 +114,13 @@ $sel->click_ok("update"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok( "Changes to attachment $attachment1_id of bug $bug1_id submitted"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id/); +go_to_bug($sel, $bug1_id); $sel->is_text_present_ok("This attachment is not mine"); # Powerless users will always be able to view their own attachments, even # when those are marked private by a member of the insider group. -$sel->click_ok("link=Add an attachment"); +$sel->click_ok('attachments-add-link', 'Add an attachment'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); @@ -141,10 +138,8 @@ $alink = $sel->get_attribute( '//a[@title="My patch, which I should see, always"]@href'); $alink =~ /id=(\d+)/; my $attachment2_id = $1; -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id/); -$sel->is_text_present_ok("My patch, which I should see, always ("); +go_to_bug($sel, $bug1_id); +$sel->is_text_present_ok("My patch, which I should see, always"); $sel->is_text_present_ok("This is my patch!"); logout($sel); @@ -157,32 +152,27 @@ $sel->click_ok('//a[contains(@href,"/attachment.cgi?id=' . '&action=edit")]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^Attachment $attachment2_id Details for Bug $bug1_id/); +$sel->click_ok('link=edit details', 'Edit attachment details'); $sel->check_ok("isprivate"); $sel->type_ok("comment", "Making the powerless user's patch private."); $sel->click_ok("update"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok( "Changes to attachment $attachment2_id of bug $bug1_id submitted"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id/); -$sel->is_text_present_ok("My patch, which I should see, always ("); +go_to_bug($sel, $bug1_id); +$sel->is_text_present_ok("My patch, which I should see, always"); $sel->is_checked_ok( - '//a[@id="comment_link_4"]/../..//div//input[@type="checkbox"]'); + '//div[@class="comment" and @data-no="4"]//input[@class="is-private"]'); $sel->is_text_present_ok("Making the powerless user's patch private."); logout($sel); # A logged out user cannot see private attachments. -go_to_bug($sel, $bug1_id); +go_to_bug($sel, $bug1_id, 1); ok( !$sel->is_text_present("private attachment, v1"), "Private attachment not visible to logged out users" ); -ok( - !$sel->is_text_present("My patch, which I should see, always ("), - "Private attachment not visible to logged out users" -); $sel->is_text_present_ok("This is my patch!"); ok(!$sel->is_text_present("Making the powerless user's patch private"), "Private comment not visible to logged out users"); @@ -191,7 +181,7 @@ ok(!$sel->is_text_present("Making the powerless user's patch private"), log_in($sel, $config, 'unprivileged'); go_to_bug($sel, $bug1_id); -$sel->is_text_present_ok("My patch, which I should see, always ("); +$sel->is_text_present_ok("My patch, which I should see, always"); $sel->click_ok("link=My patch, which I should see, always"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -219,9 +209,7 @@ $sel->click_ok("delete"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok( "Changes to attachment $attachment2_id of bug $bug1_id submitted"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id/); +go_to_bug($sel, $bug1_id); $sel->is_text_present_ok("deleted by Selenium"); $sel->click_ok("link=attachment $attachment2_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); diff --git a/qa/t/test_qa_contact.t b/qa/t/test_qa_contact.t index 9de4fb21f..850c895a2 100644 --- a/qa/t/test_qa_contact.t +++ b/qa/t/test_qa_contact.t @@ -18,16 +18,13 @@ my ($sel, $config) = get_selenium(); # First make sure the 'My QA query' saved search is gone. log_in($sel, $config, 'admin'); -if ($sel->is_text_present("My QA query")) { - $sel->open_ok( - "/buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=My%20QA%20query", - undef, "Make sure the 'My QA query' saved search isn't present" - ); - -# We bypass the UI to delete the saved search, and so Bugzilla should complain about the missing token. - $sel->title_is("Suspicious Action"); - $sel->is_text_present_ok("It looks like you didn't come from the right page"); - $sel->click_ok("confirm"); +$sel->click_ok('quicksearch_top'); +if ($sel->is_element_present( + '//a[normalize-space(text())="My QA query" and @role="option"]')) +{ + $sel->click_ok('//a[normalize-space(text())="My QA query" and @role="option"]'); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->click_ok('forget-search', 'Forget search'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search is gone"); my $text = trim($sel->get_text("message")); @@ -61,10 +58,10 @@ my $bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); open_advanced_search_page($sel); $sel->remove_all_selections_ok("product"); -$sel->add_selection_ok("product", "TestProduct"); +$sel->select_ok("product", "label=TestProduct"); $sel->remove_all_selections("bug_status"); -$sel->select_ok("f1", "label=QA Contact"); -$sel->select_ok("o1", "label=is equal to"); +$sel->select_ok("f1", "value=qa_contact"); +$sel->select_ok("o1", "value=equals"); $sel->type_ok( "v1", $config->{unprivileged_user_login}, @@ -82,7 +79,8 @@ $sel->title_is("Search created"); my $text = trim($sel->get_text("message")); ok($text =~ /OK, you have a new search named My QA query/, "New saved search 'My QA query'"); -$sel->click_ok("link=My QA query"); +$sel->click_ok( + '//a[normalize-space(text())="My QA query" and not(@role="option")]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: My QA query"); $sel->is_element_present_ok("b$bug1_id", undef, "Bug $bug1_id is on the list"); @@ -93,25 +91,26 @@ $sel->is_text_present_ok("Test for QA contact"); # and privs!) set_parameters($sel, {"Bug Fields" => {"useqacontact-off" => undef}}); -$sel->click_ok("link=My QA query"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok('//a[normalize-space(text())="My QA query" and @role="option"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: My QA query"); $sel->is_text_present_ok("One bug found"); $sel->is_element_present_ok("b$bug1_id", undef, "Bug $bug1_id is on the list"); -$sel->click_ok("link=$bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); # The 'QA Contact' label must not be displayed. +go_to_bug($sel, $bug1_id); ok(!$sel->is_element_present('//label[@for="qa_contact"]')); logout($sel); # You cannot access the bug when being logged out, as it's restricted # to the Master group. -$sel->type_ok("quicksearch_top", $bug1_id); -$sel->submit("header-search"); +go_to_home($sel); +$sel->type_ok('quicksearch_top', $bug1_id); +$sel->submit('header-search'); $sel->wait_for_page_to_load_ok(WAIT_TIME); +sleep(1); # FIXME $sel->title_is("Access Denied"); $sel->is_text_present_ok("You are not authorized to access bug"); @@ -151,6 +150,7 @@ logout($sel); # some user prefs correctly to not interfere with our test. log_in($sel, $config, 'unprivileged'); +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -165,10 +165,10 @@ $sel->title_is("User Preferences"); open_advanced_search_page($sel); $sel->remove_all_selections_ok("product"); -$sel->add_selection_ok("product", "TestProduct"); +$sel->select_ok("product", "label=TestProduct"); $sel->remove_all_selections_ok("bug_status"); -$sel->select_ok("f1", "label=QA Contact"); -$sel->select_ok("o1", "label=is equal to"); +$sel->select_ok("f1", "value=qa_contact"); +$sel->select_ok("o1", "value=equals"); $sel->type_ok( "v1", $config->{unprivileged_user_login}, @@ -180,17 +180,14 @@ $sel->title_is("Bug List"); $sel->is_text_present_ok("One bug found"); $sel->is_element_present_ok("b$bug1_id", undef, "Bug $bug1_id is on the list"); $sel->is_text_present_ok("Test for QA contact"); -$sel->click_ok("link=$bug1_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/$bug1_id /); -$sel->click_ok("bz_qa_contact_edit_action"); +go_to_bug($sel, $bug1_id); $sel->value_is( "qa_contact", $config->{unprivileged_user_login}, "The powerless user is the current QA contact" ); -$sel->check_ok("set_default_qa_contact"); -$sel->click_ok("commit"); +$sel->type_ok("qa_contact", " "); +$sel->click_ok('bottom-save-btn'); # The user is no longer the QA contact, and he has no other role # with the bug. He can no longer see it. diff --git a/qa/t/test_saved_searches.t b/qa/t/test_saved_searches.t index 920385b19..09c72833f 100644 --- a/qa/t/test_saved_searches.t +++ b/qa/t/test_saved_searches.t @@ -18,6 +18,7 @@ my ($sel, $config) = get_selenium(); # If a saved search named 'SavedSearchTEST1' exists, remove it. log_in($sel, $config, 'QA_Selenium_TEST'); +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -52,12 +53,14 @@ ok( $text =~ /OK, you have a new search named SavedSearchTEST1./, "New search named SavedSearchTEST1 has been created" ); -$sel->click_ok("link=SavedSearchTEST1"); +$sel->click_ok( + '//a[normalize-space(text())="SavedSearchTEST1" and not(@role="option")]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: SavedSearchTEST1"); # Remove the saved search from the Search Bar. It should no longer be displayed there. +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -104,6 +107,7 @@ ok( # As the saved search is no longer displayed in the Search Bar, we have to go # to the "Preferences" page to edit it. +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -117,13 +121,13 @@ $sel->click_ok( ); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: SavedSearchTEST1"); -$sel->click_ok("link=Edit Search"); +$sel->click_ok('edit-search', 'Edit Search'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search for bugs"); $sel->value_is("short_desc", "bilboa"); $sel->go_back_ok(); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->click_ok("link=Forget Search 'SavedSearchTEST1'"); +$sel->click_ok('forget-search', 'Forget Search'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search is gone"); $text = trim($sel->get_text("message")); diff --git a/qa/t/test_search.t b/qa/t/test_search.t index 9576772ba..f03adb8ab 100644 --- a/qa/t/test_search.t +++ b/qa/t/test_search.t @@ -18,7 +18,7 @@ my ($sel, $config) = get_selenium(); # First, a very trivial search, which returns no result. -go_to_home($sel, $config); +go_to_home($sel); open_advanced_search_page($sel); $sel->type_ok("short_desc", "ois£jdfm#sd%fasd!fm", "Type a non-existent string in the bug summary field"); @@ -29,9 +29,7 @@ $sel->is_text_present_ok("Zarro Boogs found"); # Display all available columns. Look for all bugs assigned to a user who doesn't exist. -$sel->open_ok( - "/buglist.cgi?quicksearch=%40xx45ft&columnlist=all" -); +$sel->open_ok("/buglist.cgi?quicksearch=%40xx45ft&columnlist=all"); $sel->title_like(qr/^Bug List:/); $sel->is_text_present_ok("Zarro Boogs found"); @@ -43,11 +41,11 @@ my $bug_summary = "Update this summary with this bug ID"; $sel->type_ok("short_desc", $bug_summary); $sel->type_ok("comment", "I'm supposed to appear in the coming buglist."); my $bug1_id = create_bug($sel, $bug_summary); -$sel->click_ok("editme_action"); +go_to_bug($sel, $bug1_id); $bug_summary .= ": my ID is $bug1_id"; $sel->type_ok("short_desc", $bug_summary); $sel->type_ok("comment", "Updating bug summary...."); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); @@ -59,7 +57,7 @@ $sel->remove_all_selections("resolution"); $sel->type_ok("short_desc", "my ID is $bug1_id"); $sel->select_ok("f1", "label=Commenter"); $sel->select_ok("o1", "label=is equal to"); -$sel->type_ok("v1", "%user%"); +$sel->type_ok("v1", "\%user\%"); $sel->click_ok("add_button"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search for bugs"); diff --git a/qa/t/test_security.t b/qa/t/test_security.t index 9915a21e1..1919912bd 100644 --- a/qa/t/test_security.t +++ b/qa/t/test_security.t @@ -23,6 +23,7 @@ file_bug_in_product($sel, "TestProduct"); my $bug_summary = "Security checks"; $sel->type_ok("short_desc", $bug_summary); $sel->type_ok("comment", "This bug will be used to test security fixes."); +$sel->click_ok('//input[@value="Add an attachment"]'); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); $sel->type_ok('//input[@name="description"]', "simple patch, v1"); my $bug1_id = create_bug($sel, $bug_summary); @@ -41,29 +42,31 @@ go_to_bug($sel, $bug1_id); $sel->click_ok("link=simple patch, v1"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is(""); -my @cookies = split(/[\s;]+/, $sel->get_cookie()); -my $nb_cookies = scalar @cookies; -ok($nb_cookies, "Found $nb_cookies cookies:\n" . join("\n", @cookies)); -ok(!$sel->is_cookie_present("Bugzilla_login"), "Bugzilla_login not accessible"); -ok(!$sel->is_cookie_present("Bugzilla_logincookie"), - "Bugzilla_logincookie not accessible"); +my $cookies = $sel->get_all_cookies(); +my $nb_cookies = scalar @$cookies; +ok($nb_cookies, "Found $nb_cookies cookies"); +my %cookies = map { $_->{name} => $_->{value} } @$cookies; +ok(exists $cookies{Bugzilla_login}, "Bugzilla_login is accessible"); +ok(exists $cookies{Bugzilla_logincookie}, "Bugzilla_logincookie is accessible"); $sel->go_back_ok(); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^$bug1_id /); -# # Alternate host for attachments; no cookie should be accessible. +# Alternate host for attachments; no cookie should be accessible. +# FIXME: Figure out how to do this properly in a CI environment. +# Bugzilla->process_cache->{localconfig}->{attachment_base} = 'http://bmo.attachment/'; -# set_parameters($sel, { "Attachments" => {"attachment_base" => {type => "text", -# value => "$config->{browser_ip_url}/"}} }); # go_to_bug($sel, $bug1_id); # $sel->click_ok("link=simple patch, v1"); # $sel->wait_for_page_to_load_ok(WAIT_TIME); # $sel->title_is(""); -# @cookies = split(/[\s;]+/, $sel->get_cookie()); -# $nb_cookies = scalar @cookies; +# $cookies = $sel->get_all_cookies(); +# $nb_cookies = scalar @$cookies; # ok(!$nb_cookies, "No cookies found"); -# ok(!$sel->is_cookie_present("Bugzilla_login"), "Bugzilla_login not accessible"); -# ok(!$sel->is_cookie_present("Bugzilla_logincookie"), "Bugzilla_logincookie not accessible"); +# my %cookies = map { $_->{name} => $_->{value} } @$cookies; +# ok(!exists $cookies{Bugzilla_login}, "Bugzilla_login not accessible"); +# ok(!exists $cookies{Bugzilla_logincookie}, +# "Bugzilla_logincookie not accessible"); # $sel->go_back_ok(); # $sel->wait_for_page_to_load_ok(WAIT_TIME); # $sel->title_like(qr/^$bug1_id /); @@ -72,6 +75,7 @@ $sel->title_like(qr/^$bug1_id /); # Security bug 472362. ####################################################################### +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -79,6 +83,7 @@ my $admin_cookie = $sel->get_value("token"); logout($sel); log_in($sel, $config, 'editbugs'); +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -99,8 +104,7 @@ my @args = ("", "token=", "token=i123x", "token=$admin_cookie", "token=$editbugs_cookie"); foreach my $arg (@args) { - $sel->open_ok( - "/userprefs.cgi?tab=settings&dosave=1&display_quips=off&$arg"); + $sel->open_ok("/userprefs.cgi?tab=settings&dosave=1&display_quips=off&$arg"); $sel->title_is("Suspicious Action"); if ($arg eq "token=$admin_cookie") { @@ -138,7 +142,7 @@ ok(!$sel->is_text_present("secret_qa_bug_$bug2_id"), $sel->is_text_present_ok($bug2_id); logout($sel); -go_to_bug($sel, $bug1_id); +go_to_bug($sel, $bug1_id, 1); ok(!$sel->is_text_present("secret_qa_bug_$bug2_id"), "The alias 'secret_qa_bug_$bug2_id' is not visible for logged out users"); $sel->is_text_present_ok($bug2_id); diff --git a/qa/t/test_shared_searches.t b/qa/t/test_shared_searches.t index 29653b4f2..d9833b3b2 100644 --- a/qa/t/test_shared_searches.t +++ b/qa/t/test_shared_searches.t @@ -29,8 +29,9 @@ set_parameters( # Create new saved search and call it 'Shared Selenium buglist'. $sel->type_ok("quicksearch_top", ":TestProduct Selenium"); -$sel->submit("header-search"); +$sel->submit('header-search'); $sel->wait_for_page_to_load_ok(WAIT_TIME); +sleep(1); $sel->title_like(qr/^Bug List:/); $sel->type_ok("save_newqueryname", "Shared Selenium buglist"); $sel->click_ok("remember"); @@ -45,6 +46,7 @@ ok( # Retrieve the newly created saved search's internal ID and make sure it's displayed # in the Search Bar by default. +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -84,6 +86,7 @@ ok(!$sel->is_text_present("Forget Search 'Shared Selenium buglist'"), # The name of the sharer must appear in the "Saved Searches" section. +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -113,8 +116,9 @@ ok( # Create your own saved search, and share it with the canconfirm group. $sel->type_ok("quicksearch_top", ":TestProduct sw:helpwanted"); -$sel->submit("header-search"); +$sel->submit('header-search'); $sel->wait_for_page_to_load_ok(WAIT_TIME); +sleep(1); $sel->title_like(qr/^Bug List:/); $sel->type_ok("save_newqueryname", "helpwanted"); $sel->click_ok("remember"); @@ -126,6 +130,7 @@ ok( "New search named helpwanted has been created" ); +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -152,16 +157,17 @@ logout($sel); log_in($sel, $config, 'admin'); $sel->click_ok("quicksearch_top"); ok( - !$sel->is_text_present("helpwanted"), + !$sel->is_element_present( + '//a[normalize-space(text())="helpwanted" and @role="option"]'), "No 'helpwanted' shared search displayed" ); +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); $sel->click_ok("link=Saved Searches"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); -$sel->click_ok("quicksearch_top"); $sel->is_text_present_ok("helpwanted"); $sel->is_text_present_ok($config->{canconfirm_user_login}); @@ -175,12 +181,14 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); # This query is now available from the Search Bar. -$sel->click_ok("link=helpwanted"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); +$sel->click_ok('quicksearch_top'); +$sel->click_ok('//a[normalize-space(text())="helpwanted" and @role="option"]'), + $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: helpwanted"); # Remove the 'Shared Selenium buglist' query. +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -207,8 +215,12 @@ logout($sel); log_in($sel, $config, 'QA_Selenium_TEST'); $sel->click_ok("quicksearch_top"); -ok(!$sel->is_text_present("helpwanted"), - "The 'helpwanted' query is not displayed in the Search Bar"); +ok( + !$sel->is_element_present( + '//a[normalize-space(text())="helpwanted" and @role="option"]'), + "The 'helpwanted' query is not displayed in the Search Bar" +); +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -223,6 +235,7 @@ logout($sel); # Now remove the 'helpwanted' saved search. log_in($sel, $config, 'canconfirm'); +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); diff --git a/qa/t/test_show_all_products.t b/qa/t/test_show_all_products.t index 7e7550cc7..0357bd324 100644 --- a/qa/t/test_show_all_products.t +++ b/qa/t/test_show_all_products.t @@ -28,7 +28,8 @@ set_parameters($sel, {"Bug Fields" => {"useclassification-on" => undef}}); $sel->click_ok('//*[@class="link-file"]//a'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Enter Bug"); -$sel->click_ok("link=Other Products", undef, "Choose full product list"); +$sel->click_ok('//a/span[contains(text(),"Other Products")]', + undef, "Choose full product list"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Enter Bug"); ok( @@ -49,7 +50,8 @@ if ($sel->is_text_present('None of the above; my bug is in')) { $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Enter Bug"); } -$sel->click_ok('link=Other Products'); +$sel->click_ok('//a/span[contains(text(),"Other Products")]', + undef, "Choose full product list"); $sel->wait_for_page_to_load_ok(WAIT_TIME); # For some unknown reason, Selenium doesn't like hyphens in links. diff --git a/qa/t/test_status_whiteboard.t b/qa/t/test_status_whiteboard.t index c7f1418b3..56edd3e7e 100644 --- a/qa/t/test_status_whiteboard.t +++ b/qa/t/test_status_whiteboard.t @@ -25,17 +25,15 @@ set_parameters($sel, {'Bug Fields' => {'usestatuswhiteboard-on' => undef}}); # Make sure the status whiteboard is displayed and add stuff to it. -$sel->open_ok("/show_bug.cgi?id=$test_bug_1"); -$sel->title_like(qr/^$test_bug_1\b/); +go_to_bug($sel, $test_bug_1); $sel->is_text_present_ok("Whiteboard:"); $sel->type_ok("status_whiteboard", "[msg from test_status_whiteboard.t: x77v]"); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn', 'Save changes'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $test_bug_1"); -$sel->open_ok("/show_bug.cgi?id=$test_bug_2"); -$sel->title_like(qr/^$test_bug_2\b/); +go_to_bug($sel, $test_bug_2); $sel->type_ok("status_whiteboard", "[msg from test_status_whiteboard.t: x77v]"); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn', 'Save changes'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $test_bug_2"); @@ -60,7 +58,8 @@ ok($text =~ /you have a new search named sw-x77v/, # Make sure the saved query works. -$sel->click_ok("link=sw-x77v"); +$sel->click_ok( + '//a[normalize-space(text())="sw-x77v" and not(@role="option")]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: sw-x77v"); $sel->is_text_present_ok("2 bugs found"); @@ -72,25 +71,21 @@ $sel->is_text_present_ok("2 bugs found"); set_parameters($sel, {'Bug Fields' => {'usestatuswhiteboard-off' => undef}}); # Show detailed bug information panel on advanced search -ok($sel->create_cookie('TUI=information_query=1'), - 'Show detailed bug information'); -$sel->click_ok('//*[@class="link-search"]//a'); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Search for bugs"); +open_advanced_search_page($sel); ok(!$sel->is_text_present("Whiteboard:"), "Whiteboard label no longer displayed"); -$sel->open_ok("/show_bug.cgi?id=$test_bug_1"); -$sel->title_like(qr/^$test_bug_1\b/); +go_to_bug($sel, $test_bug_1); ok(!$sel->is_element_present('//label[@for="status_whiteboard"]')); # Queries based on the status whiteboard should still work when # the parameter is off. -$sel->click_ok("link=sw-x77v"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok('//a[normalize-space(text())="sw-x77v" and @role="option"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: sw-x77v"); $sel->is_text_present_ok("2 bugs found"); -$sel->click_ok("link=Forget Search 'sw-x77v'"); +$sel->click_ok('forget-search'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search is gone"); $sel->is_text_present_ok("OK, the sw-x77v search is gone."); diff --git a/qa/t/test_sudo_sessions.t b/qa/t/test_sudo_sessions.t index a8cdbb20e..90e153d5a 100644 --- a/qa/t/test_sudo_sessions.t +++ b/qa/t/test_sudo_sessions.t @@ -92,6 +92,7 @@ ok( # Make sure this user is not an admin and has no privs at all, and that # he cannot access editusers.cgi (despite the sudoer can). +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -106,6 +107,7 @@ $sel->title_is("Authorization Required"); $error_msg = trim($sel->get_text("error_msg")); ok($error_msg =~ /^Sorry, you aren't a member of the 'editusers' group/, "Not a member of the editusers group"); +$sel->click_ok('header-account-menu-button'); $sel->click_ok( "link=End sudo session impersonating " . $config->{unprivileged_user_login}); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -115,8 +117,7 @@ $sel->is_text_present_ok("The sudo session has been ended"); # Try to access the sudo page directly, with no credentials. $sel->open_ok( - "/relogin.cgi?action=begin-sudo&target_login=$config->{admin_user_login}" -); + "/relogin.cgi?action=begin-sudo&target_login=$config->{admin_user_login}"); $sel->title_is("Password Required"); # The link should populate the target_login field correctly. @@ -154,9 +155,7 @@ $sel->title_is("Password Required"); # Same as above, but with your password. -$sel->open_ok( - "/relogin.cgi?action=prepare-sudo&target_login=foo\@bar.com" -); +$sel->open_ok("/relogin.cgi?action=prepare-sudo&target_login=foo\@bar.com"); $sel->title_is("Begin sudo session"); $sel->value_is("target_login", 'foo@bar.com'); $sel->type_ok( diff --git a/qa/t/test_target_milestones.t b/qa/t/test_target_milestones.t index 9a67fe61f..fb7072498 100644 --- a/qa/t/test_target_milestones.t +++ b/qa/t/test_target_milestones.t @@ -40,9 +40,9 @@ $sel->title_is("Milestone Created"); # Edit the milestone of test_bug_1. go_to_bug($sel, $test_bug_1); -$sel->is_text_present_ok("Target Milestone:"); +$sel->is_text_present_ok("Target:"); $sel->select_ok("target_milestone", "label=TM1"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $test_bug_1"); @@ -51,8 +51,8 @@ $sel->is_text_present_ok("Changes submitted for bug $test_bug_1"); open_advanced_search_page($sel); $sel->is_text_present_ok("Target Milestone:"); $sel->remove_all_selections_ok("product"); -$sel->add_selection_ok("product", "label=TestProduct"); -$sel->add_selection_ok("target_milestone", "label=TM1"); +$sel->select_ok("product", "label=TestProduct"); +$sel->select_ok("target_milestone", "label=TM1"); $sel->click_ok("Search"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List"); @@ -71,9 +71,8 @@ ok( set_parameters($sel, {"Bug Fields" => {"usetargetmilestone-off" => undef}}); -$sel->click_ok('//*[@class="link-search"]//a'); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Search for bugs"); +open_advanced_search_page($sel); + ok( !$sel->is_text_present("Target Milestone:"), "The target milestone field is no longer displayed" @@ -84,11 +83,12 @@ ok(!$sel->is_element_present('//label[@for="target_milestone"]')); # The existing query must still work despite milestones are off now. -$sel->click_ok("link=selenium_m0"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok('//a[normalize-space(text())="selenium_m0" and @role="option"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: selenium_m0"); $sel->is_text_present_ok("One bug found"); -$sel->click_ok("link=Forget Search 'selenium_m0'"); +$sel->click_ok('forget-search'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search is gone"); $text = trim($sel->get_text("message")); diff --git a/qa/t/test_time_summary.t b/qa/t/test_time_summary.t index 7f977303b..fc7349206 100644 --- a/qa/t/test_time_summary.t +++ b/qa/t/test_time_summary.t @@ -34,7 +34,7 @@ set_parameters( go_to_bug($sel, $test_bug_1); $sel->type_ok("work_time", 2.6); $sel->type_ok("comment", "I did some work"); -$sel->click_ok("commit"); +$sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $test_bug_1"); @@ -57,8 +57,8 @@ ok($error_msg =~ /You apparently didn't choose any bugs to view/, open_advanced_search_page($sel); $sel->remove_all_selections("bug_status"); -$sel->select_ok("f1", "label=Hours Worked"); -$sel->select_ok("o1", "label=is greater than"); +$sel->select_ok("f1", "value=work_time"); +$sel->select_ok("o1", "value=greaterthan"); $sel->type_ok("v1", "0"); $sel->click_ok("Search"); $sel->wait_for_page_to_load_ok(WAIT_TIME); diff --git a/qa/t/test_user_groups.t b/qa/t/test_user_groups.t index a5df2d928..c281b1e5d 100644 --- a/qa/t/test_user_groups.t +++ b/qa/t/test_user_groups.t @@ -54,7 +54,7 @@ $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("New Group Created"); my $slave_gid = $sel->get_value("group_id"); -$sel->add_selection_ok("members_add", "label=Master"); +$sel->select_ok("members_add", "label=Master"); $sel->click_ok('//input[@value="Update Group"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Group: Slave"); diff --git a/qa/t/test_user_matching.t b/qa/t/test_user_matching.t index b2dc25e19..3d3217b79 100644 --- a/qa/t/test_user_matching.t +++ b/qa/t/test_user_matching.t @@ -32,28 +32,26 @@ set_parameters( ); go_to_bug($sel, $test_bug_1); -$sel->click_ok("cc_edit_area_showhide"); +$sel->click_ok("add-cc-btn"); # We enter an incomplete email address. process_bug.cgi must ask # for confirmation as confirmuniqueusermatch is turned on. -$sel->type_ok("newcc", $config->{unprivileged_user_login_truncated}); -$sel->click_ok("commit"); +$sel->type_ok("add-cc", $config->{unprivileged_user_login_truncated}); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Confirm Match"); $sel->is_text_present_ok( "$config->{unprivileged_user_login_truncated} matched"); -$sel->go_back_ok(); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$test_bug_1/); -$sel->click_ok("cc_edit_area_showhide"); +go_to_bug($sel, $test_bug_1); +$sel->click_ok("add-cc-btn"); # We now enter a complete and valid email address, so it must be accepted. # confirmuniqueusermatch = 1 must not trigger the confirmation page as we # type the complete email address. -$sel->type_ok("newcc", $config->{unprivileged_user_login}); -$sel->click_ok("commit"); +$sel->type_ok("add-cc", $config->{unprivileged_user_login}); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $test_bug_1"); @@ -61,21 +59,19 @@ $sel->is_text_present_ok("Changes submitted for bug $test_bug_1"); # a confirmation page must be displayed. go_to_bug($sel, $test_bug_1); -$sel->click_ok("cc_edit_area_showhide"); -$sel->type_ok("newcc", "$config->{unprivileged_user_login_truncated}*"); -$sel->click_ok("commit"); +$sel->click_ok("add-cc-btn"); +$sel->type_ok("add-cc", "$config->{unprivileged_user_login_truncated}*"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Confirm Match"); $sel->is_text_present_ok("<$config->{unprivileged_user_login}>"); -$sel->go_back_ok(); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$test_bug_1/); -$sel->click_ok("cc_edit_area_showhide"); +go_to_bug($sel, $test_bug_1); +$sel->click_ok("add-cc-btn"); # This will return more than one account. -$sel->type_ok("newcc", "*$config->{common_email}"); -$sel->click_ok("commit"); +$sel->type_ok("add-cc", "*$config->{common_email}"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Confirm Match"); $sel->is_text_present_ok("*$config->{common_email} matched:"); @@ -86,26 +82,24 @@ set_parameters($sel, {"User Matching" => {"maxusermatches" => {type => 'text', value => '1'}}}); go_to_bug($sel, $test_bug_1); -$sel->click_ok("cc_edit_area_showhide"); +$sel->click_ok("add-cc-btn"); # Several user accounts match this partial email address. Due to # maxusermatches = 1, no email address is suggested. -$sel->type_ok("newcc", "*$config->{common_email}"); -$sel->click_ok("commit"); +$sel->type_ok("add-cc", "*$config->{common_email}"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Match Failed"); $sel->is_text_present_ok("matches multiple users"); -$sel->go_back_ok(); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$test_bug_1/); -$sel->click_ok("cc_edit_area_showhide"); +go_to_bug($sel, $test_bug_1); +$sel->click_ok("add-cc-btn"); # We now type a complete and valid email address, so no confirmation # page should be displayed. -$sel->type_ok("newcc", $config->{unprivileged_user_login}); -$sel->click_ok("commit"); +$sel->type_ok("add-cc", $config->{unprivileged_user_login}); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $test_bug_1"); @@ -134,7 +128,7 @@ $sel->title_is("Change Group: tweakparams"); my @groups = $sel->get_select_options("visible_from_add"); if (grep { $_ eq 'tweakparams' } @groups) { - $sel->add_selection_ok("visible_from_add", "label=tweakparams"); + $sel->select_ok("visible_from_add", "label=tweakparams"); $sel->click_ok('//input[@value="Update Group"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Group: tweakparams"); @@ -143,39 +137,35 @@ logout($sel); log_in($sel, $config, 'tweakparams'); go_to_bug($sel, $test_bug_1); -$sel->click_ok("cc_edit_area_showhide"); +$sel->click_ok("add-cc-btn"); # We are not in the same groups as the unprivileged user, so we cannot see him. -$sel->type_ok("newcc", $config->{unprivileged_user_login_truncated}); -$sel->click_ok("commit"); +$sel->type_ok("add-cc", $config->{unprivileged_user_login_truncated}); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Match Failed"); $sel->is_text_present_ok( "$config->{unprivileged_user_login_truncated} did not match anything"); -$sel->go_back_ok(); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$test_bug_1/); -$sel->click_ok("cc_edit_area_showhide"); +go_to_bug($sel, $test_bug_1); +$sel->click_ok("add-cc-btn"); # This will return too many users (there are at least always three: # you, the admin and the permanent user (who has admin privs too)). -$sel->type_ok("newcc", $config->{common_email}); -$sel->click_ok("commit"); +$sel->type_ok("add-cc", $config->{common_email}); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Confirm Match"); $sel->is_text_present_ok( "$config->{common_email} matched more than the maximum of 2 users"); -$sel->go_back_ok(); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/^$test_bug_1/); -$sel->click_ok("cc_edit_area_showhide"); +go_to_bug($sel, $test_bug_1); +$sel->click_ok("add-cc-btn"); # We can always see ourselves. -$sel->type_ok("newcc", $config->{tweakparams_user_login_truncated}); -$sel->click_ok("commit"); +$sel->type_ok("add-cc", $config->{tweakparams_user_login_truncated}); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Confirm Match"); $sel->is_text_present_ok("<$config->{tweakparams_user_login}>"); @@ -185,8 +175,8 @@ $sel->is_text_present_ok("<$config->{tweakparams_user_login}>"); set_parameters($sel, {"User Matching" => {"usemenuforusers-on" => undef}}); go_to_bug($sel, $test_bug_1); -$sel->click_ok("cc_edit_area_showhide"); -my @cc = $sel->get_select_options("newcc"); +$sel->click_ok("add-cc-btn"); +my @cc = $sel->get_select_options("add-cc"); ok( !grep($_ =~ /$config->{unprivileged_user_login}/, @cc), "$config->{unprivileged_user_login} is not visible" diff --git a/qa/t/test_user_preferences.t b/qa/t/test_user_preferences.t index 8a3473185..5c0459cb1 100644 --- a/qa/t/test_user_preferences.t +++ b/qa/t/test_user_preferences.t @@ -38,6 +38,7 @@ $sel->title_is("Default Preferences"); # Update own user preferences. Some of them should no longer be present. +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("User Preferences"); @@ -69,20 +70,20 @@ $sel->wait_for_page_to_load(WAIT_TIME); my $bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); $sel->is_text_present_ok('has been added to the database', "Bug $bug1_id created"); -$sel->value_is("addselfcc", "off"); +go_to_bug($sel, $bug1_id); +$sel->value_is("add-self-cc", "off"); $sel->select_ok("bug_status", "label=IN_PROGRESS"); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("editme_action"); -$sel->value_is("short_desc", "First bug created"); -$sel->value_is("addselfcc", "off"); +go_to_bug($sel, $bug1_id); +$sel->value_is("short_desc", "First bug created"); +$sel->value_is("add-self-cc", "off"); # Tag the bug. $sel->select_ok("lob_action", "label=Add"); $sel->type_ok("lob_newqueryname", "sel-tmp"); -$sel->type_ok("bug_ids", $bug1_id); $sel->click_ok("commit_list_of_bugs"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Tag Updated"); @@ -105,13 +106,13 @@ $sel->wait_for_page_to_load(WAIT_TIME); my $bug2_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); $sel->is_text_present_ok('has been added to the database', "Bug $bug2_id created"); -$sel->value_is("addselfcc", "off"); +go_to_bug($sel, $bug2_id); +$sel->value_is("add-self-cc", "off"); # Add another bug to the tag. $sel->select_ok("lob_action", "label=Add"); $sel->select_ok("lob_oldqueryname", "label=sel-tmp"); -$sel->type_ok("bug_ids", $bug2_id); $sel->click_ok("commit_list_of_bugs"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Tag Updated"); @@ -123,31 +124,25 @@ $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List"); $sel->is_text_present_ok("Tags: sel-tmp"); $sel->is_text_present_ok("2 bugs found"); -$sel->click_ok("link=$bug1_id"); -$sel->wait_for_page_to_load(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); $sel->type_ok("comment", "The next bug I should see is this one."); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->click_ok("editme_action"); +go_to_bug($sel, $bug1_id); $sel->value_is("short_desc", "First bug created"); $sel->is_text_present_ok("The next bug I should see is this one."); # Remove the tag from all bugs. -$sel->open_ok("/buglist.cgi?tag=sel-tmp", - undef, "List 'sel-tmp' bugs"); +$sel->open_ok("/buglist.cgi?tag=sel-tmp", undef, "List 'sel-tmp' bugs"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List"); $sel->is_text_present_ok("Tags: sel-tmp"); -$sel->click_ok("link=$bug1_id"); -$sel->wait_for_page_to_load(WAIT_TIME); -$sel->title_like(qr/^$bug1_id /); +go_to_bug($sel, $bug1_id); $sel->select_ok("lob_action", "label=Remove"); $sel->select_ok("lob_oldqueryname", "label=sel-tmp"); -$sel->type_ok("bug_ids", $bug1_id); $sel->click_ok("commit_list_of_bugs"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Tag Updated"); @@ -158,12 +153,9 @@ $sel->click_ok("link=sel-tmp"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List"); $sel->is_text_present_ok("Tags: sel-tmp"); -$sel->click_ok("link=$bug2_id"); -$sel->wait_for_page_to_load(WAIT_TIME); -$sel->title_like(qr/^$bug2_id /); +go_to_bug($sel, $bug2_id); $sel->select_ok("lob_action", "label=Remove"); $sel->select_ok("lob_oldqueryname", "label=sel-tmp"); -$sel->type_ok("bug_ids", $bug2_id); $sel->click_ok("commit_list_of_bugs"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Tag Updated"); @@ -180,6 +172,7 @@ logout($sel); # Edit own user preferences, now as an unprivileged user. log_in($sel, $config, 'unprivileged'); +$sel->click_ok('header-account-menu-button'); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("User Preferences"); @@ -216,7 +209,7 @@ ok( open_advanced_search_page($sel); $sel->remove_all_selections_ok("product"); -$sel->add_selection_ok("product", "TestProduct"); +$sel->select_ok("product", "label=TestProduct"); $sel->remove_all_selections_ok("bug_status"); $sel->select_ok("bug_id_type", "label=only included in"); $sel->type_ok("bug_id", "$bug1_id , $bug2_id"); @@ -237,36 +230,33 @@ ok( # Editing bugs should follow user preferences. -$sel->click_ok("link=my_list"); +$sel->click_ok( + '//a[normalize-space(text())="my_list" and not(@role="option")]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: my_list"); -$sel->click_ok("link=$bug1_id"); -$sel->wait_for_page_to_load(WAIT_TIME); -$sel->title_like(qr/^$bug1_id .* First bug created/); -$sel->value_is("addselfcc", "on"); +go_to_bug($sel, $bug1_id); +$sel->value_is("add-self-cc", "on"); $sel->type_ok("comment", "I should be CC'ed and then I should see the next bug."); -$sel->click_ok("commit"); +$sel->click_ok('bottom-save-btn'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); -$sel->is_text_present_ok("The next bug in your list is bug $bug2_id"); ok(!$sel->is_text_present("I should see the next bug"), "The updated bug is no longer displayed"); # The user has no privs, so the short_desc field is not present. $sel->is_text_present_ok("My second bug"); -$sel->value_is("addselfcc", "on"); -$sel->click_ok("link=bug $bug1_id"); -$sel->wait_for_page_to_load(WAIT_TIME); -$sel->title_like(qr/^$bug1_id .* First bug created/); -$sel->is_text_present_ok("1 user including you"); +$sel->value_is("add-self-cc", "on"); +go_to_bug($sel, $bug1_id); +$sel->is_text_present_ok('Just you'); # Delete the saved search and log out. -$sel->click_ok("link=my_list"); +$sel->click_ok('quicksearch_top'); +$sel->click_ok('//a[normalize-space(text())="my_list" and @role="option"]'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Bug List: my_list"); -$sel->click_ok("link=Forget Search 'my_list'"); +$sel->click_ok('forget-search'); $sel->wait_for_page_to_load(WAIT_TIME); $sel->title_is("Search is gone"); $text = trim($sel->get_text("message")); diff --git a/qa/t/test_user_privs.t b/qa/t/test_user_privs.t index 3f9ee4358..8905ff3ec 100644 --- a/qa/t/test_user_privs.t +++ b/qa/t/test_user_privs.t @@ -18,11 +18,10 @@ my $test_bug_1 = $config->{test_bug_1}; # When being logged out, the 'Commit' button should not be displayed. -$sel->open_ok("/index.cgi?logout=1", - undef, "Log out (if required)"); +$sel->open_ok("/logout", undef, "Log out (if required)"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Logged Out"); -go_to_bug($sel, $test_bug_1); +go_to_bug($sel, $test_bug_1, 1); ok(!$sel->is_element_present('commit'), "Button 'Commit' not available"); # Now create a new bug. As the reporter, some forms are editable to you. @@ -42,9 +41,12 @@ logout($sel); # Some checks while being logged out. -go_to_bug($sel, $bug1_id); -ok(!$sel->is_element_present("commit"), "Button 'Commit' not available"); -my $text = trim($sel->get_text("//fieldset")); +go_to_bug($sel, $bug1_id, 1); +ok( + !$sel->is_element_present('bottom-save-btn'), + "Save changes button not available" +); +my $text = trim($sel->get_text('//div[@id="new-comment-notice"]')); ok( $text =~ /You need to log in before you can comment on or make changes to this bug./, @@ -71,17 +73,15 @@ $sel->type_ok( $sel->click_ok("log_in", undef, "Submit credentials"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^$bug1_id/, "Display bug $bug1_id"); +$sel->click_ok('mode-btn-readonly', 'Click Edit Bug'); +$sel->click_ok('action-menu-btn', 'Expand action menu'); +$sel->click_ok('action-expand-all', 'Expand all modal panels'); -# Neither the (edit) link nor the hidden form must exist, at all. +# The assigned_to field must not exist. # But the 'Commit' button does exist. - -ok( - !$sel->is_element_present("bz_assignee_edit_action"), - "No (edit) link displayed for the assignee" -); ok( !$sel->is_element_present("assigned_to"), "No hidden assignee field available" ); -$sel->is_element_present_ok("commit"); +$sel->is_element_present_ok('bottom-save-btn'); logout($sel); diff --git a/qa/t/test_votes.t b/qa/t/test_votes.t index 5ba59a360..e2c5bdc68 100644 --- a/qa/t/test_votes.t +++ b/qa/t/test_votes.t @@ -39,8 +39,8 @@ $sel->type_ok("votesperuser", 10); $sel->type_ok("maxvotesperbug", 5); $sel->type_ok("votestoconfirm", 3); $sel->select_ok("security_group_id", "label=core-security"); -$sel->select_ok("default_op_sys_id", "Unspecified"); -$sel->select_ok("default_platform_id", "Unspecified"); +$sel->select_ok("default_op_sys_id", "label=Unspecified"); +$sel->select_ok("default_platform_id", "label=Unspecified"); $sel->click_ok('//input[@type="submit" and @value="Add"]'); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Product Created"); @@ -54,9 +54,6 @@ $sel->type_ok( $config->{permanent_user}, "Setting the default owner" ); -$sel->uncheck_ok("watch_user_auto"); -$sel->type_ok("watch_user", "pegasus\@eureka.bugs"); -$sel->check_ok("watch_user_auto"); $sel->click_ok("create"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Component Created"); @@ -79,7 +76,8 @@ my $bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); # Now vote for this bug. -$sel->click_ok("link=vote"); +go_to_bug($sel, $bug1_id); +$sel->click_ok("vote-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Votes"); @@ -115,7 +113,8 @@ my $bug2_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); # Put enough votes on this bug to confirm it by popular votes. -$sel->click_ok("link=vote"); +go_to_bug($sel, $bug2_id); +$sel->click_ok("vote-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Votes"); $sel->type_ok("bug_$bug2_id", 5); @@ -140,7 +139,8 @@ my $bug3_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); # to confirm the bug by popular votes. # We also change votes set on other bugs for testing purposes. -$sel->click_ok("link=vote"); +go_to_bug($sel, $bug3_id); +$sel->click_ok("vote-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Votes"); $sel->type_ok("bug_$bug1_id", 2); @@ -166,7 +166,7 @@ ok( # the bug we just visited and click the 'vote' link again. go_to_bug($sel, $bug3_id); -$sel->click_ok("link=vote"); +$sel->click_ok("vote-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Change Votes"); @@ -213,10 +213,8 @@ $sel->is_text_present_ok( # Go check that $bug2 has been correctly updated. -$sel->click_ok("link=$bug2_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/$bug2_id /); -$text = trim($sel->get_text("votes_container")); +go_to_bug($sel, $bug2_id); +$text = trim($sel->get_text("field-value-votes")); ok($text =~ /4 votes/, "4 votes remaining"); # Decrease the number per user. Bugs should keep at least one vote, @@ -236,10 +234,8 @@ $sel->is_text_present_ok("removed votes for bug"); # Go check that $bug3 has been correctly updated. -$sel->click_ok("link=$bug3_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_like(qr/$bug3_id /); -$text = trim($sel->get_text("votes_container")); +go_to_bug($sel, $bug3_id); +$text = trim($sel->get_text("field-value-votes")); ok($text =~ /2 votes/, "2 votes remaining"); # Now disable UNCONFIRMED. diff --git a/scripts/entrypoint.pl b/scripts/entrypoint.pl index d69ca94cc..e9700df15 100755 --- a/scripts/entrypoint.pl +++ b/scripts/entrypoint.pl @@ -46,8 +46,7 @@ my $func = __PACKAGE__->can("cmd_$cmd") // sub { fix_path(); check_user(); -check_env( - qw( +check_env(qw( LOCALCONFIG_ENV BMO_db_host BMO_db_name @@ -56,12 +55,11 @@ check_env( BMO_memcached_namespace BMO_memcached_servers BMO_urlbase - ) -); + )); if ($ENV{BMO_urlbase} eq 'AUTOMATIC') { $ENV{BMO_urlbase} = sprintf 'http://%s:%d/', hostname(), $ENV{PORT}; - $ENV{BZ_BASE_URL} = sprintf 'http://%s:%d', hostname(), $ENV{PORT}; + $ENV{BZ_BASE_URL} = sprintf 'http://%s:%d', hostname(), $ENV{PORT}; } $func->($opts->()); @@ -69,16 +67,14 @@ $func->($opts->()); sub cmd_demo { unless (-f '/app/data/params') { cmd_load_test_data(); - check_env( - qw( + check_env(qw( PHABRICATOR_BOT_LOGIN PHABRICATOR_BOT_PASSWORD PHABRICATOR_BOT_API_KEY CONDUIT_USER_LOGIN CONDUIT_USER_PASSWORD CONDUIT_USER_API_KEY - ) - ); + )); run('perl', 'scripts/generate_conduit_data.pl'); } cmd_httpd(); @@ -100,6 +96,16 @@ sub cmd_jobqueue { exit run_cereal_and_jobqueue(@args)->get; } +sub cmd_selenium_dev { + assert_database->get(); + copy_qa_extension(); + cmd_load_test_data() unless -f "/app/data/params"; + mkdir('/app/artifacts') unless -d "/app/artifacts"; + my $httpd_exit_f = run_cereal_and_httpd('-DACCESS_LOGS'); + assert_httpd()->get; + exit $httpd_exit_f->get; +} + sub cmd_dev_httpd { my $have_params = -f "/app/data/params"; assert_database->get(); @@ -130,16 +136,15 @@ sub cmd_load_test_data { die 'BZ_QA_ANSWERS_FILE is not set' unless $ENV{BZ_QA_ANSWERS_FILE}; run('perl', 'checksetup.pl', '--no-template', $ENV{BZ_QA_ANSWERS_FILE}); - if ($ENV{BZ_QA_LEGACY_MODE}) { - run('perl', 'scripts/generate_bmo_data.pl', '--user-pref', - 'ui_experiments=off'); - chdir '/app/qa/config'; - say 'chdir(/app/qa/config)'; - run('perl', 'generate_test_data.pl'); - } - else { - run('perl', 'scripts/generate_bmo_data.pl', '--param' => 'use_mailer_queue=0'); - } + run( + 'perl', 'scripts/generate_bmo_data.pl', + '--user-pref', 'ui_experiments=on', + '--param', 'use_mailer_queue=0' + ); + + chdir '/app/qa/config'; + say 'chdir(/app/qa/config)'; + run('perl', 'generate_test_data.pl'); } sub cmd_test_webservices { diff --git a/t/bmo/passwords.t b/t/bmo/passwords.t index f3dd449bb..9e4deedc0 100644 --- a/t/bmo/passwords.t +++ b/t/bmo/passwords.t @@ -3,18 +3,16 @@ use 5.10.1; use strict; use warnings; use autodie; -use constant DRIVER => 'Test::Selenium::Remote::Driver'; -use Test::More 1.302; +use Mojo::Base -strict; +use Test::More; +use Test::Selenium::Remote::Driver; -#use constant DRIVER => 'Test::Selenium::Chrome'; BEGIN { plan skip_all => "these tests only run in CI" unless $ENV{CI} && $ENV{CIRCLE_JOB} eq 'test_bmo'; } -use ok DRIVER; - my $ADMIN_LOGIN = $ENV{BZ_TEST_ADMIN} // 'admin@mozilla.bugs'; my $ADMIN_PW_OLD = $ENV{BZ_TEST_ADMIN_PASS} // 'Te6Oovohch'; my $ADMIN_PW_NEW = $ENV{BZ_TEST_ADMIN_NEWPASS} // 'she7Ka8t'; @@ -23,24 +21,25 @@ my @require_env = qw( BZ_BASE_URL BZ_TEST_NEWBIE BZ_TEST_NEWBIE_PASS + TWD_HOST + TWD_PORT ); -if (DRIVER =~ /Remote/) { - push @require_env, qw( TWD_HOST TWD_PORT ); -} my @missing_env = grep { !exists $ENV{$_} } @require_env; BAIL_OUT("Missing env: @missing_env") if @missing_env; +my $sel = Test::Selenium::Remote::Driver->new( + base_url => $ENV{BZ_BASE_URL}, + browser => 'firefox', + version => '', + javascript => 1 +); + eval { - my $sel = DRIVER->new(base_url => $ENV{BZ_BASE_URL}); $sel->set_implicit_wait_timeout(600); login_ok($sel, $ADMIN_LOGIN, $ADMIN_PW_OLD); - change_password($sel, $ADMIN_PW_OLD, 'Ju9shiePhie6', 'zeeKuj0leib7'); - $sel->title_is("Passwords Don't Match"); - $sel->body_text_contains('The two passwords you entered did not match.'); - change_password($sel, $ADMIN_PW_OLD . "x", "newpassword2", "newpassword2"); $sel->title_is("Incorrect Old Password"); @@ -158,7 +157,7 @@ done_testing(); sub submit { my ($sel, $xpath) = @_; - $sel->find_element($xpath, 'xpath')->submit(); + $sel->find_element($xpath, 'xpath')->click_ok('Submit OK'); } sub get_token { @@ -251,7 +250,7 @@ sub login { $sel->title_is("Log in to Bugzilla"); click_and_type($sel, 'Bugzilla_login', $login); click_and_type($sel, 'Bugzilla_password', $password); - submit($sel, '//*[@id="bugzilla-body"]//input[@name="GoAheadAndLogIn"]'); + submit($sel, '//input[@id="log_in"]'); } sub login_ok { diff --git a/template/en/default/admin/classifications/select.html.tmpl b/template/en/default/admin/classifications/select.html.tmpl index 9aaf35da6..6c998fc80 100644 --- a/template/en/default/admin/classifications/select.html.tmpl +++ b/template/en/default/admin/classifications/select.html.tmpl @@ -35,7 +35,7 @@ [% FOREACH cl = classifications %] - [% cl.name FILTER html %] + [% cl.name FILTER html %] [% IF cl.description %] [% cl.description FILTER html_light %] diff --git a/template/en/default/admin/flag-type/edit.html.tmpl b/template/en/default/admin/flag-type/edit.html.tmpl index 3385e1fa9..029188ec8 100644 --- a/template/en/default/admin/flag-type/edit.html.tmpl +++ b/template/en/default/admin/flag-type/edit.html.tmpl @@ -273,7 +273,7 @@ [% END %] [% BLOCK category_select %] - [% FOREACH option = categories.keys.sort %]