Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium Test Rewrite for Sysmon Summary Dashboard #301

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from .lib import dashboard_test_function

class TestSysmonSummaryDashboard:
dashboard_id = "d2c73990-e5d4-11e9-8f1d-73a2ea4cc3ed"
Expand All @@ -15,52 +16,33 @@ def setup_login(self, driver, login):

def test_count_of_sysmon_events_by_event_code(self, setup_login, kibana_url, timeout):
driver = setup_login
driver.get(f"{kibana_url}/app/dashboards#/view/{self.dashboard_id}")
expected_cond = EC.presence_of_element_located((By.CLASS_NAME, "react-grid-layout"))
WebDriverWait(driver, timeout).until(expected_cond)
panel_title = "Count of Sysmon events by event code"
selector = f'div[data-title="{panel_title}"]'
expected_cond = EC.presence_of_element_located((By.CSS_SELECTOR, selector))
WebDriverWait(driver, timeout).until(expected_cond)
panel = driver.find_element(By.CSS_SELECTOR, selector)
assert "No results found" not in panel.get_attribute("innerHTML")
dashboard_test_function(driver, kibana_url, timeout, self.dashboard_id, "Count of Sysmon events by event code", ".tbvChart",".visError")


def test_total_number_of_sysmon_events_found(self, setup_login, kibana_url, timeout):
driver = setup_login
dashboard_test_function(driver, kibana_url, timeout, self.dashboard_id, "Total number of Sysmon events found", ".visualization",".dummyval")
# The arguement ".dummyval" is being used though it is not a valid selector.
# This panel should always have a visualization so there should never be no data message displayed.
# If there is no visualization rendered or "No Results found" message is displayed for this panel on dashboard, this test should fail which is correct behavior



def test_percentage_of_sysmon_events_by_event_code(self, setup_login, kibana_url, timeout):
driver = setup_login
driver.get(f"{kibana_url}/app/dashboards#/view/{self.dashboard_id}")
expected_cond = EC.presence_of_element_located((By.CLASS_NAME, "react-grid-layout"))
WebDriverWait(driver, timeout).until(expected_cond)
panel_title = "Percentage of Sysmon events by event code"
selector = f'div[data-title="{panel_title}"]'
expected_cond = EC.presence_of_element_located((By.CSS_SELECTOR, selector))
WebDriverWait(driver, timeout).until(expected_cond)
panel = driver.find_element(By.CSS_SELECTOR, selector)
assert "No results found" not in panel.get_attribute("innerHTML")

@pytest.mark.skip(reason="Skipping this test")
dashboard_test_function(driver, kibana_url, timeout, self.dashboard_id, "Percentage of Sysmon events by event code", ".echChart",".euiText")

def test_sysmon_events(self, setup_login, kibana_url, timeout):
driver = setup_login
driver.get(f"{kibana_url}/app/dashboards#/view/{self.dashboard_id}")
expected_cond = EC.presence_of_element_located((By.CLASS_NAME, "react-grid-layout"))
WebDriverWait(driver, timeout).until(expected_cond)
panel_title = "Sysmon events"
selector = f'div[data-title="{panel_title}"]'
expected_cond = EC.presence_of_element_located((By.CSS_SELECTOR, selector))
WebDriverWait(driver, timeout).until(expected_cond)
panel = driver.find_element(By.CSS_SELECTOR, selector)
assert "No results found" not in panel.get_attribute("innerHTML")

@pytest.mark.skip(reason="Skipping this test")
dashboard_test_function(driver, kibana_url, timeout, self.dashboard_id, "Sysmon events", ".echChart",".visError")

def test_top10_hosts_generating_most_sysmon_data(self, setup_login, kibana_url, timeout):
driver = setup_login
driver.get(f"{kibana_url}/app/dashboards#/view/{self.dashboard_id}")
expected_cond = EC.presence_of_element_located((By.CLASS_NAME, "react-grid-layout"))
WebDriverWait(driver, timeout).until(expected_cond)
panel_title = "Top 10 hosts generating the most Sysmon data"
selector = f'div[data-title="{panel_title}"]'
expected_cond = EC.presence_of_element_located((By.CSS_SELECTOR, selector))
WebDriverWait(driver, timeout).until(expected_cond)
panel = driver.find_element(By.CSS_SELECTOR, selector)
assert "No results found" not in panel.get_attribute("innerHTML")
dashboard_test_function(driver, kibana_url, timeout, self.dashboard_id, "Top 10 hosts generating the most Sysmon data", ".tbvChart",".visError")


def test_sysmon_events_code_reference(self, setup_login, kibana_url, timeout):
driver = setup_login
dashboard_test_function(driver, kibana_url, timeout, self.dashboard_id, "Sysmon event code reference", ".visualization",".dummyval")


Loading