Esempio n. 1
0
    def setUp(self):  # noqa
        """We do want a new browser instance for every test."""
        if not self.remote:
            if self.driver_name.lower() == 'firefox':
                self.browser = webdriver.Firefox()
            elif self.driver_name.lower() == 'chrome':
                self.browser = webdriver.Chrome()
            elif self.driver_name.lower() == 'ie':
                self.browser = webdriver.Ie()
            elif self.driver_name.lower() == 'phantomjs':
                service_args = ['--ignore-ssl-errors=true']
                self.browser = webdriver.PhantomJS(
                    service_args=service_args
                )
            else:
                self.browser = webdriver.Remote()
        else:
            self.browser = SeleniumFactory().createWebDriver(
                job_name=self.id(), show_session_id=True)

        self.browser.maximize_window()
        self.browser.get(get_server_url())

        # Library methods
        self.activationkey = ActivationKey(self.browser)
        self.architecture = Architecture(self.browser)
        self.compute_resource = ComputeResource(self.browser)
        self.configgroups = ConfigGroups(self.browser)
        self.contentenv = ContentEnvironment(self.browser)
        self.content_views = ContentViews(self.browser)
        self.domain = Domain(self.browser)
        self.environment = Environment(self.browser)
        self.gpgkey = GPGKey(self.browser)
        self.hardwaremodel = HardwareModel(self.browser)
        self.hostgroup = Hostgroup(self.browser)
        self.hosts = Hosts(self.browser)
        self.location = Location(self.browser)
        self.login = Login(self.browser)
        self.medium = Medium(self.browser)
        self.navigator = Navigator(self.browser)
        self.user = User(self.browser)
        self.operatingsys = OperatingSys(self.browser)
        self.org = Org(self.browser)
        self.partitiontable = PartitionTable(self.browser)
        self.puppetclasses = PuppetClasses(self.browser)
        self.products = Products(self.browser)
        self.repository = Repos(self.browser)
        self.role = Role(self.browser)
        self.settings = Settings(self.browser)
        self.subnet = Subnet(self.browser)
        self.subscriptions = Subscriptions(self.browser)
        self.sync = Sync(self.browser)
        self.syncplan = Syncplan(self.browser)
        self.systemgroup = SystemGroup(self.browser)
        self.template = Template(self.browser)
        self.user = User(self.browser)
        self.usergroup = UserGroup(self.browser)
Esempio n. 2
0
def make_product(session, org=None, loc=None, force_context=True, **kwargs):
    """Creates a product"""

    create_args = {
        u'name': None,
        u'description': None,
        u'sync_plan': None,
        u'startdate': None,
        u'create_sync_plan': False,
        u'gpg_key': None,
        u'sync_interval': None,
    }
    page = session.nav.go_to_products
    core_factory(create_args, kwargs, session, page,
                 org=org, loc=loc, force_context=force_context)
    Products(session.browser).create(**create_args)
Esempio n. 3
0
def _create_repository(session, org, name, product, upstream_name=None):
    """Creates a Docker-based repository.

    :param session: The browser session.
    :param str org: Name of Organization where product should be created
    :param str name: Name for the repository
    :param str product: Name of product where repository should be created.
    :param str upstream_name: A valid name for an existing upstream repository.
        If ``None`` then defaults to ``busybox``.
    """
    if upstream_name is None:
        upstream_name = u'busybox'
    set_context(session, org=org)
    Products(session.browser).search_and_click(product)
    make_repository(
        session,
        name=name,
        repo_type=REPO_TYPE['docker'],
        url=DOCKER_REGISTRY_HUB,
        upstream_repo_name=upstream_name,
    )
Esempio n. 4
0
    def setUp(self):  # noqa
        """We do want a new browser instance for every test."""
        if settings.browser == 'docker':
            self._docker_browser = DockerBrowser()
            self._docker_browser.start()
            self.browser = self._docker_browser.webdriver
            self.addCleanup(self._docker_browser.stop)
        else:
            self.browser = browser()
            self.addCleanup(self.browser.quit)
        self.browser.maximize_window()
        self.browser.get(settings.server.get_url())

        self.addCleanup(self._saucelabs_test_result)
        self.addCleanup(self.take_screenshot)

        # Library methods
        self.activationkey = ActivationKey(self.browser)
        self.architecture = Architecture(self.browser)
        self.bookmark = Bookmark(self.browser)
        self.container = Container(self.browser)
        self.compute_profile = ComputeProfile(self.browser)
        self.compute_resource = ComputeResource(self.browser)
        self.configgroups = ConfigGroups(self.browser)
        self.content_views = ContentViews(self.browser)
        self.content_search = ContentSearch(self.browser)
        self.domain = Domain(self.browser)
        self.discoveredhosts = DiscoveredHosts(self.browser)
        self.discoveryrules = DiscoveryRules(self.browser)
        self.environment = Environment(self.browser)
        self.gpgkey = GPGKey(self.browser)
        self.hardwaremodel = HardwareModel(self.browser)
        self.hostcollection = HostCollection(self.browser)
        self.hostgroup = Hostgroup(self.browser)
        self.hosts = Hosts(self.browser)
        self.ldapauthsource = LdapAuthSource(self.browser)
        self.lifecycleenvironment = LifecycleEnvironment(self.browser)
        self.location = Location(self.browser)
        self.login = Login(self.browser)
        self.medium = Medium(self.browser)
        self.navigator = Navigator(self.browser)
        self.user = User(self.browser)
        self.operatingsys = OperatingSys(self.browser)
        self.org = Org(self.browser)
        self.oscapcontent = OpenScapContent(self.browser)
        self.oscappolicy = OpenScapPolicy(self.browser)
        self.oscapreports = OpenScapReports(self.browser)
        self.partitiontable = PartitionTable(self.browser)
        self.puppetclasses = PuppetClasses(self.browser)
        self.products = Products(self.browser)
        self.registry = Registry(self.browser)
        self.repository = Repos(self.browser)
        self.rhai = RHAI(self.browser)
        self.role = Role(self.browser)
        self.settings = Settings(self.browser)
        self.subnet = Subnet(self.browser)
        self.subscriptions = Subscriptions(self.browser)
        self.sync = Sync(self.browser)
        self.syncplan = Syncplan(self.browser)
        self.systemgroup = SystemGroup(self.browser)
        self.template = Template(self.browser)
        self.trend = Trend(self.browser)
        self.user = User(self.browser)
        self.usergroup = UserGroup(self.browser)
