Before switching to Chrome

This commit is contained in:
nicolargo 2024-12-28 10:25:37 +01:00
parent 754898854f
commit d92c18784e
1 changed files with 5 additions and 25 deletions

View File

@ -9,31 +9,11 @@
"""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):
def test_title(glances_webserver, firefox_browser):
"""
Test the title of the Python.org website
Test the title of the Glances home page
"""
firefox_browser.get("https://www.python.org")
assert firefox_browser.title == "Welcome to Python.org"
assert glances_webserver is not None
firefox_browser.get("http://localhost:61234")
assert "Glances" in firefox_browser.title