Пример #1
0
def test_set_home(browser, mobile):

    functions.login(browser)

    home = FirstPage(browser)
    home.my_maps()
    home = MyMapsPage(browser)
    home.set_home()
    for i in range(100000000):
        pass
    home.set_work()

    #mobile check
    # mobile
    main_screen = MainScreen(mobile)
    main_screen.menu_click()

    menu_screen = MenuScreen(mobile)
    menu_screen.places_and_routes()

    my_maps = MyMapsScreen(mobile)
    my_maps.refresh()

    elem_home = mobile.find_element_by_xpath(
        '//android.widget.FrameLayout[@content-desc="Home: Muzeum"]/android.widget.LinearLayout/android.widget.TextView'
    )
    elem_work = mobile.find_element_by_xpath(
        '//android.widget.FrameLayout[@content-desc="Work: Rudolfinum"]/android.widget.LinearLayout/android.widget.TextView'
    )

    assert elem_home.get_attribute(
        'text') == 'Muzeum' and elem_work.get_attribute('text') == 'Rudolfinum'
Пример #2
0
class Game:
    """Controls the main game loop"""
    FPS = 30
    SIZE = WINDOW_SIZE

    def __init__(self):
        """Creates the Game object"""
        self.scene = MainScreen(self)
        self.screen = None
        self.leaderboard = Leaderboard()

    def run(self):
        """Runs the game"""
        clock = pygame.time.Clock()
        self.screen = pygame.display.set_mode(Game.SIZE)
        while True:
            # check if game has been exited
            events = pygame.event.get()
            for event in events:
                if event.type == pygame.QUIT:
                    sys.exit()
            # update window and use clock tick
            self.scene.update(events)
            clock.tick(self.FPS)

    def set_scene(self, new_screen):
        """Changes the scene the game is in"""
        self.scene = new_screen
Пример #3
0
def test_logout(mobile):
    main_screen = MainScreen(mobile)
    main_screen.menu_click()

    menu_screen = MenuScreen(mobile)
    menu_screen.log_out()

    user_name = mobile.find_element_by_id(
        'cz.seznam.mapy:id/userName').get_attribute('text')
    assert user_name == 'Log in'
Пример #4
0
def test_mobile_poi_changed_name(browser, mobile):

    SEARCH: str = 'Gherkin'

    search_screen = MainScreen(mobile)
    search_screen.search_click()
    search = SearchScreen(mobile)
    search.search(SEARCH)

    poidetail = PoidetailScreen(mobile)
    poidetail.scroll_right()
    poidetail.scroll_left()
    #poidetail.trip()
    poidetail.save()

    save_page = SaveScreen(mobile)
    save_page.rename("New name")
    save_page.save()

    poidetail = PoidetailScreen(mobile)
    poidetail.close()

    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.places_and_routes()

    elem = functions.check_web_item(browser)
    assert elem.text == 'New name'

    # #delete poi
    functions.delete_poi(mobile)
Пример #5
0
def test_mobile_trip_foot(browser, mobile):
    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.trips()

    for i in range(100000000):
        pass

    trip = TripScreen(mobile)
    # trip.change_distance()
    # for i in range(100000000):
    #     pass

    trip.save()
    save_page = SaveScreen(mobile)
    name = save_page.get_name()
    #save_page.rename("Foot trip")
    save_page.save()

    poidetail = PoidetailScreen(mobile)
    poidetail.close1()
    poidetail.close1()

    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.places_and_routes()

    elem = functions.check_web_item(browser)
    assert elem.text == name

    # #delete poi
    functions.delete_poi(mobile)
Пример #6
0
def test_mobile_planning5(browser, mobile):
    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.route_planning()
    planning = RouteScreen(mobile)
    planning.bike()
    planning.start("Prague")
    planning.end("Genoa")

    for i in range(100000000):
        pass

    planning = RouteScreen(mobile)

    planning.save()

    save_page = SaveScreen(mobile)
    save_page.rename("Bike route")
    save_page.save()

    poidetail = PoidetailScreen(mobile)
    poidetail.close1()

    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.places_and_routes()

    elem = functions.check_web_item(browser)
    assert elem.text == "Bike route"

    # #delete poi
    functions.delete_poi(mobile)
