Skip to content

Commit

Permalink
pipeline v23
Browse files Browse the repository at this point in the history
  • Loading branch information
pszkamruk-splunk committed Nov 7, 2023
1 parent b92208b commit b7c5111
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 71 deletions.
49 changes: 42 additions & 7 deletions .github/workflows/ci-ui-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "next"
- "sc4snmp-ui-tests"
jobs:
run-ui-e2e-tests:
run-ui-e2e-tests-basic:
name: Run UI e2e tests
runs-on: ubuntu-latest
timeout-minutes: 120
Expand Down Expand Up @@ -36,11 +36,6 @@ jobs:
- name: run automatic_setup.sh
run: integration_tests/automatic_setup.sh

# - name: run tests
# working-directory: integration_tests
# run: |
# poetry run pytest --splunk_host="localhost" --splunk_password="changeme2" --trap_external_ip="$(hostname -I | cut -d " " -f1)"
#
- name: install dependencies
working-directory: ui_tests
run: |
Expand All @@ -50,4 +45,44 @@ jobs:
- name: run tests
working-directory: ui_tests
run: |
pytest -vvv --splunk-user=admin --splunk-password="changeme2" --splunk-host="localhost" --device-simulator="$(hostname -I | cut -d " " -f1)"
pytest -vvv --splunk-user=admin --splunk-password="changeme2" --splunk-host="localhost" --device-simulator="$(hostname -I | cut -d " " -f1)" -k basic
run-ui-e2e-tests-integration:
name: Run UI e2e tests
runs-on: ubuntu-latest
timeout-minutes: 120
env:
CI_EXECUTION_TYPE: ci
steps:
- name: Checkout Project
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: prepare values.yaml for configuration storing
working-directory: integration_tests
run: |
sed -i "s|/home/splunker|$(pwd)|g" values.yaml
- name: install microk8s
run: |
sudo snap install microk8s --classic --channel=1.25/stable
sudo apt-get install snmp -y
sudo apt-get install python3-dev -y
- name: run automatic_setup.sh
run: integration_tests/automatic_setup.sh

- name: install dependencies
working-directory: ui_tests
run: |
pip install -r requirements.txt
export PATH="/home/ubuntu/.local/bin:$PATH"
- name: run tests
working-directory: ui_tests
run: |
pytest -vvv --splunk-user=admin --splunk-password="changeme2" --splunk-host="localhost" --device-simulator="$(hostname -I | cut -d " " -f1)" -k extended
6 changes: 2 additions & 4 deletions ui_tests/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@
p_inventory = InventoryPage()


# @pytest.mark.current
@pytest.mark.basic
def test_check_page_title_is_correct():
"""
Test that SC4SNMP UI page tile is correct
"""
# url = "http://10.202.2.199:30001/"
# driver.get(url)
page_title = driver.title

logger.info(f"Page Title: {page_title}")
assert "SC4SNMP Manager" == page_title

# @pytest.mark.current
@pytest.mark.basic
def test_check_selected_tab_behaviour():
"""
Test that selected tab stays selected upon refreshing page
Expand Down
36 changes: 12 additions & 24 deletions ui_tests/tests/test_error_handling_and_complex_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
values_reader = YamlValuesReader()


# @pytest.mark.current
@pytest.mark.basic
def test_trying_to_configure_profle_with_the_same_name():
"""
Configure profile
Expand Down Expand Up @@ -54,7 +54,7 @@ def test_trying_to_configure_profle_with_the_same_name():
p_profiles.delete_profile_from_list(profile_name)


# @pytest.mark.current
@pytest.mark.basic
def test_trying_to_configure_group_with_the_same_name():
"""
Configure group
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_trying_to_configure_group_with_the_same_name():
p_groups.delete_group_from_list(group_name)


# @pytest.mark.current
@pytest.mark.basic
def test_trying_to_add_group_device_which_already_exists():
"""
Configure group with device
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_trying_to_add_group_device_which_already_exists():
p_groups.delete_group_from_list(group_name)


# @pytest.mark.current
@pytest.mark.basic
def test_trying_to_add_inventory_with_host_which_already_exists():
"""
Configure inventory with host
Expand Down Expand Up @@ -165,7 +165,7 @@ def test_trying_to_add_inventory_with_host_which_already_exists():
p_inventory.delete_entry_from_list(host_ip)


# @pytest.mark.current
@pytest.mark.basic
def test_trying_to_add_inventory_with_group_which_is_already_added():
"""
Configure inventory with group
Expand Down Expand Up @@ -209,7 +209,7 @@ def test_trying_to_add_inventory_with_group_which_is_already_added():
p_groups.delete_group_from_list(group_name)


