diff --git a/.gitea/workflows/execute.yml b/.gitea/workflows/execute.yml new file mode 100644 index 0000000..69256d7 --- /dev/null +++ b/.gitea/workflows/execute.yml @@ -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 \ No newline at end of file diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/pylint.yml similarity index 100% rename from .gitea/workflows/build.yml rename to .gitea/workflows/pylint.yml diff --git a/browserdriver/__init__.py b/browserdriver/__init__.py index 9459a71..1d8fe10 100755 --- a/browserdriver/__init__.py +++ b/browserdriver/__init__.py @@ -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) diff --git a/conftest.py b/conftest.py index a8f320b..ceaea0a 100755 --- a/conftest.py +++ b/conftest.py @@ -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): diff --git a/fixtures.ini b/fixtures.ini index a889fff..e154250 100644 --- a/fixtures.ini +++ b/fixtures.ini @@ -1,2 +1,2 @@ [dev] -headless = True +headless=true diff --git a/pytests/test_basic.py b/pytests/test_basic.py index 132f3a9..128acac 100644 --- a/pytests/test_basic.py +++ b/pytests/test_basic.py @@ -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()