-
Hi folks! In my tests I'm using classic Page Object Model with BaseCase inheritance. I want to add additional arguments to test launch by using fixtures and pytest_addoption. For instance for changing base url: conftest.py :
and test_email_authorization.py :
Such test fires error when running:
and I guess that the issue is in using BaseCase inheritance syntax. I have found workaround with overriding setUp() method of BaseCase and using seleniumbase default argument --data, but I wonder if there is a way to add you custom options to tests when using BaseCase inheritace syntax? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello, Or, you can use the existing As you discovered, you can also pass additional options using |
Beta Was this translation helpful? Give feedback.
Hello,
When using pytest fixtures with SeleniumBase, you'll want to use one of the syntax formats that uses the
sb
fixture instead ofBaseCase
inheritance, because pytest fixtures don't work with tests that inheritunittest.TestCase
. You can use the "The classic Page Object Model with the sb pytest fixture" for this.Or, you can use the existing
--env=ENV
option to pass the ENV to the tests, where you can put yourif
statement in there. Eg.--env=staging
,--env=qa
,--env=test
,--env=production
,--env=develop
. Then useself.env
to access that environment in your tests. You have to use one of the predefined values: (choose from 'qa', 'staging', 'develop', 'production', 'master', 'remote', '…