コード例 #1
0
    def test_Smoke(self):
        try:
            LoginIns = Login(self.firefoxWebdriver, self.UserName,
                             self.UserPass)
            LoginIns.UserLoginMain(self.OutputDirectory)

            #for get directory from test case file name, for
            strFileName = self.paramTestCaseFilenameMember
            print('Scenario file:', strFileName)
            strRealFileName = strFileName.split("/")[-1]
            print("execute senario : " + self.paramTestCaseFilenameMember)

            readExcelIns = ExcelFileRead()
            readExcelIns.open_excel(self.paramTestCaseFilenameMember)
            UIoperationIns = UIOperation(
                readExcelIns.read_FirstWorksheet(), self.firefoxWebdriver,
                self.OutputDirectory,
                strFileName[0:len(strFileName) - len(strRealFileName)])
            #print('anakin, before iterate actions.')
            UIoperationIns.IterListAndInvokeUImain()
        except NoSuchElementException:
            print("NoSuchElementException found.....")
            self.ResultFlagIns.SetFlagToFalse()
        except AssertionError:
            print("Assertion error found.....")
            self.ResultFlagIns.SetFlagToFalse()
        except Exception as ee:
            print(ee)
            print("Other exceptions found in....." +
                  self.paramTestCaseFilenameMember)
            self.ResultFlagIns.SetFlagToFalse()
コード例 #2
0
 def test_01_login_as_manager(self):
     self.login_page = Login(self.driver)
     footer_msg = self.login_page.login(TestData.MANAGER_LOGIN,
                                        TestData.MANAGER_PASSWORD)
     print(footer_msg)
     if 'User' in footer_msg:
         assert True
     else:
         self.driver.save_screenshot(
             '../Reports/test_01_login_as_manager.png')
         assert False
コード例 #3
0
 def test_login_13(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Clicking "Sign In" link
     login.close_icon()
     login.click_signin()
     # Enter valid email
     login.set_email_address(self.email_address)
     # Enter valid password
     login.set_password(self.password)
     # Verify if the password is in encrypted form, of no => error
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, Login.encrypted_password)))
     assert element.is_displayed(
     ), "ERROR. Password is not in encrypted form."
コード例 #4
0
 def test_login_24(self):
     login = Login(self.driver)
     # Click "Sign In" link
     login.close_icon()
     login.click_signin()
     # Click the "X" in the right up corner
     login.close_icon()
     # Check if user returns to main page
     element = self.driver.find_elements_by_xpath(Login.check_please_signin)
     assert len(element) == 0, "ERROR. User didn't return to the main page."
コード例 #5
0
 def test_login_26(self):
     login = Login(self.driver)
     # Click "Sign In" link
     login.close_icon()
     login.click_signin()
     # Select "No, I am new to the website" radio button
     login.click_new_to_site()
     # Check if password field disappeared, if it's present => error
     element = self.driver.find_elements_by_xpath(Login.password_field)
     assert len(element) == 0, "ERROR. The password field didn't disappear."
コード例 #6
0
 def test_login_25(self):
     login = Login(self.driver)
     # Click "Sign In" link
     login.close_icon()
     login.click_signin()
     # Click "Cancel" button
     login.click_cancel_button()
     # Check if user returns to main page
     element = self.driver.find_elements_by_xpath(Login.check_please_signin)
     assert len(element) == 0, "ERROR. User didn't return to the main page."
