示例#1
0
def before_scenario(context, scenario):
    base_test.before_scenario(context, scenario)

    # place here pages init
    context.main_page = main_page.MainPage(
        'tests/resources/definitions/MainPage.def.csv', context.browser)

    context.search_page = search_page.SearchPage(
        'tests/resources/definitions/SearchPage.def.csv', context.browser)
示例#2
0
 def test_01_order(self, order_price_fixture):
     main = main_page.MainPage(self.driver)
     main.wait_page_present()
     main.set_text_nav_search_text_box('软件测试')
     search_results = main.click_nav_search_text_btn()
     search_results.wait_page_persent()
     order_confirm = search_results.click_product_book_st_second_ver_in_results(
     ).click_add_to_cart_btn()
     assert order_confirm.get_order_confirm_msg() == '商品已加入购物车'
     assert order_confirm.get_order_confirm_price() == order_price_fixture
示例#3
0
 def test_write_review_succesful(self):
     main_page = mainpage.MainPage(self.driver)
     main_page.click_write_review()
     review_page = reviewpage.ReviewPage(self.driver)
     expected_text = "Let's get started"
     assert review_page.has_text(
         expected_text), "Expected text <%s> was not displayed"
     review_page.create_account()
     create_account_page = createaccountpage.CreateAccountPage(self.driver)
     expected_text = "Create your account"
     assert create_account_page.has_text(
         expected_text), "Expected text <%s> was not displayed"
     user_mail = "*****@*****.**" % utilities.string_generator()
     user_password = utilities.string_generator()
     create_account_page.input_account_values(user_mail, user_mail,
                                              user_password, user_password)
     create_account_page.continue_with_account_creation()
     contact_information_page = contactinfopage.ContactInformationPage(
         self.driver)
     expected_text = "Create an account"
     assert contact_information_page.has_text(
         expected_text), "Expected text <%s> was not displayed"
     contact_information_page.input_profile_details(
         firstname=utilities.string_generator(),
         lastname=utilities.string_generator(),
         phone_number='12345678901',
         address1=utilities.string_generator(),
         address2=utilities.string_generator(),
         city=utilities.string_generator(),
         zipcode='lima 12',
         country="Peru",
         subscribe_newsletter=False)
     contact_information_page.click_create_account()
     interests_page = interestspage.InterestsPage(self.driver)
     interests_page.click_done()
     confirmation_page = confirmationpage.ConfirmationPage(self.driver)
     confirmation_page.continue_with_review()
     write_review_page = writereviewpage.WriteReviewPage(self.driver)
     write_review_page.input_review(
         organization_name=utilities.string_generator(),
         department=utilities.string_generator(),
         subject=utilities.string_generator(),
         experience=utilities.string_generator(),
         number_stars=1)
     write_review_page.certify_review()
     write_review_page.submit_review()
     thank_you_page = thankyoupage.ThankYouPage(self.driver)
     assert thank_you_page.has_text('Thank You')
def before_scenario(context, scenario):
    base_test.before_scenario(context, scenario)

    # place here pages init
    context.main_page = main_page.MainPage(context.browser)
    context.search_page = search_page.SearchPage(context.browser)
 def mainpage(self, driver):
     """Returns instance of main page by-passing the login page"""
     print("Created instance of main page")
     logging.info("Created instance of main page")
     return main_page.MainPage(driver, True)
示例#6
0
 def test_login_success(self):
     main = main_page.MainPage()
     login_page = main.to_login_page()
     login_page.login("username", "password")
示例#7
0
def before_all(context):
    context.driver = driver.Driver()
    context.start_page = start_page.StartPage()
    context.login_page = login_page.LoginPage()
    context.main_page = main_page.MainPage()
 def with_(self, username, password):
     self._type(self._user_input, username)
     self._type(self._password_input, password)
     self._click(self._submit_button)
     return main_page.MainPage(self.driver)