Commit Graph

113 Commits

Author SHA1 Message Date
Christian Heimes
6a17a91672 Skip paramiko tests in FIPS mode
Paramiko is not compatible with FIPS mode. It uses MD5 on the client
side and does not support rsa-sha2 connections for RSA auth.

See: https://pagure.io/freeipa/issue/8129
Reviewed-By: Francisco Trivino <ftrivino@redhat.com>
2019-11-29 17:02:16 +01:00
Serhii Tsymbaliuk
88795fb9a9
Fix certificate revocation tests for Web UI
- correct revocation date before search
- increase timeouts

https://pagure.io/freeipa/issue/7834

Reviewed-By: Armando Neto <abiagion@redhat.com>
2019-02-04 14:14:26 +01:00
Serhii Tsymbaliuk
18cac46092
WebUI: Temporary fix for UnexpectedAlertPresentException
It is regression in Firefox 55
Fixed in Firefox 65:
https://bugzilla.mozilla.org/show_bug.cgi?id=1503015

https://pagure.io/freeipa/issue/7809

Reviewed-By: Sergey Orlov <sorlov@redhat.com>
2018-12-13 21:14:57 +01:00
Serhii Tsymbaliuk
07c163ca92
Fix "ID views" tests fail after running "Automember" tests
Clear default user/host group before deleting.

https://pagure.io/freeipa/issue/7771

Reviewed-By: Christian Heimes <cheimes@redhat.com>
2018-11-27 14:20:34 +01:00
Christian Heimes
496d1756c9 Address consider-using-in
Replace multiple comparisons with 'in' operation.

See: https://pagure.io/freeipa/issue/7758
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2018-11-13 13:37:58 +01:00
Serhii Tsymbaliuk
8954521007
WebUI tests: Make possible to use kwargs with @screenshot decorator
Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
a68035dcae
UI tests for "Automember": check creating and deleting of automember rule conditions
https://pagure.io/freeipa/issue/7721

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Cech <pcech@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-30 16:26:29 +01:00
Serhii Tsymbaliuk
49df1ab1c8
UI tests for "Automember": check search filter
https://pagure.io/freeipa/issue/7721

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Cech <pcech@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-30 16:26:29 +01:00
Serhii Tsymbaliuk
70f51c0db2 UI tests for "ID Range": check modifying ID range with invalid or missing values
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Serhii Tsymbaliuk
369fb23ed9 UI tests for "ID Range": check adding range without primary and secondary RID bases
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Christian Heimes
15d5e44ee8 Py3: Replace six.moves imports
Replace six.moves and six.StringIO/BytesIO imports with cannonical
Python 3 packages.

Note: six.moves.input behaves differently than builtin input function.
Therefore I left six.moves.input for now.

See: https://pagure.io/freeipa/issue/7715
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
2018-10-05 12:06:19 +02:00
Christian Heimes
b431e9b684 Py3: Remove subclassing from object
Python 2 had old style and new style classes. Python 3 has only new
style classes. There is no point to subclass from object any more.

See: https://pagure.io/freeipa/issue/7715
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2018-09-27 11:49:04 +02:00
Christian Heimes
4a58adf79e Sprinkle raw strings across the code base
tox / pytest is complaining about lots and lots of invalid escape
sequences in our code base. Sprinkle raw strings or backslash escapes
across the code base to fix most occurences of:

  DeprecationWarning: invalid escape sequence

There is still one warning that keeps repeating, though:

  source:264: DeprecationWarning: invalid escape sequence \d

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2018-09-27 10:23:03 +02:00
Serhii Tsymbaliuk
d020fc49a6 Change Web UI tests setup flow
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-09-19 13:32:51 +02:00
Serhii Tsymbaliuk
46eb9a38f0 Fix UI_driver.has_class exception. Handle situation when element has no class attribute
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-09-19 13:32:51 +02:00
Serhii Tsymbaliuk
93eafaec1a Add cookies clearing for all Web UI tests
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-09-19 13:32:51 +02:00
Serhii Tsymbaliuk
685cef554b Fix test_user::test_login_without_username (Web UI test)
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-09-19 13:32:51 +02:00
Serhii Tsymbaliuk
1212402a61 Increase request timeout for WebUI tests
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-09-19 13:32:51 +02:00
Michal Reznik
e140d198ea ui_tests: stabilization fixes
This patch aims to fix the following tests which seems to be quite
unstable recently:

