run the tests
Some checks failed
Execute / build (3.12) (push) Failing after 24s
Pylint / build (3.12) (push) Successful in 10s

This commit is contained in:
Greg Gauthier 2024-07-23 15:48:03 +01:00
parent 63fcdbc922
commit 4e3c267656
6 changed files with 39 additions and 6 deletions

View File

@ -0,0 +1,24 @@
name: Execute
on: [ push ]
jobs:
build:
runs-on: ubuntu-gitea
strategy:
matrix:
python-version: [ "3.12" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Run the pytests
run: pytest -c pytest.ini
- name: Run the behave tests
run: behave

View File

@ -25,6 +25,7 @@ def firefox(headless=True):
options = webdriver.FirefoxOptions()
options.accept_insecure_certs = True
options.headless = headless
options.add_argument('--ignore-certificate-errors')
return webdriver.Firefox(options=options)

View File

@ -1,13 +1,18 @@
import configparser
import os
import pytest
CWD = os.path.dirname(os.path.realpath(__file__))
config = configparser.ConfigParser()
@pytest.fixture(scope="session", autouse=True)
def headless():
return _str_to_bool(_read_config_section("fixtures.ini", "dev")["headless"])
config_file = os.path.join(CWD, "fixtures.ini")
dev_config = _read_config_section(config_file, 'dev')
return _str_to_bool(dev_config["headless"])
def _read_config_section(source, section):

View File

@ -1,2 +1,2 @@
[dev]
headless = True
headless=true

View File

@ -1,29 +1,32 @@
import pytest
from browserdriver import BrowserDriver
def test_firefox_browser(headless):
bd = BrowserDriver().get("firefox", headless=headless)
bd.get('https://test.io')
assert "QA Testing as a Service | test IO" == bd.title
assert bd.title == "Home | Test IO"
bd.quit()
def test_chrome_browser(headless):
bd = BrowserDriver().get("chrome", headless=headless)
bd.get('https://test.io')
assert "QA Testing as a Service | test IO" == bd.title
assert bd.title == "Home | Test IO"
bd.quit()
@pytest.mark.skip(reason="Safari is not available")
def test_safari_browser():
bd = BrowserDriver().get("safari", headless=False)
bd.get('https://test.io')
assert "QA Testing as a Service | test IO" == bd.title
assert bd.title == "Home | Test IO"
bd.quit()
def test_edge_browser(headless):
bd = BrowserDriver().get("edge", headless=headless)
bd.get('https://test.io')
assert "QA Testing as a Service | test IO" == bd.title
assert bd.title == "Home | Test IO"
bd.quit()