class Test_11(BaseTest):
    def setUp(self):
        super(Test_11, self).setUp()

    def runTest(self):
        self.loginBack = LoginBack(self.driver)
        self.loginBack.enter_text(Locators.LOGINBACK_USERNAME_INPUT,
                                  TestData.LOGINBACK_USERNAME)
        self.loginBack.enter_text(Locators.LOGINBACK_PASSWORD_INPUT,
                                  TestData.LOGINBACK_PASSWORD)
        self.loginBack.click(Locators.LOGINBACK_LOGIN_BUTTON)

        self.customersBack = CustomersBack(self.driver)
        self.customersBack.click(Locators.CUSTOMERSBACK_CLOSEALERT)
        self.customersBack.click(Locators.CUSTOMERSBACK_SALES_LINK)
        self.customersBack.click(Locators.CUSTOMERSBACK_ORDERS_LINK)

        self.ordersBack = OrdersBack(self.driver)
        self.ordersBack.setSelectorVisibleText(
            Locators.ORDERSBACK_STATUS_SELECTOR, "Canceled")
        self.ordersBack.click(Locators.ORDERSBACK_SEARCH_BUTTON)
        self.ordersBack.selectItem(Locators.ORDERSBACK_ORDERS_CHECKBOX, 0)
        self.ordersBack.setSelectorVisibleText(
            Locators.ORDERSBACK_ACTIONS_SELECTOR, TestData.ORDERSBACK_ACTIONS)
        self.ordersBack.click(Locators.ORDERSBACK_SUBMIT_BUTTON)
        self.assertIn(self.ordersBack.getText(Locators.ORDERSBACK_MSGS),
                      TestData.ORDERSBACK_ERROR_MSG)
        self.ordersBack.setSelectorVisibleText(
            Locators.ORDERSBACK_STATUS_SELECTOR, "Complete")
        self.ordersBack.click(Locators.ORDERSBACK_SEARCH_BUTTON)
        self.ordersBack.selectItem(Locators.ORDERSBACK_ORDERS_CHECKBOX, 0)

    def tearDown(self):
        super(Test_11, self).tearDown()
    def runTest(self):
        self.loginBack = LoginBack(self.driver)
        self.loginBack.enter_text(Locators.LOGINBACK_USERNAME_INPUT,
                                  TestData.LOGINBACK_USERNAME)
        self.loginBack.enter_text(Locators.LOGINBACK_PASSWORD_INPUT,
                                  TestData.LOGINBACK_PASSWORD)
        self.loginBack.click(Locators.LOGINBACK_LOGIN_BUTTON)

        self.customersBack = CustomersBack(self.driver)
        self.customersBack.click(Locators.CUSTOMERSBACK_CLOSEALERT)
        self.customersBack.click(Locators.CUSTOMERSBACK_CUSTOMERS_LINK)
        self.customersBack.click(Locators.CUSTOMERSBACK_MANAGECUSTOMERS_LINK)

        self.manageCustomersBack = ManageCustomersBack(self.driver)
        self.manageCustomersBack.click(Locators.MANAGECUSTOMERSBACK_FIRSTEDIT)

        self.customerInformationBack = CustomerInformationBack(self.driver)
        self.customerInformationBack.click(
            Locators.CUSTOMERINFOBACK_ACCOUNT_INFORMATION)
        self.assertFalse(
            self.customerInformationBack.is_enabled(
                Locators.CUSTOMERINFOBACK_WEBSITEASSOCIATED).is_enabled())
        self.assertFalse(
            self.customerInformationBack.is_enabled(
                Locators.CUSTOMERINFOBACK_CREATED_FROM).is_enabled())
        self.assertIs(
            self.customerInformationBack.getText(
                Locators.CUSTOMERINFOBACK_NEWPASS), "")
    def runTest(self):
        self.loginback = LoginBack(self.driver)
        self.loginback.enter_text(Locators.LOGINBACK_USERNAME_INPUT,
                                  TestData.LOGINBACK_USERNAME)
        self.loginback.enter_text(Locators.LOGINBACK_PASSWORD_INPUT,
                                  TestData.LOGINBACK_PASSWORD)
        self.loginback.click(Locators.LOGINBACK_LOGIN_BUTTON)

        self.customersBack = CustomersBack(self.driver)
        self.customersBack.click(Locators.CUSTOMERSBACK_CLOSEALERT)
        self.customersBack.click(Locators.CUSTOMERSBACK_SALES_LINK)
        self.customersBack.click(Locators.CUSTOMERSBACK_INVOICES_LINK)

        self.salesinvoicesback = SalesInvoiceBack(self.driver)
        self.salesinvoicesback.click(Locators.INVOICESBACK_INVOICE_DATE)
        time.sleep(2.5)
        self.assertIn(
            self.salesinvoicesback.getText(
                Locators.INVOICESBACK_DATE_FIRST_ROW),
            TestData.INVOICESBACK_DATE1)
        self.salesinvoicesback.click(Locators.INVOICESBACK_INVOICE_DATE)
        time.sleep(2.5)
        self.assertIn(
            self.salesinvoicesback.getText(
                Locators.INVOICESBACK_DATE_FIRST_ROW),
            TestData.INVOICESBACK_DATE2)
