Exemple #1
0
    def test_organization_balance(self):
        # Login NC
        print '%s is going to be logged in.' % Settings.username
        login_nodeconductor(self.driver, Settings.username, Settings.password)
        username_idt_field = self.driver.find_element_by_class_name(
            'user-name')
        assert username_idt_field.text == Settings.user_full_name, 'Error. Another username.'
        print '%s was logged in successfully.' % Settings.username

        # Add organization
        print 'Organization is going to be added.'
        time.sleep(BaseSettings.click_time_wait)
        add_organization(self.driver, self.organization)
        print 'Existence check of added organization'
        xpath = '//span[@class="name" and contains(text(), "%s")]' % self.organization
        assert bool(self.driver.find_elements_by_xpath(
            xpath)), 'Cannot add organization "%s"' % self.organization
        self.organization_exists = True
        print 'Organization exists: ', self.organization_exists
        print 'Organization was added successfully.'

        # Choose organization
        print 'Organization is going to be chosen.'
        go_to_main_page(self.driver)
        choose_organization(self.driver, self.organization)
        print 'Organization was chosen successfully.'

        # Top-up balance
        print 'Balance is going to be topped-up.'
        print 'Check "$0.00" balance'
        xpath = '//div[contains(text(), "%s")]' % Settings.balance
        assert bool(self.driver.find_elements_by_xpath(
            xpath)), 'Cannot find balance "%s"' % Settings.balance
        print 'Top-up balance'
        top_up_organization_balance(self.driver, Settings.top_up_balance,
                                    Settings.payment_account_email,
                                    Settings.payment_account_password,
                                    Settings.time_wait_alert_is_present,
                                    Settings.time_wait_alert_invisibility,
                                    Settings.time_wait_to_swich_to_paypal)
        print 'Wait till balance will be topped-up'
        WebDriverWait(self.driver, Settings.time_wait_to_topup_balance).until(
            EC.invisibility_of_element_located((
                By.XPATH,
                '//div[contains(text(), "Payment is being proceeded, please wait")]'
            )))
        print 'Check topped-up balance'
        xpath = '//div[contains(text(), "%s")]' % Settings.check_balance
        assert bool(self.driver.find_elements_by_xpath(
            xpath)), 'Cannot find balance "%s"' % Settings.check_balance
        print 'Balance was topped-up successfully.'
    def test_organization_balance(self):
        # Login NC
        print '%s is going to be logged in.' % Settings.username
        login_nodeconductor(self.driver, Settings.username, Settings.password)
        username_idt_field = self.driver.find_element_by_class_name('user-name')
        assert username_idt_field.text == Settings.user_full_name, 'Error. Another username.'
        print '%s was logged in successfully.' % Settings.username

        # Add organization
        print 'Organization is going to be added.'
        time.sleep(BaseSettings.click_time_wait)
        add_organization(self.driver, self.organization)
        print 'Existence check of added organization'
        xpath = '//span[@class="name" and contains(text(), "%s")]' % self.organization
        assert bool(self.driver.find_elements_by_xpath(xpath)), 'Cannot add organization "%s"' % self.organization
        self.organization_exists = True
        print 'Organization exists: ', self.organization_exists
        print 'Organization was added successfully.'

        # Choose organization
        print 'Organization is going to be chosen.'
        go_to_main_page(self.driver)
        choose_organization(self.driver, self.organization)
        print 'Organization was chosen successfully.'

        # Top-up balance
        print 'Balance is going to be topped-up.'
        print 'Check "$0.00" balance'
        xpath = '//div[contains(text(), "%s")]' % Settings.balance
        assert bool(self.driver.find_elements_by_xpath(xpath)), 'Cannot find balance "%s"' % Settings.balance
        print 'Top-up balance'
        top_up_organization_balance(self.driver, Settings.top_up_balance, Settings.payment_account_email,
                                    Settings.payment_account_password, Settings.time_wait_alert_is_present,
                                    Settings.time_wait_alert_invisibility, Settings.time_wait_to_swich_to_paypal)
        print 'Wait till balance will be topped-up'
        WebDriverWait(self.driver, Settings.time_wait_to_topup_balance).until(
            EC.invisibility_of_element_located((By.XPATH, '//div[contains(text(), "Payment is being proceeded, please wait")]')))
        print 'Check topped-up balance'
        xpath = '//div[contains(text(), "%s")]' % Settings.check_balance
        assert bool(self.driver.find_elements_by_xpath(xpath)), 'Cannot find balance "%s"' % Settings.check_balance
        print 'Balance was topped-up successfully.'
    def test_organization_balance(self):
        # Login NC
        print '%s is going to be logged in.' % Settings.username
        login_nodeconductor(self.driver, Settings.username, Settings.password)
        username_idt_field = self.driver.find_element_by_class_name('user-name')
        assert username_idt_field.text == Settings.user_full_name, 'Error. Another username.'
        print '%s was logged in successfully.' % Settings.username

        # Create organization
        print 'Organization is going to be created.'
        time.sleep(BaseSettings.click_time_wait)
        create_organization(self.driver, Settings.organization)
        print 'Existence check of created organization'
        xpath = '//span[@class="name" and contains(text(), "%s")]' % Settings.organization
        assert bool(self.driver.find_elements_by_xpath(xpath)), 'Cannot create organization "%s"' % Settings.organization
        self.organization_exists = True
        print 'Organization exists: ', self.organization_exists
        print 'Organization was created successfully.'

        # Choose organization
        print 'Organization is going to be chosen.'
        go_to_main_page(self.driver)
        choose_organization(self.driver, Settings.organization)
        print 'Organization was chosen successfully.'

        # Top-up balance
        print 'Balance is going to be topped-up.'
        print 'Check "$0.00" balance'
        xpath = '//div[contains(text(), "%s")]' % Settings.balance
        assert bool(self.driver.find_elements_by_xpath(xpath)), 'Cannot find balance "%s"' % Settings.balance
        print 'Top-up balance'
        top_up_organization_balance(self.driver, Settings.top_up_balance, Settings.payment_account_email, Settings.payment_account_password)
        time.sleep(BaseSettings.click_time_wait)
        print 'Check topped-up balance'
        xpath = '//div[contains(text(), "%s")]' % Settings.check_balance
        assert bool(self.driver.find_elements_by_xpath(xpath)), 'Cannot find balance "%s"' % Settings.check_balance
        print 'Balance was topped-up successfully.'