test_user::test_actions - closing notification and moving to element
to have screenshot of current place.

test_user::certificates - add wait() / close_notification

Also adds missing @screenshot decorator to test_user_misc method.

Reviewed-By: Pavel Picka <ppicka@redhat.com>
2018-07-04 15:21:30 +02:00
Michal Reznik
b1f368c682 ui_tests: fixes for issues with sending key and focus on element
Fixes 2 issues in WebUI tests. One issue is that we are unable to
confirm a dialog by "Enter" keyboard - "actions.click()" helps
here to get focus on the page.

Second issue is probbaly related to screen resolution as we cannot
click to some of the action buttons (buttons which are having issue
varies).

https://pagure.io/freeipa/issue/7583

Reviewed-By: Pavel Picka <ppicka@redhat.com>
2018-06-08 14:03:30 +02:00
Pavel Picka
3e4b9cd969 Adding WebUI Host test cases
Added test cases due to downstream test cases
- negative input
- ssh keys
- csr
- otp
- filter
- buttons

https://pagure.io/freeipa/issue/7550

Signed-off-by: Pavel Picka <ppicka@redhat.com>
Reviewed-By: Varun Mylaraiah <mvarun@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-31 13:05:05 +02:00
Petr Čech
3c9810e963 webui:tests: Add tests for realmd domains
This patch expands WebUI testing on realmd domains
page. The added tests are:
  test_add_single_labeled_domain
  test_dnszone_del_hooked_to_realmdomains_mod
  test_dns_reversezone_add_hooked_to_realmdomains_mod
  test_dnszone_add_hooked_to_realmdomains_mod
  test_del_domain_of_ipa_server_bug1035286
  test_add_non_dns_configured_domain_positive
  test_add_non_dns_configured_domain_negative
  test_del_domain_with_force_update
  test_del_domain_and_update
  test_del_domain_and_refresh
  test_del_domain_revert
  test_del_domain_undo_all
  test_del_domain_undo
  test_add_domain_and_update
  test_add_domain_with_trailing_space
  test_add_domain_with_leading_space
  test_add_empty_domain
  test_add_duplicate_domaini
  test_add_domain_and_revert
  test_add_domain_and_refresh
  test_add_domain_and_undo_all
  test_add_domain_and_undo
  test_add_domain_with_special_char