# @pytest.mark.current
@pytest.mark.basic
def test_trying_to_add_inventory_group_with_host_which_is_configured_as_host():
"""
Configure inventory with group with host
Expand Down Expand Up @@ -260,7 +260,7 @@ def test_trying_to_add_inventory_group_with_host_which_is_configured_as_host():
p_groups.delete_group_from_list(group_name)


# @pytest.mark.current
@pytest.mark.basic
def test_removing_group_which_is_configured_in_inventory():
"""
Configure inventory -> add group as inventory entry
Expand Down Expand Up @@ -302,7 +302,7 @@ def test_removing_group_which_is_configured_in_inventory():
assert is_on_list is False


# @pytest.mark.current
@pytest.mark.basic
def test_removing_profile_which_is_configured_in_inventory():
"""
Configure inventory with profile
Expand Down Expand Up @@ -352,7 +352,7 @@ def test_removing_profile_which_is_configured_in_inventory():
p_inventory.delete_entry_from_list(host)


# @pytest.mark.current
@pytest.mark.basic
def test_try_to_add_to_inventory_group_which_does_not_exist():
"""
Configure inventory with group which does not exist
Expand All @@ -377,7 +377,7 @@ def test_try_to_add_to_inventory_group_which_does_not_exist():
assert is_on_list is False


# @pytest.mark.current
@pytest.mark.basic
def test_trying_to_edit_profile_name_into_profile_name_that_exists():
"""
Configure two profiles
Expand Down Expand Up @@ -415,7 +415,7 @@ def test_trying_to_edit_profile_name_into_profile_name_that_exists():
p_profiles.delete_profile_from_list(profile_name_2)


# @pytest.mark.current
@pytest.mark.basic
def test_trying_to_edit_group_name_into_another_group_name():
"""
Configure two groups
Expand Down Expand Up @@ -449,7 +449,7 @@ def test_trying_to_edit_group_name_into_another_group_name():
p_groups.delete_group_from_list(group_name_2)


# @pytest.mark.current
@pytest.mark.basic
def test_trying_to_edit_inventory_host_into_host_which_exists():
"""
Configure two inventory hosts
Expand Down Expand Up @@ -487,16 +487,4 @@ def test_trying_to_edit_inventory_host_into_host_which_exists():

p_inventory.delete_entry_from_list(host_1)
p_inventory.delete_entry_from_list(host_2)
# host
# group
# inventory entry
# adding ip in group and then adding it one more time as host

# change name to the name which exists profile, group, inventory

# removing group when configured in inventory
# removing profile when configured in inventory

# try to add group which does not exist
# try to add profile which does not exist - will not work - need to select from list
# change name to the name that already exist
12 changes: 6 additions & 6 deletions ui_tests/tests/test_groups_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
p_groups = GroupsPage()
p_inventory = InventoryPage()


@pytest.mark.basic
def test_add_and_remove_group():
"""
Test that user is able to add group,
Expand All @@ -36,7 +36,7 @@ def test_add_and_remove_group():
is_on_list = p_groups.check_if_groups_is_on_list(group_name)
assert is_on_list is False


@pytest.mark.basic
def test_change_group_name():
"""
Test that user is able to add group,
Expand Down Expand Up @@ -69,7 +69,7 @@ def test_change_group_name():
is_on_list = p_groups.check_if_groups_is_on_list(new_group_name)
assert is_on_list is False

# @pytest.mark.current
@pytest.mark.basic
def test_try_adding_device_to_group_with_no_data():
"""
Test that user is not able to add device with no data
Expand All @@ -95,7 +95,7 @@ def test_try_adding_device_to_group_with_no_data():
is_on_list = p_groups.check_if_groups_is_on_list(group_name)
assert is_on_list is False


@pytest.mark.basic
def test_add_and_remove_device_into_group():
"""
Test that user is able to add device into group,
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_add_and_remove_device_into_group():
is_on_list = p_groups.check_if_groups_is_on_list(group_name)
assert is_on_list is False


@pytest.mark.basic
def test_add_device_with_all_fields():
"""
Test that user is able to add device into group,
Expand Down Expand Up @@ -172,7 +172,7 @@ def test_add_device_with_all_fields():
is_on_list = p_groups.check_if_groups_is_on_list(group_name)
assert is_on_list is False


