/
test_new_flow.py
66 lines (51 loc) · 1.94 KB
/
test_new_flow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# coding=utf-8
import logging
import random
import string
import sys
import unittest
from time import time, sleep
import apiritif
import os
import re
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support import expected_conditions as econd
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from bzt.resources.selenium_extras import add_flow_markers
class TestSdsdsdsSelenium(unittest.TestCase):
def setUp(self):
self.driver = None
options = webdriver.ChromeOptions()
self.driver = webdriver.Chrome(service_log_path='webdriver.log', chrome_options=options)
self.driver.implicitly_wait(60.0)
self.vars = {
}
add_flow_markers()
apiritif.put_into_thread_store(
driver=self.driver,
func_mode=False) # don't stop after failed test case
def _1_t1(self):
with apiritif.smart_transaction('t1'):
self.driver.get('http://blazedemo.com/purchase.php')
self.driver.find_element(By.CSS_SELECTOR, 'input.btn.btn-primary').click()
def _2_t2(self):
with apiritif.smart_transaction('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")
def _3_t3(self):
with apiritif.smart_transaction('t3'):
self.driver.get('some.strange.url')
def test_sdsdsds_Selenium(self):
self._1_t1()
self._2_t2()
self._3_t3()
def tearDown(self):
if self.driver:
self.driver.quit()