def setUp(self, masterqa_mode=False):
self.masterqa_mode = masterqa_mode<EOL>self.is_pytest = None<EOL>try:<EOL><INDENT>self.is_pytest = sb_config.is_pytest<EOL><DEDENT>except Exception:<EOL><INDENT>self.is_pytest = False<EOL><DEDENT>if self.is_pytest:<EOL><INDENT>test_id = "<STR_LIT>" % (self.__class__.__module__,<EOL>self.__class__.__name__,<EOL>self._testMethodName)<EOL>self.browser = sb_config.browser<EOL>self.data = sb_config.data<EOL>self.demo_mode = sb_config.demo_mode<EOL>self.demo_sleep = sb_config.demo_sleep<EOL>self.highlights = sb_config.highlights<EOL>self.environment = sb_config.environment<EOL>self.env = self.environment  <EOL>self.with_selenium = sb_config.with_selenium  <EOL>self.headless = sb_config.headless<EOL>self.headless_active = False<EOL>self.log_path = sb_config.log_path<EOL>self.with_testing_base = sb_config.with_testing_base<EOL>self.with_basic_test_info = sb_config.with_basic_test_info<EOL>self.with_screen_shots = sb_config.with_screen_shots<EOL>self.with_page_source = sb_config.with_page_source<EOL>self.with_db_reporting = sb_config.with_db_reporting<EOL>self.with_s3_logging = sb_config.with_s3_logging<EOL>self.servername = sb_config.servername<EOL>self.port = sb_config.port<EOL>self.proxy_string = sb_config.proxy_string<EOL>self.user_agent = sb_config.user_agent<EOL>self.cap_file = sb_config.cap_file<EOL>self.database_env = sb_config.database_env<EOL>self.message_duration = sb_config.message_duration<EOL>self.js_checking_on = sb_config.js_checking_on<EOL>self.ad_block_on = sb_config.ad_block_on<EOL>self.verify_delay = sb_config.verify_delay<EOL>self.disable_csp = sb_config.disable_csp<EOL>self.save_screenshot_after_test = sb_config.save_screenshot<EOL>self.visual_baseline = sb_config.visual_baseline<EOL>self.timeout_multiplier = sb_config.timeout_multiplier<EOL>self.pytest_html_report = sb_config.pytest_html_report<EOL>self.report_on = False<EOL>if self.pytest_html_report:<EOL><INDENT>self.report_on = True<EOL><DEDENT>self.use_grid = False<EOL>if self.servername != "<STR_LIT:localhost>":<EOL><INDENT>self.use_grid = True<EOL><DEDENT>if self.with_db_reporting:<EOL><INDENT>from seleniumbase.core.application_manager import (<EOL>ApplicationManager)<EOL>from seleniumbase.core.testcase_manager import (<EOL>ExecutionQueryPayload)<EOL>import getpass<EOL>self.execution_guid = str(uuid.uuid4())<EOL>self.testcase_guid = None<EOL>self.execution_start_time = <NUM_LIT:0><EOL>self.case_start_time = <NUM_LIT:0><EOL>self.application = None<EOL>self.testcase_manager = None<EOL>self.error_handled = False<EOL>self.testcase_manager = TestcaseManager(self.database_env)<EOL>exec_payload = ExecutionQueryPayload()<EOL>exec_payload.execution_start_time = int(time.time() * <NUM_LIT:1000>)<EOL>self.execution_start_time = exec_payload.execution_start_time<EOL>exec_payload.guid = self.execution_guid<EOL>exec_payload.username = getpass.getuser()<EOL>self.testcase_manager.insert_execution_data(exec_payload)<EOL>data_payload = TestcaseDataPayload()<EOL>self.testcase_guid = str(uuid.uuid4())<EOL>data_payload.guid = self.testcase_guid<EOL>data_payload.execution_guid = self.execution_guid<EOL>if self.with_selenium:<EOL><INDENT>data_payload.browser = self.browser<EOL><DEDENT>else:<EOL><INDENT>data_payload.browser = "<STR_LIT>"<EOL><DEDENT>data_payload.test_address = test_id<EOL>application = ApplicationManager.generate_application_string(<EOL>self._testMethodName)<EOL>data_payload.env = application.split('<STR_LIT:.>')[<NUM_LIT:0>]<EOL>data_payload.start_time = application.split('<STR_LIT:.>')[<NUM_LIT:1>]<EOL>data_payload.state = constants.State.NOTRUN<EOL>self.testcase_manager.insert_testcase_data(data_payload)<EOL>self.case_start_time = int(time.time() * <NUM_LIT:1000>)<EOL><DEDENT>if self.headless:<EOL><INDENT>try:<EOL><INDENT>from pyvirtualdisplay import Display<EOL>self.display = Display(visible=<NUM_LIT:0>, size=(<NUM_LIT>, <NUM_LIT>))<EOL>self.display.start()<EOL>self.headless_active = True<EOL><DEDENT>except Exception:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>if not hasattr(self, "<STR_LIT>"):<EOL><INDENT>raise Exception("""<STR_LIT>"""<EOL>"""<STR_LIT>"""<EOL>"""<STR_LIT>""")<EOL><DEDENT>self.driver = self.get_new_driver(browser=self.browser,<EOL>headless=self.headless,<EOL>servername=self.servername,<EOL>port=self.port,<EOL>proxy=self.proxy_string,<EOL>agent=self.user_agent,<EOL>switch_to=True,<EOL>cap_file=self.cap_file,<EOL>disable_csp=self.disable_csp)<EOL>self._default_driver = self.driver<EOL>
Be careful if a subclass of BaseCase overrides setUp()
You'll need to add the following line to the subclass setUp() method:
super(SubClassOfBaseCase, self).setUp()