Reviewed-By: Felipe Volpone <felipevolpone@gmail.com>
Reviewed-By: Varun Mylaraiah <mvarun@redhat.com>
2018-05-18 16:39:18 +02:00
Michal Reznik
0959c47676 ui_tests: add click_undo_button() func
Add click_undo_button() function to simplify clicking on
particular`s field undo button/s.

https://pagure.io/freeipa/issue/7544

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-18 12:17:54 +02:00
Michal Reznik
8d508b8e95 ui_tests: extend test_selinuxusermap.py suite
Extend test_selinuxusermap.py suite with new test cases. Details in
the ticket.

We also modify "add_table_associations" to handle "cancel" and
"negative" in the way other methods works.

Lastly, we start using dialog_btn=None to test keyboard confirmation
as we did use it incorrectly with "Negative=True" where it was already
confirmed by "click".

Added tests:

addselinuxusermap_MLS_singlelevel
addselinuxusermap_cancel
addselinuxusermap_disabledhbacrule
addselinuxusermap_MLS_range
addselinuxusermap_MCS_range
addselinuxusermap_MCS_commas
addselinuxusermap_MLS_singlevalue
addselinuxusermap_multiple
addandeditselinuxusermap
selinuxusermap_undo
selinuxusermap_refresh
selinuxusermap_reset
selinuxusermap_update
selinuxusermap_backlink_cancel
selinuxusermap_backlink_reset
selinuxusermap_backlink_update
selinuxusermap_deletemultiple
add_user_selinuxusermap_cancel
add_host_selinuxusermap_cancel
add_hostgroup_selinuxusermap_cancel
selinuxusermap_requiredfield
selinuxusermap_duplicate
selinuxusermap_nonexistinguser
selinuxusermap_invalidusersyntaxMCS
selinuxusermap_invalidusersyntaxMLS
add_usernegative_selinuxusermap
selinuxusermap_addNegativeHBACrule
selinuxusermap_search
selinuxusermap_searchnegative
selinuxusermap_disablemultiple
selinuxusermap_enablemultiple
selinuxusermap_deleteNegativeHBACrule
add_selinuxusermap_adder_dialog_bug910463
delete_selinuxusermap_deleter_dialog_bug910463

https://pagure.io/freeipa/issue/7544

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-18 12:17:54 +02:00
Michal Reznik
897f1cda93 ui_tests: improve "field_validation" method
Often when trying to check e.g. required field we pass the
method another element as parent in order to narrow down a scope
for validation. This way we can just pass "field" name to make the
process easier.

https://pagure.io/freeipa/issue/7546

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-15 12:57:26 +02:00
Michal Reznik
ef3f0851f4 ui_tests: checkbox click fix
We check a box with clicking on label by default however sometimes
when a label is too short (1-2 letters) we are hitting an issue
that the checkbox obscures the label.

https://pagure.io/freeipa/issue/7547

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-15 12:56:03 +02:00
Michal Reznik
e43cfaeb52 ui_driver: extension and modifications related to test_user
In this patch we tune login() in order to test login without
username.

Then we add edit_multivalued and undo_multivalued to test "undo"
and "reset" buttons.

Also there is a new boolean "negative" in mod_record() to switch
button assertion.

Later ssh_key methods were fine-tuned a little to add more keys,
delete all of them and to extend their usage to hosts and id views.

Lastly new method assert_value_checked() was introduced to assert
whether a particular record is checked.

https://pagure.io/freeipa/issue/7507

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Reviewed-By: Varun Mylaraiah <mvarun@redhat.com>
2018-04-27 14:19:59 +02:00
Varun Mylaraiah
00a8d00ea9 WebUI tests: Extend netgroup tests with more scenarios
Extended webui group automation test with below scenarios
Scenarios
 *add netgroup with invalid names
 *add and delete records in various scenarios
 *verify button's action in various scenarios.

https://pagure.io/freeipa/issue/7505

Signed-off-by: Varun Mylaraiah <mvarun@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Reviewed-By: Michal Reznik <mreznik@redhat.com>
2018-04-27 14:08:04 +02:00
Stanislav Laznicka
b5bdd07bc5
Add absolute_import future imports
Add absolute_import from __future__ so that pylint
does not fail and to achieve python3 behavior in
python2.

Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2018-04-20 09:43:37 +02:00
Varun Mylaraiah
105d7d7f2e WebUI tests: Extend user group tests with more scenarios
1) Extended webui group automation test with below scenarios
	Scenarios
	 *Add user group with invalid names
	 *Add multiple groups records at one shot
	 *Select and delete multiple records
	 *Find and delete records etc...
2) Improved add_record method to support additional use cases:
	 *confirm by additional buttons: 'Add', 'Add and add another', 'Add and Edit,' 'Cancel'
	 *add multiple records in one call (uses 'Add and add another' behavior)

https://pagure.io/freeipa/issue/7485

Signed-off-by: Varun Mylaraiah <mvarun@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Reviewed-By: Michal Reznik <mreznik@redhat.com>
2018-04-19 12:59:09 +02:00
Michal Reznik
2a6ba687d0 test_web_ui: extend ui_driver methods
Add close_all_dialogs(),change assert_last_dialog_details() method
to assert_last_error_dialog() to make it more generic and tweak
add_record() method to skip asserts so we can assert later.

We are also changing assert_record_value() to accept list of values
and adding select_multiple_records().

https://pagure.io/freeipa/issue/7463

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-04-09 09:06:48 +02:00
Petr Vobornik
70c6da9c54 webui tests: fix test_host:test_crud failure
test_host.py::test_host::test_crud fails in nightly tests in delete record
step.

It started to fail probably after commit 4295df17a4
which changed host-add behavior into showing a warning message about DNS resolution
instead of raising an error. This warning notification stays displayed for some
time, as all longer, notifications. By being open it takes some area on the page.
Given that webui tests proceeds quicker than a user, the notification can
cover some elements.

The test fails because web driver cannot click on an element which is covered
by the notification. In this case, it cannot open a deleter dialog.

So the fix is to close the notification(s). This is OK since a user would do
it as well if it was in a way.

This kind of issue is harder to reproduce when testing locally because
most people uses screen resolution 1920x1200 or full HD. PR-CI uses
1400x1200 for web ui testing.
  /usr/bin/Xvfb $DISPLAY -ac -noreset -screen 0 1400x1200x8

So alternative fix would be to change resolution used by the PR-CI. Combination
of both could be the best.

https://pagure.io/freeipa/issue/7468

Reviewed-By: Felipe Volpone <fbarreto@redhat.com>
2018-03-28 15:31:27 +02:00
Pavel Picka
1fe795b75b WebUI Hostgroups tests cases added
Added test for negative (invalid) names
Added test for add/add another/add and edit/cancel buttons
Added test for duplicate records

https://pagure.io/freeipa/issue/7458

Signed-off-by: Pavel Picka <ppicka@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-03-26 13:00:39 +02:00
Michal Reznik
bf1f2d1c3f ui_tests: select_combobox() fixes
Move strict "search_btn" element finding to later so we
do not fail when using combobox without search button.
Also switch open_btn.click() before fill_textbox() as it
is used to close the selection.

https://pagure.io/freeipa/issue/7441

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-03-24 14:23:47 +01:00
Michal Reznik
16083eb9b5 ui_tests: test cancel and delete without button
Add "confirm_btn" to cancel dialog and if "None" return
for confirmation with "Enter" key.

https://pagure.io/freeipa/issue/7441

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-03-24 14:23:47 +01:00
Michal Reznik
553183944a ui_tests: make associations cancelable
Adjust associations functions to simulate "cancel"
action.

https://pagure.io/freeipa/issue/7441

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-03-24 14:23:47 +01:00
Michal Reznik
18e8c964f5 ui_tests: add function to run cmd on UI host
Run shell command on the UI system using "admin"
user's passwd from conf.

https://pagure.io/freeipa/issue/7441

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-03-24 14:23:47 +01:00
Michal Reznik
95de6f061c ui_tests: add funcs to add/remove users public SSH key
Add funcs to add/remove users public SSH key.

https://pagure.io/freeipa/issue/7441

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-03-24 14:23:47 +01:00
Michal Reznik
7fb4f755e9 ui_tests: add assert_field_required()
Add assert_field_required() to check whether we
got 'Required field' error message.

https://pagure.io/freeipa/issue/7441

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-03-24 14:23:47 +01:00
Michal Reznik
01fa54117d ui_tests: add assert_notification()
Add assert_notification() function to check whether
we have a notification of particular type/

https://pagure.io/freeipa/issue/7441

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-03-24 14:23:47 +01:00
Petr Vobornik
6b214512b3 webui:tests: close big notifications in realm domains tests
Realm domains commands produce big fat warnings about DNS state/checks.
Given the length of these warnings, they stay displayed for longer time.
As Web UI automated tests progresses quickly more of the warnings can
be displayed at the same time and thus taking a lot of space and thus
covering UI needed for next test step.

By closing the notifications before next action we make sure that test
won't fail because notification covered the required UI.

Reviewed-By: Petr Cech <pcech@redhat.com>
2018-02-20 15:17:13 +01:00
Felipe Barreto
a5bd7bf766 WebUI Tests: changing the ActionsChains.move_to_element to a new approach
The approach ActionChains.move_to_element no longer works as said here [1],
so, it's necessary to change it to the new one. This means, running a
javascript script to move the page to where the element is.

There are more details in the link [1], but in summary the w3c spec is
not obvious if a click should scroll the page to the element or not.
In one hand Chrome and Edge does that, but Firefox don't. As we use
Firefox to run the tests, we need the workaround.

[1] https://github.com/mozilla/geckodriver/issues/776

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-02-16 09:57:07 +01:00
Felipe Barreto
81fb7e5a32 WebUI Tests: fixing test_user.py::test_test_noprivate_posix
When filling the combo box (the gidnumber) in the dialog to create a new
user, the Add button was also clicked; closing the dialog. The wait
makes it to not click.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-02-16 09:57:07 +01:00
Felipe Barreto
a072fe9718 WebUI Tests: Changing how the initial load process is done
Instead of always entering the address on the address bar and reloading the
application, now the code checks if that is necessary.

With the change, the logout process is done correctly and we do not keep any
AJAX call left behind. Which could cause the user not being logout properly and
breaking the tests.

More about the logout problem described in:
https://github.com/freeipa/freeipa/pull/1479

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-02-16 09:57:07 +01:00
Felipe Barreto
12da43c54f WebUI Tests: fixing test_range test case
As described in the commit [1] and ticket [2], it should not be possible to
change the range of a local IPA domain.

The basic_crud was changed to make it flexible to do not run the mod operation
if needed.

[1] 55feea500b
[2] https://pagure.io/freeipa/issue/4826

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-02-16 09:57:07 +01:00
Felipe Barreto
49a17e98b0 WebUI Tests: changing how the login screen is detected
The "rcue-login-screen" element does not exist anymore. Changing the
code to use the ".login-pf" instead.

With the change, it's also necessary to check if the login screen is still
visible when trying to fill the fields of new password, otherwise a
StaleElementReferenceException exception will be raised.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-02-16 09:57:07 +01:00
Felipe Barreto
7c3f9b79eb WebUI Tests: refactoring login method to be more readable
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-02-16 09:57:07 +01:00
Christian Heimes
d7426ccbe7 Replace nose with unittest and pytest
* Replace raise nose.SkipTest with raise unittest.SkipTest
* Replace nose.tools.assert_equal(a, b) with assert a == b
* Replace nose.tools.raises with pytest.raises
* Convert @raises decorator to pytest.raises() but just for relevant
  lines.
* Remove nose dependency

I left the nose_compat pytest plugin in place. It can be removed in
another request in case it is no longer used.

https://pagure.io/freeipa/issue/7301

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2017-12-12 16:16:58 +01:00
Pavel Vomacka
4d9d953663 Extend ui_driver to support geckodriver log_path
Geckodriver automatically logs into geckodriver.log file which
is placed in the same directory from which tests are run. In case
of running tests using ipa-run-tests the current working directory is
/usr/lib/python*/site-packages/ipatests where most of users cannot
write because of priviledges.

By adding "geckodriver_log_path" into test configuration we allow to
set path where user who run tests have priviledges to write.

Config file might be seen here:
https://www.freeipa.org/page/Web_UI_Integration_Tests#Running_tests

Fixes: https://pagure.io/freeipa/issue/7311
Reviewed-By: Christian Heimes <cheimes@redhat.com>
2017-12-12 14:19:44 +01:00
Christian Heimes
b98f9b46de Add marker needs_ipaapi and option to skip tests
The new marker needs_ipaapi is used to mark tests that needs an
initialized API (ipalib.api) or some sort of other API services (running
LDAP server) to work. Some packages use api.Command or api.Backend on
module level. They are not marked but rather skipped entirely.

A new option ``skip-ipaapi`` is added to skip all API based tests. With
the option, only simple unit tests are executed. As of now, freeIPA
contains more than 500 unit tests that can be executed in about 5
seconds.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2017-12-11 20:40:06 +01:00