Beispiel #1
0
    def setUp(self):
        # Always use '.copy()' on the DesiredCapabilities object
        # to avoid the side effects of altering the Global class instance
        capabilities = DesiredCapabilities.CHROME.copy()
        capabilities['handlesAlerts'] = True
        capabilities['nativeEvents'] = True
        capabilities['acceptSslCerts'] = True
        capabilities['takesScreenshot'] = True
        capabilities['cssSelectorsEnabled'] = True
        capabilities['javascriptEnabled'] = True
        if self.is_mobile():
            self.driver = desktop_browser.Remote(desired_capabilities=capabilities)
        else:
            self.driver = desktop_browser.Chrome(
                CHROMEDRIVER, desired_capabilities=capabilities)
        self.driver.screenshot_count = 0

        self.loginpage = LoginPage(self.driver, self.domain)
        self.google_sso_page = GoogleSSOPage(self.driver, self.domain)
        self.navbar = NavBarActions(self.driver, self.domain)
        self.portalpage = PortalPage(self.driver, self.domain)
        self.createchallengepage = CreateChallengePage(self.driver, self.domain)
        self.challengepage = ChallengePage(self.driver, self.domain)
        self.createideapage = CreateIdeaPage(self.driver, self.domain)
        self.ideapage = IdeaPage(self.driver, self.domain)
        self.discoverpage = DiscoverPage(self.driver, self.domain)
        self.adminpage = AdminPage(self.driver, self.domain)
        self.reviewboard = ReviewBoard(self.driver, self.domain)
        self.oauth2_app_list_page = OAuth2AppListPage(self.driver, self.domain)
        self.oauth2_app_create_page = OAuth2CreateAppPage(self.driver, self.domain)
        self.oauth2_auth_page = OAuth2AuthPage(self.driver, self.domain)
        self.oauth2_edit_app_page = OAuth2EditAppPage(self.driver, self.domain)
        self.yammer_integration_page = YammerIntegrationPage(self.driver)
        self.edit_profile_page = EditProfilePage(self.driver, self.domain)
        self.editcommunity = EditCommunityPage(self.driver, self.domain)
        self.wazoku_admin_page = WazokuAdminPage(self.driver, self.domain)
        self.create_demo_site_page = WazokuAdminCreateDemoSitePage(
            self.driver, self.domain)
        self.cccpage = CCCommunityPage(self.driver, self.domain)
        self.ideaspace_creation_page = IdeaspaceCreationPage(self.driver, self.domain)

        """
Beispiel #2
0
class SpotlightSeleniumTests(unittest.TestCase, Actions):
    domain = DOMAIN

    def is_mobile(self):
        return pytest.config.getoption("--mobile")

    def setUp(self):
        # Always use '.copy()' on the DesiredCapabilities object
        # to avoid the side effects of altering the Global class instance
        capabilities = DesiredCapabilities.CHROME.copy()
        capabilities['handlesAlerts'] = True
        capabilities['nativeEvents'] = True
        capabilities['acceptSslCerts'] = True
        capabilities['takesScreenshot'] = True
        capabilities['cssSelectorsEnabled'] = True
        capabilities['javascriptEnabled'] = True
        if self.is_mobile():
            self.driver = desktop_browser.Remote(desired_capabilities=capabilities)
        else:
            self.driver = desktop_browser.Chrome(
                CHROMEDRIVER, desired_capabilities=capabilities)
        self.driver.screenshot_count = 0

        self.loginpage = LoginPage(self.driver, self.domain)
        self.google_sso_page = GoogleSSOPage(self.driver, self.domain)
        self.navbar = NavBarActions(self.driver, self.domain)
        self.portalpage = PortalPage(self.driver, self.domain)
        self.createchallengepage = CreateChallengePage(self.driver, self.domain)
        self.challengepage = ChallengePage(self.driver, self.domain)
        self.createideapage = CreateIdeaPage(self.driver, self.domain)
        self.ideapage = IdeaPage(self.driver, self.domain)
        self.discoverpage = DiscoverPage(self.driver, self.domain)
        self.adminpage = AdminPage(self.driver, self.domain)
        self.reviewboard = ReviewBoard(self.driver, self.domain)
        self.oauth2_app_list_page = OAuth2AppListPage(self.driver, self.domain)
        self.oauth2_app_create_page = OAuth2CreateAppPage(self.driver, self.domain)
        self.oauth2_auth_page = OAuth2AuthPage(self.driver, self.domain)
        self.oauth2_edit_app_page = OAuth2EditAppPage(self.driver, self.domain)
        self.yammer_integration_page = YammerIntegrationPage(self.driver)
        self.edit_profile_page = EditProfilePage(self.driver, self.domain)
        self.editcommunity = EditCommunityPage(self.driver, self.domain)
        self.wazoku_admin_page = WazokuAdminPage(self.driver, self.domain)
        self.create_demo_site_page = WazokuAdminCreateDemoSitePage(
            self.driver, self.domain)
        self.cccpage = CCCommunityPage(self.driver, self.domain)
        self.ideaspace_creation_page = IdeaspaceCreationPage(self.driver, self.domain)

        """
        This is overriding the maximise() in base __init__
        If we need to change the screen size to something custom
        then there shouldn't be an issue with using the set_screen_size()
        """
        # self.set_screen_size(*DESKTOP)

    def set_screen_size(self, w, h):
        self.driver.set_window_size(w, h)
        self.navbar.wait_until(
            lambda driver: driver.get_window_size() == {u'width': w, u'height': h},
        )
        # Give the browser a little time to redraw itself
        time.sleep(0.5)

    def delete_challenge(self):
        self.challengepage.open_sidebar()
        self.challengepage.delete_challenge()

    def tearDown(self):
        try:
            if sys.exc_info()[0] is not None:
                self.save_screenshot(u'fail')
        finally:
            self.driver.quit()