Пример #7
0
def test_mobile_coor_changed_name_rename(browser, mobile):
    search_screen = MainScreen(mobile)
    search_screen.coor()
    #search_screen.zoom_in()
    #earch_screen.zoom_out()

    poidetail = PoidetailScreen(mobile)
    poidetail.save()

    save_page = SaveScreen(mobile)
    save_page.rename("New name coor")
    save_page.save()

    poidetail = PoidetailScreen(mobile)
    poidetail.close1()

    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.places_and_routes()

    elem = functions.check_web_item(browser)
    assert elem.text == "New name coor"

    # #delete poi
    functions.delete_poi(mobile)
Пример #8
0
def test_mobile_muni_poi(browser, mobile):

    SEARCH: str = 'Wurzen'
    search_screen = MainScreen(mobile)
    search_screen.search_click()
    search = SearchScreen(mobile)
    search.search(SEARCH)

    poidetail = PoidetailScreen(mobile)
    poidetail.save()

    save_page = SaveScreen(mobile)
    save_page.save()

    poidetail = PoidetailScreen(mobile)
    poidetail.close()

    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.places_and_routes()

    elem = functions.check_web_item(browser)
    assert elem.text == SEARCH

    # #delete poi
    functions.delete_poi(mobile)
Пример #9
0
def test_mobile_web_folder_sync(browser, mobile):
    main_screen = MainScreen(mobile)
    main_screen.menu_click()

    menu = MenuScreen(mobile)
    menu.places_and_routes()

    my_maps = MyMapsScreen(mobile)
    my_maps.create_folder('Changed names')

    elem = functions.check_web_item(browser)
    assert elem.text == 'Changed names'

    # #delete folder
    functions.delete_folder(mobile)
Пример #10
0
def check_mobile_folder(mobile):
    main_screen = MainScreen(mobile)
    main_screen.menu_click()

    menu_screen = MenuScreen(mobile)
    menu_screen.places_and_routes()

    my_maps = MyMapsScreen(mobile)
    my_maps.refresh()

    elem = mobile.find_element_by_xpath(
        '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout[2]/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.TextView')

    # elem = mobile.find_element_by_xpath(
    #     '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout[2]/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.TextView')
    return  elem
Пример #11
0
def login(mobile):


    USER_NAME = 'mapytesting2'
    PASSWORD = '******'

    main_screen = MainScreen(mobile)
    main_screen.menu_click()

    menu_screen = MenuScreen(mobile)
    menu_screen.log_in()

    login_screen = LogInScreen(mobile)
    login_screen.user_name(USER_NAME)
    login_screen.password(PASSWORD)
    login_screen.sign_in_button()
Пример #12
0
def check_mobile_item(mobile):
    #pass
    main_screen = MainScreen(mobile)
    main_screen.menu_click()

    menu_screen = MenuScreen(mobile)
    menu_screen.places_and_routes()

    my_maps = MyMapsScreen(mobile)
    my_maps.refresh()


    #elem = mobile.find_element_by_xpath(f'//*[@text = {element_title}]')
    elem = mobile.find_element_by_xpath(
        '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout[2]/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.view.ViewGroup/android.widget.TextView[1]')
    elem.get_attribute('text')
    return elem
 def login(self, account):
     """
     Performs log in with provided registered account
     :param account dictionary with keys "name" and "password"
     :type account dict
     :return: MainScreen object
     """
     self.username = account["name"]
     self.password = account["password"]
     element = self.driver.find_element(*LoginScreenLocators.LOGIN_BTN)
     element.click()
     return MainScreen(self.driver)
Пример #14
0
 def build(self):
     Window.bind(on_key_down=self.key_action)
     self.root = ScreenManager(
         transition=RVBTransition())  # WipeTransition()
     menu_screen = MenuScreen(name='menu')
     self.root.add_widget(menu_screen)
     self.root.add_widget(MainScreen(name='main'))
     self.root.add_widget(IsoMapScreen(name='iso_map'))
     self.root.current = 'menu'  # temporary for testing
     menu_screen.new_game()  # сразу создать новую игру
     self.root.current = 'iso_map'
     return self.root
Пример #15
0
def test_login(mobile):
    USER_NAME = 'mapytesting2'
    PASSWORD = '******'

    main_screen = MainScreen(mobile)
    main_screen.menu_click()

    menu_screen = MenuScreen(mobile)
    menu_screen.log_in()

    login_screen = LogInScreen(mobile)
    login_screen.user_name(USER_NAME)
    login_screen.password(PASSWORD)
    login_screen.sign_in_button()

    user_name = mobile.find_element_by_id(
        'cz.seznam.mapy:id/userName').get_attribute('text')
    password = mobile.find_element_by_id(
        'cz.seznam.mapy:id/accountName').get_attribute('text')

    assert user_name == 'mapytesting2'
    assert password == '*****@*****.**'
