-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close #106
- Loading branch information
Showing
15 changed files
with
159 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Tests for quipucords' UI.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""Test utilities for quipucords' UI tests.""" | ||
import pytest | ||
from widgetastic.browser import Browser | ||
|
||
from camayoc.utils import get_qcs_url | ||
|
||
|
||
@pytest.fixture | ||
def browser(selenium): | ||
"""Widgetastic browser fixture.""" | ||
selenium.get(get_qcs_url()) | ||
return Browser(selenium) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# coding=utf-8 | ||
"""Tests for UI login and logout. | ||
:caseautomation: automated | ||
:casecomponent: ui | ||
:caseimportance: high | ||
:caselevel: integration | ||
:requirement: Sonar | ||
:testtype: functional | ||
:upstream: yes | ||
""" | ||
from .views import LoginView, DashboardView | ||
|
||
|
||
def test_login_logout(browser): | ||
"""Login and logout using the default user. | ||
:id: 88bbf267-d32e-44b1-934f-e69c84e5c99d | ||
:description: Login and logout using the default user. | ||
:steps: | ||
1) Access the login page and fill the username and password fields | ||
using the default user credentials. | ||
2) Check if the dashboard page is displayed. | ||
3) Logout and assert that the login page is shown. | ||
:expectedresults: Both login and logout must work. | ||
""" | ||
login = LoginView(browser) | ||
login.username.fill('admin') | ||
login.password.fill('pass') | ||
login.login.click() | ||
|
||
assert browser.selenium.title == 'Red Hat Entitlements Reporting' | ||
|
||
dashboard = DashboardView(browser) | ||
dashboard.user_dropdown.select_item('Logout') | ||
|
||
login.login.wait_displayed() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Quipucords views.""" | ||
from smartloc import Locator | ||
from widgetastic.widget import TextInput, View | ||
from widgetastic_patternfly import Button, NavDropdown | ||
|
||
|
||
class LoginView(View): | ||
"""Login view.""" | ||
|
||
login = Button('Log In', classes=[Button.PRIMARY]) | ||
username = TextInput(locator='#id_username') | ||
password = TextInput(locator='#id_password') | ||
|
||
|
||
class DashboardView(View): | ||
"""Dashboard view.""" | ||
|
||
user_dropdown = NavDropdown( | ||
locator=Locator(css='li.dropdown:nth-child(2)')) | ||
logout = Button('Logout') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ Subpackages | |
|
||
camayoc.tests.qcs.api | ||
camayoc.tests.qcs.cli | ||
camayoc.tests.qcs.ui | ||
|
||
Submodules | ||
---------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
camayoc\.tests\.qcs\.ui\.conftest module | ||
======================================== | ||
|
||
.. automodule:: camayoc.tests.qcs.ui.conftest | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
camayoc\.tests\.qcs\.ui package | ||
=============================== | ||
|
||
.. automodule:: camayoc.tests.qcs.ui | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Submodules | ||
---------- | ||
|
||
.. toctree:: | ||
|
||
camayoc.tests.qcs.ui.conftest | ||
camayoc.tests.qcs.ui.test_login | ||
camayoc.tests.qcs.ui.views | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
camayoc\.tests\.qcs\.ui\.test\_login module | ||
=========================================== | ||
|
||
.. automodule:: camayoc.tests.qcs.ui.test_login | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
camayoc\.tests\.qcs\.ui\.views module | ||
===================================== | ||
|
||
.. automodule:: camayoc.tests.qcs.ui.views | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ Submodules | |
tests.test_api | ||
tests.test_cli | ||
tests.test_config | ||
tests.test_utils | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# coding=utf-8 | ||
"""Unit tests for :mod:`camayoc.utils`.""" | ||
from unittest import mock | ||
|
||
from camayoc import utils | ||
|
||
|
||
def test_get_qcs_url(): | ||
"""Test ``camayoc.utils.get_qcs_url``.""" | ||
with mock.patch('camayoc.utils.get_config') as get_config: | ||
get_config.return_value = { | ||
'qcs': { | ||
'hostname': 'server.example.com', | ||
'https': True, | ||
'port': 443, | ||
} | ||
} | ||
assert utils.get_qcs_url() == 'https://server.example.com:443' |