class Test_12(BaseTest):
    def setUp(self):
        super(Test_12, self).setUp()

    def runTest(self):
        self.review = Review(self.driver)
        self.review.enter_text(Locators.REVIEWPAGE_REVIEW_FIELD,
                               TestData.REVIEW_TEXT)
        self.review.enter_text(Locators.REVIEWPAGE_SUMMARY_FIELD,
                               TestData.REVIEW_SUMMARY)
        self.review.enter_text(Locators.REVIEWPAGE_NICKNAME_FIELD,
                               TestData.REVIEW_NICKNAME)
        self.review.click(Locators.REVIEWPAGE_SUBMIT_BUTTON)

        self.loginBack = LoginBack(self.driver)
        self.loginBack.enter_text(Locators.LOGINBACK_USERNAME_INPUT,
                                  TestData.LOGINBACK_USERNAME)
        self.loginBack.enter_text(Locators.LOGINBACK_PASSWORD_INPUT,
                                  TestData.LOGINBACK_PASSWORD)
        self.loginBack.click(Locators.LOGINBACK_LOGIN_BUTTON)

        self.customersBack = CustomersBack(self.driver)
        self.customersBack.click(Locators.CUSTOMERSBACK_CLOSEALERT)
        self.customersBack.click(Locators.CUSTOMERSBACK_CATALOG_LINK)
        self.customersBack.click(Locators.CUSTOMERSBACK_REVIEWS_AND_RATINGS)
        self.customersBack.click(Locators.CUSTOMERSBACK_CUSTOMER_REVIEWS)
        self.customersBack.click(Locators.CUSTOMERSBACK_PENDING_REVIEWS)

        self.pendingReviewsBack = PendingReviewsBack(self.driver)
        self.pendingReviewsBack.click(Locators.PENDINGREVIEWSBACK_REVIEW_ID)
        self.pendingReviewsBack.click(Locators.PENDINGREVIEWSBACK_EDIT_LINK)

        self.editReviewBack = EditReviewBack(self.driver)
        self.editReviewBack.setSelectorVisibleText(
            Locators.EDITREVIEWBACK_STATUS, "Approved")
        self.editReviewBack.click(Locators.EDITREVIEWBACK_SAVE_REVIEW)

        self.homePage = HomePage(self.driver)
        self.homePage.click(Locators.HOME_MOBILE_LINK)

        self.mobile = Mobile(self.driver)
        self.mobile.click(Locators.MOBILE_IMAGE_XPERIA)
        self.mobile.click(Locators.MOBILE_REVIEW_TAB)

        self.assertIn(
            self.mobile.getText(Locators.MOBILE_REVIEW_COMMENT).upper(),
            TestData.REVIEW_SUMMARY.upper())

    def tearDown(self):
        super(Test_12, self).tearDown()