How to use the apiritif.transaction_logged function in apiritif

To help you get started, we’ve selected a few apiritif examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Blazemeter / taurus / tests / resources / selenium / test_old_flow.py View on Github external
def test_1_t1(self):
        try:
            self.driver.execute_script('/* FLOW_MARKER test-case-start */', {
                'testCaseName': 't1',
                'testSuiteName': 'sdsdsds-Selenium',
            })
            with apiritif.transaction_logged('t1'):
                self.driver.get('http://blazedemo.com/purchase.php')
                self.driver.find_element(By.CSS_SELECTOR, 'input.btn.btn-primary').click()
        except AssertionError as exc:
            self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
                'status': 'failed',
                'message': str(exc),
            })
            raise
        except BaseException as exc:
            self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
                'status': 'broken',
                'message': str(exc),
            })
            raise
        else:
            self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
github Blazemeter / taurus / tests / resources / selenium / test_old_flow.py View on Github external
def test_2_t2(self):
        try:
            self.driver.execute_script('/* FLOW_MARKER test-case-start */', {
                'testCaseName': 't2',
                'testSuiteName': 'sdsdsds-Selenium',
            })
            with apiritif.transaction_logged('t2'):
                self.driver.get('https://www.belarus.by/en/')
                body = self.driver.page_source
                re_pattern = re.compile('In God we trust')
                self.assertNotEqual(0, len(re.findall(re_pattern, body)),
                                    "Assertion: 'In God we trust' not found in BODY")
        except AssertionError as exc:
            self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
                'status': 'failed',
                'message': str(exc),
            })
            raise
        except BaseException as exc:
            self.driver.execute_script('/* FLOW_MARKER test-case-stop */', {
                'status': 'broken',
                'message': str(exc),
            })
github Blazemeter / taurus / tests / resources / selenium / generated_from_requests.py View on Github external
def test_requests(self):
        self.driver.implicitly_wait(3.5)

        with apiritif.transaction_logged(self.template('/')):
            self.driver.get(self.template('http://blazedemo.com/'))

            WebDriverWait(self.driver, 3.5).until(econd.presence_of_element_located((By.XPATH, self.template("//input[@type='submit']"))), 'Element "//input[@type=\'submit\']" failed to appear within 3.5s')
            self.assertEqual(self.driver.title, self.template('BlazeDemo'))
            ActionChains(self.driver).move_to_element(self.driver.find_element(By.XPATH, self.template('/html/body/div[2]/div/p[2]/a'))).perform()
            ActionChains(self.driver).double_click(self.driver.find_element(By.XPATH, self.template('/html/body/div[3]/h2'))).perform()
            ActionChains(self.driver).click_and_hold(self.driver.find_element(By.XPATH, self.template('/html/body/div[3]/form/select[1]'))).perform()
            ActionChains(self.driver).release(self.driver.find_element(By.XPATH, self.template('/html/body/div[3]/form/select[1]/option[6]'))).perform()
            Select(self.driver.find_element(By.NAME, self.template('toPort'))).select_by_visible_text(self.template('London'))
            self.driver.find_element(By.CSS_SELECTOR, self.template('body input.btn.btn-primary')).send_keys(Keys.ENTER)
            self.assertEqual(self.template(self.driver.find_element(By.ID, self.template('address')).get_attribute('value')).strip(), self.template('123 Beautiful st.').strip())
            self.assertEqual(self.template(self.driver.find_element(By.XPATH, self.template('/html/body/div[2]/form/div[1]/label')).get_attribute('innerText')).strip(), self.template('${name}').strip())
            WebDriverWait(self.driver, 3.5).until(econd.visibility_of_element_located((By.NAME, self.template('toPort'))), "Element 'toPort' failed to appear within 3.5s")
            self.driver.find_element(By.NAME, self.template('toPort')).send_keys(self.template('B'))
            self.driver.find_element(By.NAME, self.template('toPort')).clear()
            self.driver.find_element(By.NAME, self.template('toPort')).send_keys(self.template('B'))