コード例 #1
0
    def tearDown(self):
        print '\n\n\n --- TEARDOWN ---'
        if sys.exc_info()[0] is not None:
            make_screenshot(self.driver, name=self.__class__.__name__)
            print 'Organization exists: ', self.organization_exists
        if self.organization_exists:
            try:
                # Remove organization
                print 'Organization is going to be removed.'
                remove_organization(self.driver, self.organization)
                self.organization_exists = False
                print 'Organization exists: ', self.organization_exists
                print 'Wait till go back to list option will be possible'
                WebDriverWait(
                    self.driver, Settings.
                    time_wait_to_go_back_to_list_of_organizations).until(
                        EC.element_to_be_clickable(
                            (By.CLASS_NAME, 'back-to-list')))
                _back_to_list(self.driver)
                print 'Existence check of removed organization'
                _search(self.driver,
                        self.organization,
                        css_selector='[ng-model="entityList.searchInput"]')
                assert not element_exists(
                    self.driver, link_text=self.organization
                ), ('Error: Organization with name "%s" was not removed, it still exists'
                    % self.organization)
                print 'Organization was removed successfully.'
            except Exception as e:
                print 'Organization cannot be removed. Error: "%s"' % e

        if self.organization_exists:
            print 'Warning! Test cannot remove organization "%s". It has to be removed manually.' % self.organization

        self.driver.quit()
コード例 #2
0
    def tearDown(self):
        print '\n\n\n --- TEARDOWN ---'
        if sys.exc_info()[0] is not None:
            make_screenshot(self.driver, name=self.__class__.__name__)
            print 'Organization exists: ', self.organization_exists
        if self.organization_exists:
            try:
                # Remove organization
                print 'Organization is going to be removed.'
                remove_organization(self.driver, self.organization)
                self.organization_exists = False
                print 'Organization exists: ', self.organization_exists
                print 'Wait till go back to list option will be possible'
                WebDriverWait(self.driver, Settings.time_wait_to_go_back_to_list_of_organizations).until(
                    EC.element_to_be_clickable((By.CLASS_NAME, 'back-to-list')))
                _back_to_list(self.driver)
                print 'Existence check of removed organization'
                _search(self.driver, self.organization, css_selector='[ng-model="entityList.searchInput"]')
                assert not element_exists(self.driver, link_text=self.organization), (
                    'Error: Organization with name "%s" was not removed, it still exists' % self.organization)
                print 'Organization was removed successfully.'
            except Exception as e:
                print 'Organization cannot be removed. Error: "%s"' % e

        if self.organization_exists:
            print 'Warning! Test cannot remove organization "%s". It has to be removed manually.' % self.organization

        self.driver.quit()
コード例 #3
0
    def tearDown(self):
        print '\n\n\n --- TEARDOWN ---'
        if sys.exc_info()[0] is not None:
            make_screenshot(self.driver)
        print 'Organization exists: ', self.organization_exists
        if self.organization_exists:
            try:
                # Delete organization
                print 'Organization is going to be deleted.'
                delete_organization(self.driver, Settings.organization)
                self.organization_exists = False
                print 'Organization exists: ', self.organization_exists
                time.sleep(BaseSettings.click_time_wait)
                _back_to_list(self.driver)
                print 'Existence check of deleted organization'
                _search(self.driver, Settings.organization, css_selector='[ng-model="entityList.searchInput"]')
                assert not element_exists(self.driver, xpath='//span[contains(text(), "%s")]' % Settings.organization), (
                    'Error: Organization with name "%s" was not deleted, it still exists' % Settings.organization)
                print 'Organization was deleted successfully.'
            except Exception as e:
                print 'Organization cannot be deleted. Error: "%s"' % e

        if self.organization_exists:
            print 'Warning! Test cannot delete organization "%s". It has to be deleted manually.' % Settings.organization

        self.driver.quit()