コード例 #7
0
    def sales_screen(self):
        """Start recording video"""
        # self.driver.start_recording_screen()

        self.login_page = Login(self.driver)
        self.login_page.login(TestData.MANAGER_LOGIN,
                              TestData.MANAGER_PASSWORD)
        # self.do_click(self.HAMBURGER_MENU)
        self.do_click(self.SALES_SCREEN_BUTTON)
        self.do_send_keys(self.BARCODE_INPUT, '9627890153206' + '\n')
        # self.do_click(self.OPTIONS_BUTTON)
        """stop recording video"""
        # video_raw = self.driver.stop_recording_screen()
        # video_name = self.driver.current_activity + time.strftime("%Y_%m_%d_%H%M%S")
        # file_path = os.path.join('../Reports/' + video_name + '.mp4')
        # with open(file_path, 'wb') as vd:
        #     vd.write(base64.b64decode(video_raw))
        """
コード例 #8
0
 def test_login_27(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Click "Sign In" link
     login.close_icon()
     login.click_signin()
     # Select "No, I am new to the website" radio button
     login.click_new_to_site()
     # Check if password field disappeared, if it's present => error
     element = self.driver.find_elements_by_xpath(Login.password_field)
     assert len(element) == 0, "ERROR. The password field didn't disappear."
     # Select "Yes, I have a password"
     login.click_new_to_site()
     # Check if password field reappeared, if not =? error
     element = wait.until(
         EC.presence_of_element_located((By.XPATH, Login.password_field)))
     assert element.is_displayed(
     ), "ERROR. The password field didn't reappear."
コード例 #9
0
ファイル: test_case_28.py プロジェクト: rodut/Sephora
 def test_login_28(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Click "Sign In" link
     login.close_icon()
     login.click_signin()
     # Click "Privacy Policy" link
     login.click_privacy_policy()
     # Check if "Privacy Policy" page has opened, if no => error
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, Login.check_privacy_policy)))
     assert element.is_displayed(
     ), "ERROR.  The user cannot see Privacy Policy."
     # Click "X" in the right top corner
     login.click_close_privacy_policy()
     # Check if user returned to "Sign In" page
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, Login.check_please_signin)))
     assert element.is_displayed(
     ), "ERROR. User didn't return to Sign In page."
コード例 #10
0
 def test_login_01(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Clicking "Sign In" link
     login.close_icon()
     login.click_signin()
     # Verifying if the link "Sign In" was opened
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.yes_pass_selected)))
     assert element.is_displayed(), "ERROR. Radio button 'Yes, I have a password' is not selected by default."
コード例 #11
0
ファイル: test_case_04.py プロジェクト: rodut/Sephora
 def test_login_04(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Clicking "Sign In" link
     login.close_icon()
     login.click_signin()
     # Verifying if 'Continue' button is present.
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.continue_button)))
     assert element.is_displayed(), "ERROR. 'Continue' button is not present."
     # Verifying if 'Terms of Use' link is present.
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.terms_of_use_link)))
     assert element.is_displayed(), "ERROR. 'Terms of Use' link is not present."
     # Verifying if 'Privacy Policy' link is present.
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.privacy_policy_link)))
     assert element.is_displayed(), "ERROR. 'Privacy Policy' link is present."
コード例 #12
0
ファイル: test_case_03.py プロジェクト: rodut/Sephora
 def test_login_03(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Clicking "Sign In" link
     login.close_icon()
     login.click_signin()
     # Verifying if 'Password' field is present.
     element = wait.until(
         EC.presence_of_element_located((By.XPATH, Login.password_field)))
     assert element.is_displayed(
     ), "ERROR. 'Password' field is not present."
     # Verifying if 'Forgot?' link is present.
     element = wait.until(
         EC.presence_of_element_located((By.XPATH, Login.forgot_link)))
     assert element.is_displayed(), "ERROR. 'Forgot?' link is not present."
     # Verifying if 'Cancel' button is present.
     element = wait.until(
         EC.presence_of_element_located((By.XPATH, Login.cancel_button)))
     assert element.is_displayed(), "ERROR. 'Cancel' button is not present."
コード例 #13
0
 def test_login_01(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Clicking "Sign In" link
     login.close_icon()
     login.click_signin()
     # Verifying if 'Email address' field is present.
     element = wait.until(
         EC.presence_of_element_located((By.XPATH, Login.email_address_id)))
     assert element.is_displayed(
     ), "ERROR. 'Email address' field is not present."
     # Verifying if 'No, I am new to the website' radio button is present.
     element = wait.until(
         EC.presence_of_element_located((By.XPATH, Login.no_password)))
     assert element.is_displayed(
     ), "ERROR. 'No, I am new to the website' radio button is not present."
     # Verifying if 'Yes, I have a password' radio button is present.
     element = wait.until(
         EC.presence_of_element_located((By.XPATH, Login.yes_password)))
     assert element.is_displayed(
     ), "ERROR. 'Yes, I have a password' radio button is not present."
コード例 #14
0
ファイル: test_case_05.py プロジェクト: rodut/Sephora
 def test_login_05(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Clicking "Sign In" link
     login.close_icon()
     login.click_signin()
     # Verifying if 'What is your email address' text is present.
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, Login.what_email_address)))
     assert element.is_displayed(
     ), "ERROR. 'What is your email address' text is not present."
     # Verifying if 'Do you have a sephora.com password?' text is present.
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, Login.have_sephora_password)))
     assert element.is_displayed(
     ), "ERROR. 'Do you have a sephora.com password?' text is not present."
     # Verifying if 'Have a Beauty Insider account?' text is present.
     element = wait.until(
         EC.presence_of_element_located((By.XPATH, Login.have_beauty_text)))
     assert element.is_displayed(
     ), "ERROR. 'Have a Beauty Insider account?' text is not present."
コード例 #15
0
 def test_login_09(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Clicking "Sign In" link
     login.close_icon()
     login.click_signin()
     # Enter a valid email in email field
     login.set_email_address(self.email_address)
     # Enter an empty password in password field
     login.set_password(self.password)
     # Click on "Continue" button
     login.click_continue()
     # Verify if user cannot login with empty password
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, Login.alert_pass_missing)))
     assert element.is_displayed(
     ), "ERROR. password email error text is no present."
コード例 #16
0
ファイル: test_case_06.py プロジェクト: rodut/Sephora
 def test_login_06(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Clicking "Sign In" link
     login.close_icon()
     login.click_signin()
     # Enter a invalid email in email field
     login.set_email_address(self.email_address)
     # Enter a invalid password in password field
     login.set_password(self.password)
     # Click 'Continue' button
     login.click_continue()
     # Verify if alert email error text is present.
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.alert_incorrect_email)))
     assert element.is_displayed(), "ERROR. Alert email error text is no present."
コード例 #17
0
ファイル: test_case_17.py プロジェクト: rodut/Sephora
 def test_login_17(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Click "Sign In" link
     login.close_icon()
     login.click_signin()
     # Enter valid email
     login.set_email_address(self.email_address)
     # Select "No, I am new to the website" radio button
     login.click_new_to_site()
     # Click "Continue" button
     login.click_continue()
     # Check if an error message appears, if no => error
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.alert_incorrect_pass)))
     assert element.is_displayed(), "ERROR. 'An account already exists' alert message doesn't appear."
コード例 #18
0
class SalesScreen(BasePage):
    """By locators"""
    USER_NAME = (By.ID, "com.bcx.mobile.transact:id/username_validation_input")
    PASSWORD = (By.ID, "com.bcx.mobile.transact:id/password_validation_input")
    LOGIN_BUTTON = (By.ID, "com.bcx.mobile.transact:id/login_button")
    FOOTER_CONFIRM_MSG = (By.ID,
                          'com.bcx.mobile.transact:id/footer_center_text')
    """Hamburger menu locators"""
    HAMBURGER_MENU = (
        By.XPATH,
        "//android.widget.ImageButton[@content-desc='Open navigation drawer']")
    HAMBURGER_CLOSE = (By.ID, 'com.bcx.mobile.transact:id/close_button')
    """hamburger or home screen menus"""
    PRODUCT_LOOKUP_BUTTON = (
        By.XPATH, "//android.widget.TextView[@text='Product Lookup']")
    SALES_SCREEN_BUTTON = (By.XPATH,
                           "//android.widget.TextView[@text='Sales Screen']")
    RETRIEVE_SALE_BUTTON = (By.XPATH,
                            "//android.widget.TextView[@text='Retrieve Sale']")
    ABOUT_BUTTON = (By.XPATH, "//android.widget.TextView[@text='About']")
    LOGOUT_BUTTON = (By.XPATH, "//android.widget.TextView[@text='Logout']")
    """sales screen locators"""
    BARCODE_INPUT = (By.ID, 'com.bcx.mobile.transact:id/code_input')
    OPTIONS_BUTTON = (By.ID, 'com.bcx.mobile.transact:id/button_options')
    TENDER_BUTTON = (By.ID, 'com.bcx.mobile.transact:id/btn_tender')
    SUSPEND_BUTTON = (By.ID, 'com.bcx.mobile.transact:id/btn_suspend')
    SUSPEND_CONFIRM_OK = (By.ID, 'com.bcx.mobile.transact:id/confirm_button')
    SUSPEND_CONFIRM_CANCEL = (By.ID,
                              'com.bcx.mobile.transact:id/cancel_button')
    SUSPENDED_CONTINUE_BUTTON = (By.ID,
                                 'com.bcx.mobile.transact:id/confirm_button')
    """Kebab"""
    KEBAB_MENU = (By.XPATH,
                  "//android.widget.TextView[@content-desc = 'Options']")
    KEBAB_CLOSE_BUTTON = (By.ID, 'com.bcx.mobile.transact:id/close_button')
    KEBAB_TRANSACTION_VOID = (
        By.XPATH, "//android.widget.TextView[@text='Transaction Void']")
    KEBAB_PRODUCT_SEARCH = (
        By.XPATH, "//android.widget.TextView[@text='Product Search']")
    KEBAB_SUBTOTAL = (By.XPATH, "//android.widget.TextView[@text='Subtotal']")
    KEBAB_SUSPEND_SALE = (By.XPATH,
                          "//android.widget.TextView[@text='Suspend Sale']")
    KEBAB_TENDER = (By.XPATH, "//android.widget.TextView[@text='Tender']")

    VOID_OPTION_01 = (By.XPATH, "//android.widget.TextView[@text='01']")
    VOID_OPTION_02 = (By.XPATH, "//android.widget.TextView[@text='02']")

    CONFIRMATION_OK_TICK = (By.ID, "com.bcx.mobile.transact:id/confirm_button")
    CONFIRMATION_CANCEL_CROSS = (By.ID,
                                 "com.bcx.mobile.transact:id/cancel_button")
    CONTINUE_CONFIRMATION = (By.XPATH,
                             "//android.widget.Button[@text='CONTINUE']")

    AUTHORISATION_USERNAME = (By.XPATH,
                              "//android.widget.EditText[@text='Username']")
    AUTHORISATION_PASSWORD = (By.XPATH,
                              "//android.widget.EditText[@text='Password']")
    AUTHORISE_BUTTON = (By.ID, 'com.bcx.mobile.transact:id/authorize_button')
    """Constructor"""
    def __init__(self, driver):
        super().__init__(driver)

    """action methods"""

    def login(self, user, password):
        self.do_send_keys(self.USER_NAME, user)
        self.do_send_keys(self.PASSWORD, password)
        self.do_click(self.LOGIN_BUTTON)

    def authorise(self, user, password):
        self.do_send_keys(self.AUTHORISATION_USERNAME, user)
        self.do_send_keys(self.AUTHORISATION_PASSWORD, password)
        self.do_click(self.AUTHORISE_BUTTON)

    # Homepage button actions or hamburger button actions
    def click_sales_screen(self):
        self.do_click(self.SALES_SCREEN_BUTTON)

    def click_product_lookup(self):
        self.do_click(self.PRODUCT_LOOKUP_BUTTON)

    def click_retrieve_sale(self):
        self.do_click(self.RETRIEVE_SALE_BUTTON)

    def click_logout(self):
        self.do_click(self.LOGOUT_BUTTON)

    # Sales screen actions
    def scan_products(self, *skus):
        for sku in skus:
            self.do_send_keys(self.BARCODE_INPUT, sku + '\n')

    def select_void01(self):
        self.do_click(self.VOID_OPTION_01)

    def select_void02(self):
        self.do_click(self.VOID_OPTION_02)

    def select_confirmation_ok(self):
        self.do_click(self.CONFIRMATION_OK_TICK)

    def select_confirmation_cancel(self):
        self.do_click(self.CONFIRMATION_CANCEL_CROSS)

    def select_continue(self):
        self.do_click(self.CONTINUE_CONFIRMATION)

    # Kebab menu actions
    def click_kebab_menu(self):
        self.do_click(self.KEBAB_MENU)

    def click_kebab_tran_void(self):
        self.do_click(self.KEBAB_TRANSACTION_VOID)

    def click_kebab_product_search(self):
        self.do_click(self.KEBAB_PRODUCT_SEARCH)

    def click_kebab_subtotal(self):
        self.do_click(self.KEBAB_SUBTOTAL)

    def click_kebab_suspend_sale(self):
        self.do_click(self.KEBAB_SUSPEND_SALE)

    def click_kebab_tender(self):
        self.do_click(self.KEBAB_TENDER)

    def sales_screen(self):
        """Start recording video"""
        # self.driver.start_recording_screen()

        self.login_page = Login(self.driver)
        self.login_page.login(TestData.MANAGER_LOGIN,
                              TestData.MANAGER_PASSWORD)
        # self.do_click(self.HAMBURGER_MENU)
        self.do_click(self.SALES_SCREEN_BUTTON)
        self.do_send_keys(self.BARCODE_INPUT, '9627890153206' + '\n')
        # self.do_click(self.OPTIONS_BUTTON)
        """stop recording video"""
        # video_raw = self.driver.stop_recording_screen()
        # video_name = self.driver.current_activity + time.strftime("%Y_%m_%d_%H%M%S")
        # file_path = os.path.join('../Reports/' + video_name + '.mp4')
        # with open(file_path, 'wb') as vd:
        #     vd.write(base64.b64decode(video_raw))
        """
