1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-08 16:54:21 +00:00
os-autoinst-distri-fedora/lib/freeipa.pm
Adam Williamson b67f604894 Move all remaining utility functions into exporter modules
Summary:
This adds a couple of new exporter modules, renames main_common
to utils (this is a better name: openSUSE's main_common is
functions used in main.pm, utils is what they call their module
full of miscellaneous commonly-used functions), and moves a
bunch of utility functions that were previously needlessly
implemented as instance methods in base classes into the
exporter modules. That means we can get rid of all the annoying
$self-> syntax for calling them.

We get rid of `fedorabase` entirely, as it's no longer useful
for anything. Other base classes keep the 'standard' methods
(like `post_fail_hook`) and methods which actually need to be
methods (like `root_console`, whose behaviour is different in
anacondatest and installedtest).

Test Plan:
Do a full test suite run and check everything lines
up. There should be no functional differences from before at all,
this is just a re-org.

Reviewers: jskladan, garretraziel_but_actually_jsedlak_who_uses_stupid_nicknames

Reviewed By: garretraziel_but_actually_jsedlak_who_uses_stupid_nicknames

Subscribers: tflink

Differential Revision: https://phab.qa.fedoraproject.org/D1080
2017-01-17 23:15:44 -08:00

49 lines
1.5 KiB
Perl

package freeipa;
use strict;
use base 'Exporter';
use Exporter;
use testapi;
use utils;
our @EXPORT = qw/add_user start_webui/;
# add a user with given username and surname, always uses the password
# "correcthorse". Assumes FreeIPA web UI is showing the Users screen.
sub add_user {
my ($user, $surname) = @_;
wait_still_screen 1;
assert_and_click "freeipa_webui_add_button";
assert_screen "freeipa_webui_add_user";
wait_still_screen 1;
type_safely $user;
wait_screen_change { send_key "tab"; };
# we don't need to be too careful here as the names don't matter
type_safely "Test";
wait_screen_change { send_key "tab"; };
type_safely $surname;
type_safely "\t\t\t\t";
type_safely "correcthorse";
wait_screen_change { send_key "tab"; };
type_safely "correcthorse\n";
}
# access the FreeIPA web UI and log in as a given user. Assumes
# it's at a console ready to start Firefox.
sub start_webui {
my ($user, $password) = @_;
type_string "startx /usr/bin/firefox -width 1024 -height 768 https://ipa001.domain.local\n";
wait_still_screen 5;
assert_screen "freeipa_webui_login";
type_safely $user;
wait_screen_change { send_key "tab"; };
type_safely $password;
send_key "ret";
# if we logged in as 'admin' we should land on the admin 'Active
# users' screen, otherwise we should land on the user's own page
$user eq 'admin' ? assert_screen "freeipa_webui_users" : assert_screen "freeipa_webui_user";
wait_still_screen 3;
}