Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoshino committed Oct 11, 2024
1 parent 744843e commit 6af62dc
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 36 deletions.
14 changes: 7 additions & 7 deletions qa/t/1_test_create_user_accounts.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ my ($sel, $config) = get_selenium();
my $valid_account = 'selenium-' . random_string(10) . '@bugzilla.test';

$sel->get_ok('/home', 'Go to the home page');
$sel->click_ok("link=Log In");
$sel->click_ok("//a[./span[contains(text(), 'Log In')]]");
$sel->click_ok("link=Create an Account");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create a new Bugzilla account");
Expand All @@ -35,7 +35,7 @@ $sel->is_text_present_ok("A confirmation email has been sent");
$sel->click_ok('//*[@id="header-title"]//a');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Bugzilla Main Page");
$sel->click_ok("link=Log In");
$sel->click_ok("//a[./span[contains(text(), 'Log In')]]");
$sel->click_ok("link=Create an Account");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create a new Bugzilla account");
Expand All @@ -60,7 +60,7 @@ my @accounts = qw(
);

foreach my $account (@accounts) {
$sel->click_ok("link=Log In");
$sel->click_ok("//a[./span[contains(text(), 'Log In')]]");
$sel->click_ok("link=Create an Account");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create a new Bugzilla account");
Expand All @@ -79,7 +79,7 @@ foreach my $account (@accounts) {
# Logins larger than 127 characters must be rejected, for security reasons.
push @accounts, 'selenium-' . random_string(110) . '@bugzilla.test';
foreach my $account (@accounts) {
$sel->click_ok("link=Log In");
$sel->click_ok("//a[./span[contains(text(), 'Log In')]]");
$sel->click_ok("link=Create an Account");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create a new Bugzilla account");
Expand All @@ -97,7 +97,7 @@ foreach my $account (@accounts) {
}

# This account already exists.
$sel->click_ok("link=Log In");
$sel->click_ok("//a[./span[contains(text(), 'Log In')]]");
$sel->click_ok("link=Create an Account");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create a new Bugzilla account");
Expand All @@ -120,14 +120,14 @@ set_parameters($sel,
logout($sel);

# Make sure that links pointing to createaccount.cgi are all deactivated.
$sel->click_ok("link=Log In");
$sel->click_ok("//a[./span[contains(text(), 'Log In')]]");
ok(!$sel->is_text_present("Create an Account"), "No link named 'Create an Account'");
$sel->click_ok('//*[@id="header-title"]//a');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->refresh;
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Bugzilla Main Page");
$sel->click_ok("link=Log In");
$sel->click_ok("//a[./span[contains(text(), 'Log In')]]");
ok(!$sel->is_text_present("Create an Account"), "No link named 'Create an Account'");
$sel->open_ok("/createaccount.cgi");
$sel->title_is("Account Creation Disabled");
Expand Down
2 changes: 1 addition & 1 deletion qa/t/3_test_qa_contact.t
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ logout($sel);

log_in($sel, $config, 'unprivileged');
$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=General Preferences");
Expand Down
2 changes: 1 addition & 1 deletion qa/t/3_test_require_login.t
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ set_parameters($sel, {"User Authentication" => {"requirelogin-off" => undef}});
logout($sel);

# Make sure we can access random pages again.
$sel->click_ok("link=Advanced Search");
$sel->click_ok("//a[./span[contains(text(), 'Advanced Search')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_isnt("Log in to Bugzilla");
6 changes: 3 additions & 3 deletions qa/t/3_test_saved_searches.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ my ($sel, $config) = get_selenium();

log_in($sel, $config, 'QA_Selenium_TEST');
$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand Down Expand Up @@ -61,7 +61,7 @@ $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->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand Down Expand Up @@ -108,7 +108,7 @@ ok(
# to the "Preferences" page to edit it.

$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand Down
4 changes: 2 additions & 2 deletions qa/t/3_test_security.t
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ $sel->title_like(qr/^$bug1_id /);
#######################################################################

$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
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->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
my $editbugs_cookie = $sel->get_value("token");
Expand Down
14 changes: 7 additions & 7 deletions qa/t/4_test_shared_searches.t
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ok(
# in the Search Bar by default.

$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand Down Expand Up @@ -87,7 +87,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->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand Down Expand Up @@ -131,7 +131,7 @@ ok(
);

$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand Down Expand Up @@ -162,7 +162,7 @@ ok(
"No 'helpwanted' shared search displayed"
);
$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand All @@ -189,7 +189,7 @@ $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->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand Down Expand Up @@ -221,7 +221,7 @@ ok(
"The 'helpwanted' query is not displayed in the Search Bar"
);
$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand All @@ -236,7 +236,7 @@ logout($sel);

log_in($sel, $config, 'canconfirm');
$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Saved Searches");
Expand Down
4 changes: 2 additions & 2 deletions qa/t/4_test_show_all_products.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set_parameters($sel, {"Bug Fields" => {"useclassification-on" => undef}});
# The admin is not a member of the "QA‑Selenium‑TEST" group, and so
# cannot see the "QA‑Selenium‑TEST" product.

$sel->click_ok("link=New Bug");
$sel->click_ok("//a[./span[contains(text(), 'New Bug')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Enter Bug");
$sel->click_ok('//a/span[contains(text(),"Other Products")]',
Expand All @@ -42,7 +42,7 @@ logout($sel);
# The "QA‑Selenium‑TEST" product must be visible to them.

log_in($sel, $config, 'QA_Selenium_TEST');
$sel->click_ok("link=New Bug");
$sel->click_ok("//a[./span[contains(text(), 'New Bug')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Enter A Bug");
if ($sel->is_text_present('None of the above; my bug is in')) {
Expand Down
6 changes: 3 additions & 3 deletions qa/t/4_test_sudo_sessions.t
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ok(
# they cannot access editusers.cgi (despite the sudoer can).

$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Permissions");
Expand All @@ -108,8 +108,8 @@ $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->click_ok("//a[./span[contains(text(), 'End sudo session impersonating "
. $config->{unprivileged_user_login} . "')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Sudo session complete");
$sel->is_text_present_ok("The sudo session has been ended");
Expand Down
4 changes: 2 additions & 2 deletions qa/t/4_test_user_preferences.t
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=General Preferences");
Expand Down Expand Up @@ -173,7 +173,7 @@ logout($sel);

log_in($sel, $config, 'unprivileged');
$sel->click_ok('header-account-menu-button');
$sel->click_ok("link=Preferences");
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=General Preferences");
Expand Down
2 changes: 1 addition & 1 deletion qa/t/4_test_user_privs.t
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ok(
# Don't call log_in() here. We explicitly want to use the "log in" link
# in the addl. comment box.

$sel->click_ok("link=log in");
$sel->click_ok("//a[./span[contains(text(), 'Log In')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Log in to Bugzilla");
$sel->is_text_present_ok("Log in to Bugzilla");
Expand Down
6 changes: 3 additions & 3 deletions qa/t/4_test_webhooks.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ logout($sel);
# * The other uses an API key header to authenticate
log_in($sel, $config, 'editbugs');
$sel->click_ok('header-account-menu-button');
$sel->click_ok('link=Preferences');
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is('User Preferences', 'User preferences');
$sel->click_ok('link=Webhooks');
Expand Down Expand Up @@ -87,7 +87,7 @@ logout($sel);
# Login as admin user and a webhook using Any product
log_in($sel, $config, 'admin');
$sel->click_ok('header-account-menu-button');
$sel->click_ok('link=Preferences');
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is('User Preferences', 'User preferences');
$sel->click_ok('link=Webhooks');
Expand Down Expand Up @@ -134,7 +134,7 @@ ok(!$sel->is_text_present('ERROR'), 'ERROR message not present');

# Remove the admin webhook for any product
$sel->click_ok('header-account-menu-button');
$sel->click_ok('link=Preferences');
$sel->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is('User Preferences', 'User preferences');
$sel->click_ok('link=Webhooks');
Expand Down
2 changes: 1 addition & 1 deletion qa/t/archived/test_email_preferences.t
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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->click_ok("//a[./span[contains(text(), 'Preferences')]]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->click_ok("link=Email Preferences");
Expand Down
6 changes: 3 additions & 3 deletions qa/t/lib/QA/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ sub file_bug_in_product {
sleep(1);

$classification ||= "Unclassified";
$sel->click_ok("link=New Bug", undef, "Go create a new bug");
$sel->click_ok("//a[./span[contains(text(), 'New Bug')]]", undef, "Go create a new bug");
$sel->wait_for_page_to_load(WAIT_TIME);

# Use normal bug form instead of helper
Expand Down Expand Up @@ -400,12 +400,12 @@ sub open_advanced_search_page {
);
sleep(1);

$sel->click_ok("link=Advanced Search");
$sel->click_ok("//a[./span[contains(text(), 'Advanced Search')]]");
$sel->wait_for_page_to_load(WAIT_TIME);
my $title = $sel->get_title();
if ($title eq "Simple Search") {
ok(1, "Display the simple search form");
$sel->click_ok("link=Advanced Search");
$sel->click_ok("//a[./span[contains(text(), 'Advanced Search')]]");
$sel->wait_for_page_to_load(WAIT_TIME);
}
$sel->remove_all_selections('classification');
Expand Down

0 comments on commit 6af62dc

Please sign in to comment.