Esempio n. 5
0
    def __enter__(self):
        if settings.browser == 'docker':
            self._docker_browser = DockerBrowser(name=self.test.id())
            self._docker_browser.start()
            self.browser = self._docker_browser.webdriver
        else:
            self.browser = browser()

        # for compatibility purposes
        self.test.browser = self.browser

        self.browser.foreman_user = self.test.foreman_user
        self.browser.foreman_password = self.test.foreman_password

        if self._user is None:
            self._user = getattr(self.browser, 'foreman_user',
                                 settings.server.admin_username)

        if self._password is None:
            self._password = getattr(self.browser, 'foreman_password',
                                     settings.server.admin_password)

        self.browser.maximize_window()
        self.browser.get(settings.server.get_url())
        # Workaround 'Certificate Error' screen on Microsoft Edge
        if (self.test.driver_name == 'edge'
                and 'Certificate Error' in self.browser.title
                or 'Login' not in self.browser.title):
            self.browser.get(
                "javascript:document.getElementById('invalidcert_continue')"
                ".click()")

        self.test.addCleanup(self.test._saucelabs_test_result,
                             self.browser.session_id)

        # Library methods
        self.activationkey = ActivationKey(self.browser)
        self.architecture = Architecture(self.browser)
        self.bookmark = Bookmark(self.browser)
        self.container = Container(self.browser)
        self.compute_profile = ComputeProfile(self.browser)
        self.compute_resource = ComputeResource(self.browser)
        self.contenthost = ContentHost(self.browser)
        self.configgroups = ConfigGroups(self.browser)
        self.content_views = ContentViews(self.browser)
        self.dashboard = Dashboard(self.browser)
        self.dockertag = DockerTag(self.browser)
        self.domain = Domain(self.browser)
        self.errata = Errata(self.browser)
        self.discoveredhosts = DiscoveredHosts(self.browser)
        self.discoveryrules = DiscoveryRules(self.browser)
        self.environment = Environment(self.browser)
        self.gpgkey = GPGKey(self.browser)
        self.hardwaremodel = HardwareModel(self.browser)
        self.hostcollection = HostCollection(self.browser)
        self.hostgroup = Hostgroup(self.browser)
        self.hosts = Hosts(self.browser)
        self.job = Job(self.browser)
        self.jobtemplate = JobTemplate(self.browser)
        self.ldapauthsource = LdapAuthSource(self.browser)
        self.lifecycleenvironment = LifecycleEnvironment(self.browser)
        self.location = Location(self.browser)
        self.login = Login(self.browser)
        self.medium = Medium(self.browser)
        self.my_account = MyAccount(self.browser)
        self.navigator = Navigator(self.browser)
        self.nav = self.navigator  # for compatibility purposes
        self.user = User(self.browser)
        self.operatingsys = OperatingSys(self.browser)
        self.org = Org(self.browser)
        self.oscapcontent = OpenScapContent(self.browser)
        self.oscappolicy = OpenScapPolicy(self.browser)
        self.oscapreports = OpenScapReports(self.browser)
        self.package = Package(self.browser)
        self.partitiontable = PartitionTable(self.browser)
        self.puppetclasses = PuppetClasses(self.browser)
        self.puppetmodule = PuppetModule(self.browser)
        self.products = Products(self.browser)
        self.registry = Registry(self.browser)
        self.repository = Repos(self.browser)
        self.rhai = RHAI(self.browser)
        self.role = Role(self.browser)
        self.settings = Settings(self.browser)
        self.sc_parameters = SmartClassParameter(self.browser)
        self.smart_variable = SmartVariable(self.browser)
        self.subnet = Subnet(self.browser)
        self.subscriptions = Subscriptions(self.browser)
        self.sync = Sync(self.browser)
        self.syncplan = Syncplan(self.browser)
        self.task = Task(self.browser)
        self.template = Template(self.browser)
        self.trend = Trend(self.browser)
        self.usergroup = UserGroup(self.browser)

        # for compatibility purposes
        for attr in ('activationkey', 'architecture', 'bookmark', 'container',
                     'compute_profile', 'compute_resource', 'contenthost',
                     'configgroups', 'content_views', 'dashboard', 'dockertag',
                     'domain', 'errata', 'discoveredhosts', 'discoveryrules',
                     'environment', 'gpgkey', 'hardwaremodel',
                     'hostcollection', 'hostgroup', 'hosts', 'job',
                     'jobtemplate', 'ldapauthsource', 'lifecycleenvironment',
                     'location', 'login', 'medium', 'my_account', 'navigator',
                     'nav', 'user', 'operatingsys', 'org', 'oscapcontent',
                     'oscappolicy', 'oscapreports', 'package',
                     'partitiontable', 'puppetclasses', 'puppetmodule',
                     'products', 'registry', 'repository', 'rhai', 'role',
                     'settings', 'sc_parameters', 'smart_variable', 'subnet',
                     'subscriptions', 'sync', 'syncplan', 'task', 'template',
                     'trend', 'usergroup'):
            setattr(self.test, attr, getattr(self, attr))

        self.login.login(self._user, self._password)
        return self
