def setUpClass(cls): # config values cls._PATH_ATTACHMENT = cls._get_directory_test_root() + '/assets/' cls._READ_BYTES = "rb" cls._CONTENT_TYPE = Config.get_attachment_content_type() cls._ATTACHMENT_DESCRIPTION = Config.get_attachment_description() cls._ATTACHMENT_PATH_IN = Config.get_attachment_path_in() cls._API_CONTEXT = cls._get_api_context()
def setUpClass(cls): cls._REQUEST_AMOUNT_EUR = '0.01' cls._REQUEST_CURRENCY = 'EUR' cls._FIELD_DESCRIPTION = 'Python unit test request' cls._FIELD_STATUS = 'ACCEPTED' cls._FIRST_INDEX = 0 cls._USER_ID = Config.get_user_id() cls._COUNTER_PARTY_SAME_USER = Config.get_pointer_counter_party_self() cls._MONETARY_ACCOUNT_ID = Config.get_monetary_account_id_1() cls._MONETARY_ACCOUNT_ID2 = Config.get_monetary_account_id_2() cls._API_CONTEXT = cls._get_api_context()
def setUpClass(cls): cls._PAYMENT_AMOUNT_EUR = '0.01' cls._PAYMENT_CURRENCY = 'EUR' cls._PAYMENT_DESCRIPTION = 'Python unit test' cls._PAYMENT_CHAT_TEXT_MESSAGE = 'send from python test' cls._USER_ID = Config.get_user_id() cls._COUNTER_PARTY_OTHER_USER = Config.get_pointer_counter_party_other( ) cls._COUNTER_PARTY_SAME_USER = Config.get_pointer_counter_party_self() cls._MONETARY_ACCOUNT_ID = Config.get_monetary_account_id_1() cls._API_CONTEXT = cls._get_api_context()
def setUpClass(cls): cls._USER_ID = Config.get_user_id() cls._MONETARY_ACCOUNT_ID = Config.get_monetary_account_id_1() cls._CASH_REGISTER_ID = Config.get_cash_register_id() cls._AMOUNT_EUR = '0.02' cls._CURRENCY = 'EUR' cls._STATUS_OPEN = 'OPEN' cls._TAB_ITEM_FIELD_DESCRIPTION = 'Super expensive python tea' cls._STATUS_WAITING = 'WAITING_FOR_PAYMENT' cls._TAB_FIELD_DESCRIPTION = 'Pay the tab for Python test please.' cls._API_CONTEXT = cls._get_api_context()
def setUp(self): self.config = Config() self.test_train_model = TrainModel(self.config) self.dummy_data_df = pd.DataFrame( np.array([['val11', 'val12', 'val13'], ['val21', 'val22', 'val23'], ['val31', 'val32', 'val33']]), columns=self.config.ALL_PRODUCT_ATTRS)
def setUpClass(cls): cls.client = BaseUser(NoSuchUser) cls.page = None cls.config = Config() with allure.step("Initial data setup > clean DB"): clean_database(cls.config)
def setUpClass(cls): cls._CARD_PIN_CODE = '4045' cls._FIRST_INDEX = 0 cls._SECOND_LINE_LENGTH_MAXIMUM = 20 cls._STRING_EMPTY = '' cls._USER_ID = Config.get_user_id() cls._API_CONTEXT = cls._get_api_context()
def setUpClass(cls): with allure.step("Open web browser"): cls.page_model = RegisterPageModel cls.page_content = RegisterPageContent cls.config = Config() cls.page = open_web_browser(config=cls.config, page_model=cls.page_model, page_content=cls.page_content)
def setUpClass(cls): cls._FIELD_STATUS = 'CANCELLED' cls._FIELD_SUB_STATUS = 'REDEMPTION_VOLUNTARY' cls._FIELD_REASON = 'OTHER' cls._FIELD_REASON_DESCRIPTION = 'Because this is a test' cls._FIELD_CURRENCY = 'EUR' cls._MONETARY_ACCOUNT_PREFIX = 'Python_test' cls._USER_ID = Config.get_user_id() cls._API_CONTEXT = cls._get_api_context()
def setUpClass(cls): cls.client = BaseUser(JohnDoe) cls.page = None cls.config = Config() with allure.step("Initial data setup > clean DB"): clean_database(cls.config) register_user(user=cls.client, config=cls.config)
def setUpClass(cls): cls.user = BaseUser(NoSuchUser) cls.page_model = HomePageModel cls.page_content = HomePageContent cls.config = Config() with allure.step("Initial data setup > clean DB"): clean_database(cls.config) with allure.step("Open web browser"): cls.page = open_web_browser(config=cls.config, page_model=cls.page_model, page_content=cls.page_content)
def setUpClass(cls): cls.user = BaseUser(EmptyFields) cls.page_model = ServicesPageModel cls.page_context = ServicesPageContent cls.config = Config() with allure.step("Initial data setup > clean DB"): clean_database(cls.config) with allure.step("Open web browser"): cls.page = open_web_browser(config=cls.config, page_model=cls.page_model, page_content=cls.page_context)
def setUpClass(cls): cls.client = BaseUser(EmptyFields) cls.page = None cls.page_model = ContactPageModel cls.page_content = ContactPageContent cls.message = "" cls.config = Config() with allure.step( "Initial data setup: {}".format(cls.config.base_url + ContactPageContent.URL)): with allure.step("Open web browser"): cls.page = open_web_browser(config=cls.config, page_model=cls.page_model, page_content=cls.page_content)
def setUpClass(cls): cls.client = BaseUser(JohnDoe) cls.page = None cls.page_model = ContactPageModel cls.page_content = ContactPageContent cls.message = "Hello there. This is test message. Thanks" cls.config = Config() with allure.step( "Initial data setup: {}".format(cls.config.base_url + ContactPageContent.URL)): with allure.step("Open web browser"): cls.page = open_web_browser(config=cls.config, page_model=cls.page_model, page_content=cls.page_content)
def setUpClass(cls): cls.user = BaseUser(JaneDoe) cls.page_model = AdminPageModel cls.page_context = AdminPageContent cls.config = Config() with allure.step("Initial data setup > clean DB"): clean_database(cls.config) with allure.step("Initial data setup > register test user"): register_user(user=cls.user, config=cls.config) with allure.step("Open web browser"): cls.page = open_web_browser(config=cls.config, page_model=cls.page_model, page_content=cls.page_context)
def setUpClass(cls): cls.user = BaseUser(JaneDoe) cls.payee = JohnDoe cls.page_model = HomePageModel cls.page_context = HomePageContent cls.transfer_amount = '153.45' cls.account = '11223344' cls.total_left = cls.user.balance - float(cls.transfer_amount) cls.config = Config() with allure.step("Initial data setup > clean DB"): clean_database(config=cls.config) with allure.step("Initial data setup > register test user"): register_user(user=cls.user, config=cls.config) with allure.step("Open web browser"): cls.page = open_web_browser(config=cls.config, page_model=cls.page_model, page_content=cls.page_context)
"""Test spider runners.""" import logging import pytest from tests.config import Config from rlgpy.scraper.runners import SafeSpiderRunner logger = logging.getLogger(__name__) @pytest.mark.integration @pytest.mark.parametrize( argnames='spider,settings', argvalues=[test for test in Config.spider_test_info()], scope='module') def test_runner_single_no_errors(spider, settings): """Ensure the custom spider runner will run synchronously without producing any errors.""" logger.info('Testing spider runner for {}'.format(spider)) SafeSpiderRunner.run(spider=spider, settings=settings, delete_file=True)
def setUpClass(cls): cls._OUT_PUT_FILE_PATH = 'connectQr.png' cls._WRITE_BYTES = 'wb' cls._EXPIRATION_ADDED_TIME = 1 cls._USER_ID = Config.get_user_id() cls._API_CONTEXT = cls._get_api_context()
def test_user_login_logout_from_home_page(self): allure.dynamic.description(""" User Log In validation > Login from Home page: Prerequisites: DB is clean, user is registered, web browser is opened Step by step: 1. Open Home web page 2. Do URL verification 3. Do Title verification 4. Type username/password 5. Hit "Log In" button 6. Verify "Welcome" message 7. Verify that "Account Services" menu title is present 8. Do URL verification 9. Log Out 10. Do URL verification 11. Verify that "Account Services" menu is not present 12. Verify web page title 13. Close web browser """) allure.dynamic.title( "Home Page > User Log In validation > Positive test") allure.dynamic.severity(allure.severity_level.BLOCKER) config = Config() user = BaseUser(JaneDoe) with allure.step("Initial data setup > clean DB"): clean_database(driver=self.driver, config=config) with allure.step("Initial data setup > register test user"): register_user(driver=self.driver, user=user, config=config) with allure.step("Open web browser"): page = HomePageModel(config=config, driver=self.driver, explicit_wait_time=10) # 1. Open Home web page with allure.step("Open web page"): page.go() # 2. Do URL verification with allure.step("Verify web page URL"): assert config.base_url + HomePageContent.URL == page.url # 3. Do Title verification with allure.step("Verify web page title"): assert HomePageContent.TITLE == page.title # 4. Type username with allure.step("Type username"): page.customer_login.enter_username(user.username) # 4. Type password with allure.step("Type password"): page.customer_login.enter_password(user.password) # 5. Hit "Log In" button with allure.step("Hit \"Log In\" button"): page = page.customer_login.hit_login_button() # 6. Verify "Welcome" message with allure.step("Verify \"Welcome\" message"): assert "Welcome {} {}".format( user.first_name, user.last_name) == page.account_services_menu.welcome_message # 7. Verify that "Account Services" menu title is present with allure.step( "Verify that \"Account Services\" menu title is present"): assert "Account Services" == page.account_services_menu.menu_title # 8. Do URL verification with allure.step("Do URL verification"): assert config.base_url + AccountsOverviewPageContent.URL == page.url # 9. Log Out with allure.step("Log Out"): page = page.account_services_menu.hit_log_out_button() # 10. Do URL verification with allure.step("Do URL verification"): assert config.base_url + HomePageContent.URL == page.url # 11. Verify that "Account Services" menu is not present with allure.step( "Verify that \"Account Services\" menu is not present"): with pytest.raises(NoSuchElementException): AccountServicesMenuModel(config=config, driver=self.driver, explicit_wait_time=10).menu_title() # 12. Verify web page title with allure.step("Verify web page title"): assert HomePageContent.TITLE == page.title # 13. Close web browser with allure.step("Close web browser"): page.close()
def setUpClass(cls): cls._SESSION_ID = 0 cls._API_KEY = Config.get_api_key() cls._BUNQ_CONFIG_FILE = "bunq-test.conf" cls._DEVICE_DESCRIPTION = 'Python test device' cls._API_CONTEXT = cls._get_api_context()
def base_url(env): cfg = Config(env) return cfg.base_url
def setUpClass(cls): cls.client = BaseUser(JohnDoe) cls.page = None cls.config = Config()
def setUpClass(cls): cls.client = BaseUser(JohnDoe) cls.page = None cls.page_model = ForgotLoginInfoPageModel cls.page_context = ForgotLoginInfoPageContent cls.config = Config()
def app_config(env, layer): cfg = Config(env, layer) return cfg
def setUpClass(cls): cls.client = BaseUser(EmptyFields) cls.page = None cls.config = Config()
def app_config(env): cfg = Config(env) return cfg
def test_user_login_with_wrong_password(self): allure.dynamic.description(""" User Log In validation > Wrong password: Prerequisites: DB is clean, user is registered, web browser is opened Step by step: 1. Open Home web page 2. Do URL verification 3. Do Title verification 4. Type correct username + wrong password 5. Hit "Log In" button 6. Verify Page Title 7. Verify error title 8. Verify error message 9. Do URL verification 10. Verify that "Account Services" menu is not displayed 11. Close web browser """) allure.dynamic.title( "Home Page > User Log In validation > Wrong password") allure.dynamic.severity(allure.severity_level.BLOCKER) config = Config() user = BaseUser(JaneDoe) with allure.step("Initial data setup > clean DB"): clean_database(driver=self.driver, config=config) with allure.step("Initial data setup > register test user"): register_user(driver=self.driver, user=user, config=config) with allure.step("Open web browser"): page = HomePageModel(config=config, driver=self.driver, explicit_wait_time=10) # 1. Open Home web page with allure.step("Open web page"): page.go() # 2. Do URL verification with allure.step("Verify web page URL"): assert config.base_url + HomePageContent.URL == page.url # 3. Do Title verification with allure.step("Verify web page title"): assert HomePageContent.TITLE == page.title # 4. Type username with allure.step("Type username"): page.customer_login.enter_username(user.username) # 4. Type password with allure.step("Type password"): page.customer_login.enter_password('wrongpassword') # 5. Hit "Log In" button with allure.step("Hit \"Log In\" button"): page = page.customer_login.hit_login_button() # 6. Verify page title with allure.step("Verify page title"): assert LoginPageContent.TITLE == page.title # 7. Verify error title with allure.step("Verify error title"): assert LoginPageContent.ERROR_TITLE == page.error_title # 8. Verify error message with allure.step("Verify error message"): assert LoginPageContent.NO_SUCH_USER_ERROR_MESSAGE == page.error_message # 9. Do URL verification with allure.step("Do URL verification"): assert config.base_url + LoginPageContent.URL == page.url # 10. Verify that "Account Services" menu is not displayed with allure.step( "Verify that \"Account Services\" menu is not displayed"): with pytest.raises(NoSuchElementException): AccountServicesMenuModel(config=config, driver=self.driver, explicit_wait_time=10).menu_title() # 11. Close web browser with allure.step("Close web browser"): page.close()