mirror of https://github.com/nicolargo/glances.git
First test with Selenium
This commit is contained in:
parent
4bb39232fe
commit
ec0d5695a9
3
Makefile
3
Makefile
|
|
@ -94,6 +94,9 @@ test-core: ## Run Core unit tests
|
|||
test-restful: ## Run Restful API unit tests
|
||||
$(PYTEST) tests/test_restful.py
|
||||
|
||||
test-webui: ## Run WebUI unit tests
|
||||
$(PYTEST) tests/test_webui.py
|
||||
|
||||
test-xmlrpc: ## Run XMLRPC API unit tests
|
||||
$(PYTEST) tests/test_xmlrpc.py
|
||||
|
||||
|
|
|
|||
|
|
@ -11,5 +11,7 @@ pyright
|
|||
pytest
|
||||
requirements-parser
|
||||
ruff
|
||||
selenium
|
||||
semgrep
|
||||
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
|
||||
webdriver-manager
|
||||
|
|
|
|||
|
|
@ -35,10 +35,36 @@ urls.Homepage = "https://github.com/nicolargo/glances"
|
|||
|
||||
[project.optional-dependencies]
|
||||
action = ["chevron"]
|
||||
# all but not dev
|
||||
all = ["glances[action,browser,cloud,containers,export,gpu,graph,ip,raid,sensors,smart,snmp,sparklines,web,wifi]"]
|
||||
browser = ["zeroconf"]
|
||||
cloud = ["requests"]
|
||||
containers = ["docker>=6.1.1", "packaging", "podman", "python-dateutil", "six"]
|
||||
containers = [
|
||||
"docker>=6.1.1",
|
||||
"packaging",
|
||||
"podman",
|
||||
"python-dateutil",
|
||||
"six",
|
||||
]
|
||||
dev = [
|
||||
"codespell",
|
||||
"fonttools>=4.43.0",
|
||||
"gprof2dot",
|
||||
"matplotlib",
|
||||
"memory-profiler",
|
||||
"numpy>=1.22.2",
|
||||
"pillow>=10.0.1",
|
||||
"pre-commit",
|
||||
"py-spy",
|
||||
"pyright",
|
||||
"pytest",
|
||||
"requirements-parser",
|
||||
"ruff",
|
||||
"selenium",
|
||||
"semgrep",
|
||||
"setuptools>=65.5.1",
|
||||
"webdriver-manager",
|
||||
]
|
||||
export = [
|
||||
"bernhard",
|
||||
"cassandra-driver",
|
||||
|
|
@ -64,7 +90,12 @@ sensors = ["batinfo; platform_system == 'Linux'"]
|
|||
smart = ["pySMART.smartx"]
|
||||
snmp = ["pysnmp-lextudio<6.2.0"]
|
||||
sparklines = ["sparklines"]
|
||||
web = ["fastapi>=0.82.0", "jinja2", "requests", "uvicorn"]
|
||||
web = [
|
||||
"fastapi>=0.82.0",
|
||||
"jinja2",
|
||||
"requests",
|
||||
"uvicorn",
|
||||
]
|
||||
wifi = ["wifi"]
|
||||
|
||||
[project.scripts]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
defusedxml
|
||||
packaging
|
||||
psutil>=5.6.7
|
||||
windows-curses; platform_system == 'Windows'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Glances - An eye on your system
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 Nicolas Hennion <nicolas@nicolargo.com>
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-3.0-only
|
||||
#
|
||||
|
||||
"""Glances unitary tests suite for the WebUI."""
|
||||
|
||||
import pytest
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver import FirefoxOptions
|
||||
from selenium.webdriver.firefox.service import Service as FirefoxService
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def firefox_browser():
|
||||
"""Init Firefox browser."""
|
||||
opts = FirefoxOptions()
|
||||
opts.add_argument("--headless")
|
||||
srv = FirefoxService(executable_path="/snap/bin/geckodriver")
|
||||
driver = webdriver.Firefox(options=opts, service=srv)
|
||||
|
||||
# Yield the WebDriver instance
|
||||
driver.implicitly_wait(10)
|
||||
yield driver
|
||||
|
||||
# Close the WebDriver instance
|
||||
driver.quit()
|
||||
|
||||
|
||||
def test_title(firefox_browser):
|
||||
"""
|
||||
Test the title of the Python.org website
|
||||
"""
|
||||
firefox_browser.get("https://www.python.org")
|
||||
assert firefox_browser.title == "Welcome to Python.org"
|
||||
Loading…
Reference in New Issue