Esempio n. 6
0
    def setUp(self):  # noqa
        """We do want a new browser instance for every test."""
        super(UITestCase, self).setUp()
        if settings.browser == 'docker':
            self._docker_browser = DockerBrowser(name=self.id())
            self._docker_browser.start()
            self.browser = self._docker_browser.webdriver
            self.addCleanup(self._docker_browser.stop)
        else:
            self.browser = browser()
            self.addCleanup(self.browser.quit)
        self.browser.maximize_window()
        self.browser.get(settings.server.get_url())
        # Workaround 'Certificate Error' screen on Microsoft Edge
        if (self.driver_name == 'edge'
                and 'Certificate Error' in self.browser.title
                or 'Login' not in self.browser.title):
            self.browser.get(
                "javascript:document.getElementById('invalidcert_continue')"
                ".click()")

        self.browser.foreman_user = self.foreman_user
        self.browser.foreman_password = self.foreman_password

        self.addCleanup(self._saucelabs_test_result)
        self.addCleanup(self.take_screenshot)

        # Library methods
        self.activationkey = ActivationKey(self.browser)
        self.architecture = Architecture(self.browser)
        self.bookmark = Bookmark(self.browser)
        self.container = Container(self.browser)
        self.compute_profile = ComputeProfile(self.browser)
        self.compute_resource = ComputeResource(self.browser)
        self.contenthost = ContentHost(self.browser)
        self.configgroups = ConfigGroups(self.browser)
        self.content_views = ContentViews(self.browser)
        self.dashboard = Dashboard(self.browser)
        self.dockertag = DockerTag(self.browser)
        self.domain = Domain(self.browser)
        self.errata = Errata(self.browser)
        self.discoveredhosts = DiscoveredHosts(self.browser)
        self.discoveryrules = DiscoveryRules(self.browser)
        self.environment = Environment(self.browser)
        self.gpgkey = GPGKey(self.browser)
        self.hardwaremodel = HardwareModel(self.browser)
        self.hostcollection = HostCollection(self.browser)
        self.hostgroup = Hostgroup(self.browser)
        self.hosts = Hosts(self.browser)
        self.job = Job(self.browser)
        self.jobtemplate = JobTemplate(self.browser)
        self.ldapauthsource = LdapAuthSource(self.browser)
        self.lifecycleenvironment = LifecycleEnvironment(self.browser)
        self.location = Location(self.browser)
        self.login = Login(self.browser)
        self.medium = Medium(self.browser)
        self.my_account = MyAccount(self.browser)
        self.navigator = Navigator(self.browser)
        self.user = User(self.browser)
        self.operatingsys = OperatingSys(self.browser)
        self.org = Org(self.browser)
        self.oscapcontent = OpenScapContent(self.browser)
        self.oscappolicy = OpenScapPolicy(self.browser)
        self.oscapreports = OpenScapReports(self.browser)
        self.package = Package(self.browser)
        self.partitiontable = PartitionTable(self.browser)
        self.puppetclasses = PuppetClasses(self.browser)
        self.puppetmodule = PuppetModule(self.browser)
        self.products = Products(self.browser)
        self.registry = Registry(self.browser)
        self.repository = Repos(self.browser)
        self.rhai = RHAI(self.browser)
        self.role = Role(self.browser)
        self.settings = Settings(self.browser)
        self.smart_variable = SmartVariable(self.browser)
        self.subnet = Subnet(self.browser)
        self.subscriptions = Subscriptions(self.browser)
        self.sync = Sync(self.browser)
        self.syncplan = Syncplan(self.browser)
        self.systemgroup = SystemGroup(self.browser)
        self.template = Template(self.browser)
        self.trend = Trend(self.browser)
        self.user = User(self.browser)
        self.usergroup = UserGroup(self.browser)