Exemple #1
0
def app(request):
    """fixture for cross-platform model-based application
    always use session scope for this type of fixture & parameterize your platforms
    :rtype: App
    """
    if isinstance(request.param, list) or isinstance(request.param, tuple):
        APPS = []
        for platform in request.param:
            APPS.append(App.from_platform(platform, request))
            request.addfinalizer(APPS[-1].driver.quit)
        return APPS
    APP = App.from_platform(request.param, request)
    request.addfinalizer(APP.driver.quit)
    return APP
Exemple #2
0
def test_navigator(platform: crosstest.Platform, request):
    t = time.time()
    test = platform.setup(request)
    print('time to get test platform {}'.format(time.time() - t))

    t = time.time()
    driver = test.driver()
    print('time to get driver {}'.format(time.time() - t))

    t = time.time()
    app = App(driver)
    print('time to get app model {}'.format(time.time() - t))

    # manual navigation connection configuration
    navigate = Navigator(app.google_home)
    navigate.connect_all(
        (app.google_home.navigate_to_GoogleSearchPage, app.google_search),
        (app.google_search.navigate_to_LinkedinHomePage, app.linkedin_home))

    # money time for this feature
    t = time.time()
    navigate.to(app.linkedin_home)
    print('time to get navigation calc {}'.format(time.time() - t))

    t = time.time()
    navigate.perform()
    print('time to get navigation {}'.format(time.time() - t))

    # this is what the tester will want to test
    app.linkedin_home.register.register_and_submit(firstname='test123',
                                                   lastname='456',
                                                   email='testmail',
                                                   password='******')

    app.driver.quit()
Exemple #3
0
def test_navigator_with_auto_connect(platform, request):
    app = App.from_platform(platform, request)
    app.navigate.to(app.linkedin_home).perform()
    # this is what the tester will want to test
    app.linkedin_home.register.register_and_submit(firstname='test123',
                                                   lastname='456',
                                                   email='testmail',
                                                   password='******')
    app.driver.quit()
Exemple #4
0
def test_navigator_2_navigations(platform, request):
    app = App.from_platform(platform, request)
    app.navigate(app.google_search)
    assert app.navigate.current_page == app.navigate.from_page == app.google_search
    app.navigate(app.linkedin_home)
    assert app.navigate.current_page == app.navigate.from_page == app.linkedin_home
    # this is what the tester will want to test
    app.linkedin_home.register.register_and_submit(firstname='test123',
                                                   lastname='456',
                                                   email='testmail',
                                                   password='******')
    app.driver.quit()
Exemple #5
0
def test_navigate_to_self_with_looped_navigation(platform, request):
    # setup
    app = App.from_platform(platform, request)

    # test flow
    app.navigate(app.google_search)

    # test scenario
    app.navigate(app.google_search)

    # validation
    app.google_search.search_bar.button()

    # teardown
    app.driver.quit()
Exemple #6
0
def test_navigator_with_auto_connect(platform: crosstest.Platform, request):
    test = platform.setup(request)
    driver = test.driver()
    app = App(driver)
    try:
        app.navigate.to(app.linkedin_home)
        app.navigate.perform()

        # this is what the tester will want to test
        app.linkedin_home.register.register_and_submit(
            firstname='test123',
            lastname='456',
            email='testmail',
            password='******')
    finally:
        try:
            driver.quit()
        except:
            pass
Exemple #7
0
def test_navigate_to_self_with_remote_looped_navigation(platform, request):
    app = App.from_platform(platform, request)
    app.navigate(app.google_home)
    app.google_home.google_search_button()
    app.driver.quit()
Exemple #8
0
def test_navigate_with_no_possible_navigation(platform, request):
    app = App.from_platform(platform, request)
    app.navigate(app.linkedin_home)
    # with pytest.raises(PathUnreachableException):
    #     app.navigate(app.google_home)
    app.driver.quit()
Exemple #9
0
def test_navigate_to_self_with_no_possible_navigation(platform, request):
    app = App.from_platform(platform, request)
    app.navigate(app.linkedin_home)
    app.navigate(app.linkedin_home)
    app.linkedin_home.register.reg_submit()
    app.driver.quit()