コード例 #19
0
 def setUpClass(cls):
     login = Login(cls.driver)
     cls.driver.get(login.url)
     cls.driver.maximize_window()
コード例 #20
0
ファイル: test_case_18.py プロジェクト: rodut/Sephora
 def test_login_18(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Click "Sign In" link
     login.close_icon()
     login.click_signin()
     # Enter an unregistered email
     login.set_email_address(self.email_address)
     # Select "No, I am new to the website"
     login.click_new_to_site()
     # Click "Continue" button
     login.click_continue()
     # Check if a registration form appeared, if no => error
     element = wait.until(
         EC.presence_of_element_located((By.XPATH, Login.register_sephora)))
     assert element.is_displayed(
     ), "ERROR. 'Register with Sephora' registration form doesn't appear."
コード例 #21
0
 def test_login_21(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Click "Sign In" link
     login.close_icon()
     login.click_signin()
     # Enter an invalid email
     login.set_email_address(self.email_address)
     # Click "Forgot?" link
     login.click_forgot_link()
     # Check if previously entered email is present in email field
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.check_invalid_forgot_email)))
     assert element.is_displayed(), "ERROR. Previously entered email is not present in email field."
     # Click "Send Email" button
     login.click_send_email_button()
     # Check if there is an error message regarding the email
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.alert_send_email)))
     assert element.is_displayed(), "ERROR. No alert text message is present."
コード例 #22
0
 def test_login_20(self):
     wait = WebDriverWait(self.driver, 10)
     login = Login(self.driver)
     # Click "Sign In" link
     login.close_icon()
     login.click_signin()
     # Enter valid email
     login.set_email_address(self.email_address)
     # Click "Forgot?" link
     login.click_forgot_link()
     # Check if the entered email is present in email field
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.check_forgot_email)))
     assert element.is_displayed(), "ERROR. Previously entered email is not present in email field."
     # Click "Send Email" button
     login.click_send_email_button()
     # Check if a message with "reset password" is present
     element = wait.until(EC.presence_of_element_located((By.XPATH, Login.reset_password)))
     assert element.is_displayed(), "ERROR. There is no message with 'Reset Password' present"