@pytest.mark.basic
def test_edit_device_with_all_fields():
"""
Test that user is able to add device into group,
Expand Down
16 changes: 8 additions & 8 deletions ui_tests/tests/test_inventory_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
p_groups = GroupsPage()
p_inventory = InventoryPage()


@pytest.mark.basic
def test_add_and_remove_inventory_entry():
"""
Test that user is able to add inventory entry,
Expand All @@ -38,7 +38,7 @@ def test_add_and_remove_inventory_entry():
is_on_list = p_inventory.check_if_entry_is_on_list(host_ip)
assert is_on_list is False


@pytest.mark.basic
def test_add_device_into_inventory_then_change_it():
"""
Test that user is able to add inventory entry,
Expand Down Expand Up @@ -78,7 +78,7 @@ def test_add_device_into_inventory_then_change_it():
is_on_list = p_inventory.check_if_entry_is_on_list(new_host_ip)
assert is_on_list is False


@pytest.mark.basic
def test_add_group_into_inventory_entry():
"""
Test that user is able to add inventory entry,
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_add_group_into_inventory_entry():
is_on_list = p_groups.check_if_groups_is_on_list(group_name)
assert is_on_list is False

#@pytest.mark.current
@pytest.mark.basic
def test_try_to_add_device_with_no_data_into_inventory():
"""
Test that user is not able to add inventory entry with no data
Expand Down Expand Up @@ -160,7 +160,7 @@ def test_try_to_add_device_with_no_data_into_inventory():
is_on_list = p_inventory.check_if_entry_is_on_list(host)
assert is_on_list is False

#@pytest.mark.current
@pytest.mark.basic
def test_setting_min_walk_interval_value_in_inventory():
"""
Test that user able to set walk interval value
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_setting_min_walk_interval_value_in_inventory():
is_on_list = p_inventory.check_if_entry_is_on_list(host)
assert is_on_list is False

#@pytest.mark.current
@pytest.mark.basic
def test_setting_max_walk_interval_value_in_inventory():
"""
Test that user able to set walk interval value
Expand Down Expand Up @@ -233,7 +233,7 @@ def test_setting_max_walk_interval_value_in_inventory():
is_on_list = p_inventory.check_if_entry_is_on_list(host)
assert is_on_list is False

# @pytest.mark.current
@pytest.mark.basic
def test_try_to_add_device_with_all_available_fields_into_inventory():
"""
Test that user is not able to add inventory entry all available fields
Expand Down Expand Up @@ -288,7 +288,7 @@ def test_try_to_add_device_with_all_available_fields_into_inventory():
p_profiles.delete_profile_from_list(profile_1)
p_profiles.delete_profile_from_list(profile_2)

# @pytest.mark.current
@pytest.mark.basic
def test_edit_inventory_entry_with_all_available_fields():
"""
Test that user is not able to add inventory entry all available fields
Expand Down
21 changes: 5 additions & 16 deletions ui_tests/tests/test_profiles_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,7 @@
p_inventory = InventoryPage()


@pytest.mark.skip(reason="PoC test case")
def test_check_page_title_is_correct_onet_for_ci_only():
"""
Test that SC4SNMP UI page tile is correct
"""
url = "https://www.onet.pl/"
driver.get(url)
page_title = driver.title
logger.info(f"Page Title: {page_title}")
assert "Onet – Jesteś na bieżąco" == page_title


@pytest.mark.basic
@pytest.mark.parametrize("profile_type",
["standard",
"base"])
Expand Down Expand Up @@ -57,7 +46,7 @@ def test_add_profile(profile_type):
exist = p_profiles.check_if_profile_is_configured(profile_name)
assert exist is False


@pytest.mark.basic
def test_add_smart_profile():
"""
Test that user is able to add smart profile,
Expand Down Expand Up @@ -87,7 +76,7 @@ def test_add_smart_profile():
exist = p_profiles.check_if_profile_is_configured(profile_name)
assert exist is False


@pytest.mark.basic
def test_add_walk_profile():
"""
Test that user is able to add walk profile,
Expand Down Expand Up @@ -116,7 +105,7 @@ def test_add_walk_profile():
exist = p_profiles.check_if_profile_is_configured(profile_name)
assert exist is False


@pytest.mark.basic
def test_add_conditional_profile():
"""
Test that user is able to add conditional profile,
Expand All @@ -143,7 +132,7 @@ def test_add_conditional_profile():
exist = p_profiles.check_if_profile_is_configured(profile_name)
assert exist is False


@pytest.mark.basic
def test_edit_profile():
"""
Test that user is able to edit profile,
Expand Down
Loading

0 comments on commit b7c5111

Please sign in to comment.