From 8ec8da0491ad89604700b3e29a227966f6d84ba1 Mon Sep 17 00:00:00 2001 From: Perl Tidy Date: Wed, 5 Dec 2018 15:38:52 -0500 Subject: no bug - reformat all the code using the new perltidy rules --- qa/t/test_bmo_enter_new_bug.t | 384 ++++++++++++++++++++++++------------------ 1 file changed, 217 insertions(+), 167 deletions(-) (limited to 'qa/t/test_bmo_enter_new_bug.t') diff --git a/qa/t/test_bmo_enter_new_bug.t b/qa/t/test_bmo_enter_new_bug.t index 5f015ab64..bdf01a625 100644 --- a/qa/t/test_bmo_enter_new_bug.t +++ b/qa/t/test_bmo_enter_new_bug.t @@ -23,7 +23,7 @@ use QA::Util; my ($sel, $config) = get_selenium(); log_in($sel, $config, 'admin'); -set_parameters($sel, { "Bug Fields" => {"useclassification-off" => undef} }); +set_parameters($sel, {"Bug Fields" => {"useclassification-off" => undef}}); # mktgevent and swag are dependent so we create the mktgevent bug first so # we can provide the bug id to swag @@ -90,15 +90,23 @@ _check_product('Marketing'); _check_component('Marketing', 'Trademark Permissions'); _check_group('marketing-private'); -$sel->open_ok("/$config->{bugzilla_installation}/enter_bug.cgi?product=Marketing&format=trademark"); +$sel->open_ok( + "/$config->{bugzilla_installation}/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"); +$sel->title_is("Trademark Usage Requests", + "Open custom bug entry form - trademark"); $sel->type_ok("short_desc", "Bug created by Selenium", "Enter bug summary"); -$sel->type_ok("comment", "--- Bug created by Selenium ---", "Enter bug description"); +$sel->type_ok( + "comment", + "--- Bug created by Selenium ---", + "Enter bug description" +); $sel->click_ok("commit", undef, "Submit bug data to post_bug.cgi"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok('has been added to the database', 'Bug created'); -my $trademark_bug_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); +my $trademark_bug_id + = $sel->get_value('//input[@name="id" and @type="hidden"]'); # itrequest @@ -173,14 +181,25 @@ _check_component('mozilla.org', 'Discussion Forums'); _check_version('mozilla.org', 'other'); _check_component('mozilla.org', 'Discussion Forums'); -$sel->open_ok("/$config->{bugzilla_installation}/enter_bug.cgi?product=mozilla.org&format=mozlist"); +$sel->open_ok( + "/$config->{bugzilla_installation}/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"); +$sel->title_is("Mozilla Discussion Forum", + "Open custom bug entry form - mozlist"); $sel->type_ok("listName", "test-list", "Enter name for mailing list"); -$sel->type_ok("listAdmin", $config->{'admin_user_login'}, "Enter list administator"); +$sel->type_ok( + "listAdmin", + $config->{'admin_user_login'}, + "Enter list administator" +); $sel->type_ok("cc", $config->{'unprivileged_user_login'}, "Enter cc address"); $sel->check_ok("name=groups", "value=infra", "Select private group"); -$sel->type_ok("comment", "--- Bug created by Selenium ---", "Enter bug description"); +$sel->type_ok( + "comment", + "--- Bug created by Selenium ---", + "Enter bug description" +); $sel->click_ok("commit", undef, "Submit bug data to post_bug.cgi"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok('has been added to the database', 'Bug created'); @@ -214,15 +233,25 @@ _check_product('Legal'); _check_component('Legal', 'Contract Request'); _check_group('mozilla-employee-confidential'); -$sel->open_ok("/$config->{bugzilla_installation}/enter_bug.cgi?product=Legal&format=legal"); +$sel->open_ok( + "/$config->{bugzilla_installation}/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"); +$sel->title_is("Mozilla Corporation Legal Requests", + "Open custom bug entry form - legal"); $sel->select_ok("component", "value=Contract Request", "Select request type"); -$sel->select_ok("business_unit", "value=Connected Devices", "Select business unit"); +$sel->select_ok( + "business_unit", + "value=Connected Devices", + "Select business unit" +); $sel->type_ok("short_desc", "Bug created by Selenium", "Enter request summary"); $sel->type_ok("cc", $config->{'unprivileged_user_login'}, "Enter cc address"); $sel->type_ok("important_dates", "Important dates", "Enter important dates"); -$sel->type_ok("comment", "--- Bug created by Selenium ---", "Enter request description"); +$sel->type_ok( + "comment", + "--- Bug created by Selenium ---", + "Enter request description" +); $sel->click_ok("commit", undef, "Submit bug data to post_bug.cgi"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok('has been added to the database', 'Bug created'); @@ -234,189 +263,210 @@ _check_product('Websites', 'other'); _check_component('Websites', 'www.mozilla.org'); _check_user('liz@mozilla.com'); -$sel->open_ok("/$config->{bugzilla_installation}/enter_bug.cgi?product=Websites&format=poweredby"); +$sel->open_ok( + "/$config->{bugzilla_installation}/enter_bug.cgi?product=Websites&format=poweredby" +); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->title_is("Powered by Mozilla Logo Requests", "Open custom bug entry form - poweredby"); +$sel->title_is("Powered by Mozilla Logo Requests", + "Open custom bug entry form - poweredby"); $sel->type_ok("short_desc", "Bug created by Selenium", "Enter bug summary"); -$sel->type_ok("comment", "--- Bug created by Selenium ---", "Enter bug description"); +$sel->type_ok( + "comment", + "--- Bug created by Selenium ---", + "Enter bug description" +); $sel->click_ok("commit", undef, "Submit bug data to post_bug.cgi"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok('has been added to the database', 'Bug created'); -my $poweredby_bug_id = $sel->get_value('//input[@name="id" and @type="hidden"]'); +my $poweredby_bug_id + = $sel->get_value('//input[@name="id" and @type="hidden"]'); -set_parameters($sel, { "Bug Fields" => {"useclassification-on" => undef} }); +set_parameters($sel, {"Bug Fields" => {"useclassification-on" => undef}}); logout($sel); sub _check_product { - my ($product, $version) = @_; - - go_to_admin($sel); - $sel->click_ok("link=Products"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("Select product"); - - my $product_description = "$product Description"; - - my $text = trim($sel->get_text("bugzilla-body")); - if ($text =~ /$product_description/) { - # Product exists already - return 1; - } - - $sel->click_ok("link=Add"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("Add Product"); - $sel->type_ok("product", $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->click_ok('//input[@type="submit" and @value="Add"]'); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $text = trim($sel->get_text("message")); - ok($text =~ /You will need to add at least one component before anyone can enter bugs against this product/, - "Display a reminder about missing components"); + my ($product, $version) = @_; + go_to_admin($sel); + $sel->click_ok("link=Products"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Select product"); + + my $product_description = "$product Description"; + + my $text = trim($sel->get_text("bugzilla-body")); + if ($text =~ /$product_description/) { + + # Product exists already return 1; + } + + $sel->click_ok("link=Add"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Add Product"); + $sel->type_ok("product", $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->click_ok('//input[@type="submit" and @value="Add"]'); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $text = trim($sel->get_text("message")); + ok( + $text + =~ /You will need to add at least one component before anyone can enter bugs against this product/, + "Display a reminder about missing components" + ); + + return 1; } sub _check_component { - my ($product, $component) = @_; - - go_to_admin($sel); - $sel->click_ok("link=components"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("Edit components for which product?"); - - $sel->click_ok("//*[\@id='bugzilla-body']//a[normalize-space(text())='$product']"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("Select component of product '$product'"); - - my $component_description = "$component Description"; - - my $text = trim($sel->get_text("bugzilla-body")); - if ($text =~ /$component_description/) { - # Component exists already - 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); - $sel->title_is("Edit components for which product?"); - $sel->click_ok("//*[\@id='bugzilla-body']//a[normalize-space(text())='$product']"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("Select component of product '$product'"); - $sel->click_ok("link=Add"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("Add component to the $product product"); - $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"); - $text = trim($sel->get_text("message")); - ok($text eq "The component $component has been created.", "Component successfully created"); + my ($product, $component) = @_; + + go_to_admin($sel); + $sel->click_ok("link=components"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Edit components for which product?"); + $sel->click_ok( + "//*[\@id='bugzilla-body']//a[normalize-space(text())='$product']"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Select component of product '$product'"); + + my $component_description = "$component Description"; + + my $text = trim($sel->get_text("bugzilla-body")); + if ($text =~ /$component_description/) { + + # Component exists already 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); + $sel->title_is("Edit components for which product?"); + $sel->click_ok( + "//*[\@id='bugzilla-body']//a[normalize-space(text())='$product']"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Select component of product '$product'"); + $sel->click_ok("link=Add"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Add component to the $product product"); + $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"); + $text = trim($sel->get_text("message")); + ok($text eq "The component $component has been created.", + "Component successfully created"); + + return 1; } sub _check_group { - my ($group) = @_; - - go_to_admin($sel); - $sel->click_ok("link=Groups"); - $sel->wait_for_page_to_load(WAIT_TIME); - $sel->title_is("Edit Groups"); - - my $group_description = "$group Description"; - - my $text = trim($sel->get_text("bugzilla-body")); - if ($text =~ /$group_description/) { - # Group exists already - return 1; - } - - $sel->title_is("Edit Groups"); - $sel->click_ok("link=Add Group"); - $sel->wait_for_page_to_load(WAIT_TIME); - $sel->title_is("Add group"); - $sel->type_ok("name", $group); - $sel->type_ok("desc", $group_description); - $sel->type_ok("owner", $config->{'admin_user_login'}); - $sel->check_ok("isactive"); - $sel->check_ok("insertnew"); - $sel->click_ok("create"); - $sel->wait_for_page_to_load(WAIT_TIME); - $sel->title_is("New Group Created"); - my $group_id = $sel->get_value("group_id"); + my ($group) = @_; + + go_to_admin($sel); + $sel->click_ok("link=Groups"); + $sel->wait_for_page_to_load(WAIT_TIME); + $sel->title_is("Edit Groups"); + my $group_description = "$group Description"; + + my $text = trim($sel->get_text("bugzilla-body")); + if ($text =~ /$group_description/) { + + # Group exists already return 1; + } + + $sel->title_is("Edit Groups"); + $sel->click_ok("link=Add Group"); + $sel->wait_for_page_to_load(WAIT_TIME); + $sel->title_is("Add group"); + $sel->type_ok("name", $group); + $sel->type_ok("desc", $group_description); + $sel->type_ok("owner", $config->{'admin_user_login'}); + $sel->check_ok("isactive"); + $sel->check_ok("insertnew"); + $sel->click_ok("create"); + $sel->wait_for_page_to_load(WAIT_TIME); + $sel->title_is("New Group Created"); + my $group_id = $sel->get_value("group_id"); + + return 1; } sub _check_version { - my ($product, $version) = @_; - - go_to_admin($sel); - $sel->click_ok("link=versions"); - $sel->wait_for_page_to_load(WAIT_TIME); - $sel->title_is("Edit versions for which product?"); - $sel->click_ok("//*[\@id='bugzilla-body']//a[normalize-space(text())='$product']"); - $sel->wait_for_page_to_load(WAIT_TIME); - - my $text = trim($sel->get_text("bugzilla-body")); - if ($text =~ /$version/) { - # Version exists already - return 1; - } - - $sel->click_ok("link=Add"); - $sel->wait_for_page_to_load(WAIT_TIME); - $sel->title_like(qr/^Add Version to Product/); - $sel->type_ok("version", $version); - $sel->click_ok("create"); - $sel->wait_for_page_to_load(WAIT_TIME); - $sel->title_is("Version Created"); + my ($product, $version) = @_; + + go_to_admin($sel); + $sel->click_ok("link=versions"); + $sel->wait_for_page_to_load(WAIT_TIME); + $sel->title_is("Edit versions for which product?"); + $sel->click_ok( + "//*[\@id='bugzilla-body']//a[normalize-space(text())='$product']"); + $sel->wait_for_page_to_load(WAIT_TIME); + + my $text = trim($sel->get_text("bugzilla-body")); + if ($text =~ /$version/) { + # Version exists already return 1; + } + + $sel->click_ok("link=Add"); + $sel->wait_for_page_to_load(WAIT_TIME); + $sel->title_like(qr/^Add Version to Product/); + $sel->type_ok("version", $version); + $sel->click_ok("create"); + $sel->wait_for_page_to_load(WAIT_TIME); + $sel->title_is("Version Created"); + + return 1; } sub _check_user { - my ($user) = @_; - - go_to_admin($sel); - $sel->click_ok("link=Users"); - $sel->wait_for_page_to_load(WAIT_TIME); - $sel->title_is("Search users"); - $sel->type_ok("matchstr", $user); - $sel->click_ok("search"); - $sel->wait_for_page_to_load(WAIT_TIME); - - my $text = trim($sel->get_text("bugzilla-body")); - if ($text =~ /$user/) { - # User exists already - return 1; - } - - $sel->click_ok("link=add a new user"); - $sel->wait_for_page_to_load(WAIT_TIME); - $sel->title_is('Add user'); - $sel->type_ok('login', $user); - $sel->type_ok('password', 'icohF1io2ohw'); - $sel->click_ok("add"); - $sel->wait_for_page_to_load(WAIT_TIME); - $sel->is_text_present('regexp:The user account .* has been created successfully'); + my ($user) = @_; + + go_to_admin($sel); + $sel->click_ok("link=Users"); + $sel->wait_for_page_to_load(WAIT_TIME); + $sel->title_is("Search users"); + $sel->type_ok("matchstr", $user); + $sel->click_ok("search"); + $sel->wait_for_page_to_load(WAIT_TIME); + + my $text = trim($sel->get_text("bugzilla-body")); + if ($text =~ /$user/) { + # User exists already return 1; + } + + $sel->click_ok("link=add a new user"); + $sel->wait_for_page_to_load(WAIT_TIME); + $sel->title_is('Add user'); + $sel->type_ok('login', $user); + $sel->type_ok('password', 'icohF1io2ohw'); + $sel->click_ok("add"); + $sel->wait_for_page_to_load(WAIT_TIME); + $sel->is_text_present( + 'regexp:The user account .* has been created successfully'); + + return 1; } -- cgit v1.2.3-24-g4f1b