Пример #16
0
def test_mobile_planning4(browser, mobile):
    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.route_planning()
    planning = RouteScreen(mobile)
    planning.start("Prague")
    planning.end("Genoa")
    for i in range(200000000):
        pass
    planning.options()

    options = OptionsScreen(mobile)
    options.auto_avoid()
    options.auto_short()
    mobile.back()
    for i in range(100000000):
        pass

    planning = RouteScreen(mobile)

    planning.save()

    save_page = SaveScreen(mobile)
    save_page.rename("Route avoid pay short")
    save_page.save()

    poidetail = PoidetailScreen(mobile)
    poidetail.close1()

    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.places_and_routes()

    elem = functions.check_web_item(browser)
    assert elem.text == "Route avoid pay short"

    # #delete poi
    functions.delete_poi(mobile)
Пример #17
0
def test_mobile_reorder(browser, mobile):

    countries = ['Poland', 'Sweden']
    for SEARCH in countries:
        search_screen = MainScreen(mobile)
        search_screen.search_click()
        search = SearchScreen(mobile)
        search.search(SEARCH)

        poidetail = PoidetailScreen(mobile)
        poidetail.save()

        save_page = SaveScreen(mobile)
        save_page.save()

        poidetail = PoidetailScreen(mobile)
        poidetail.close()

    main_screen = MainScreen(mobile)
    main_screen.menu_click()
    menu = MenuScreen(mobile)
    menu.places_and_routes()

    my_maps = MyMapsScreen(mobile)
    order = my_maps.order_2_items()

    elems = functions.return_web_items(browser)
    web_order = []
    for i in elems:
        web_order.append(i.text)

    print(order)
    print(web_order)

    assert order == web_order

    my_maps.reoder_2_items()
Пример #18
0
def game_run():
    pg.init()

    config = Settings()

    width: int = config.width
    height: int = config.height

    size: tuple = (width, height)

    screen: pg.Surface = pg.display.set_mode(size, pg.FULLSCREEN)

    pg.display.set_caption("Connect Four")

    icon: pg.Surface = pg.image.load(f"{Path.images()}icon{Path.IMAGE_SUFFIX}")

    pg.display.set_icon(icon)

    pg.mouse.set_visible(0)

    pg.mouse.set_pos(963, 63)

    is_controller: bool = False

    changes_res = False

    isRunning = True

    InitScreen_object = InitScreen(screen)
    InitScreen_object.starter_screen()

    play_again = False
    name1, name2 = None, None

    while isRunning:
        pg.mouse.set_visible(False)

        try:
            joystick = pg.joystick.Joystick(0)
            is_controller = True

        except pg.error:
            pass

        if not play_again:
            name1, name2, changes_res = StarterMenu(
                res=config.size,
                sm_res=[
                    config.sm_title,
                    config.sm_mode_txt,
                    config.sm_mode,
                    config.sm_theme_text,
                    config.sm_theme,
                    config.sm_res_text,
                    config.sm_res,
                    config.sm_next,
                    config.sm_quit,
                    config.sm_p1,
                    config.sm_p2,
                    config.sm_p1_1,
                ],
                screen=screen,
            ).run()
            config = Settings()

        if changes_res:
            pg.quit()
            re_exec()
            break

        pg.mouse.set_visible(False)

        MainScreen_object = MainScreen(screen, is_controller, config.option)
        play_again = MainScreen_object.main_screen(scores,
                                                   usernames=[name1, name2])
Пример #19
0
from framework.game import RoguelikeGame
from screens.main_screen import MainScreen

if __name__ == '__main__':
    game = RoguelikeGame()
    game.push_screen(MainScreen(game))
    game.initialise()
    game.run()
Пример #20
0
def test_offlinemaps_button(mobile):
    main_screen = MainScreen(mobile)
    main_screen.menu_click()

    menu_screen = MenuScreen(mobile)
    menu_screen.offline_maps()
Пример #21
0
def test_menu_button(mobile):
    main_screen = MainScreen(mobile)
    main_screen.menu_click()
Пример #22
0
 def __init__(self):
     """Creates the Game object"""
     self.scene = MainScreen(self)
     self.screen = None
     self.leaderboard = Leaderboard()