-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_screen.py
More file actions
66 lines (55 loc) · 2.41 KB
/
main_screen.py
File metadata and controls
66 lines (55 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from typing import Literal
from locators.locators import Locators
from screens.base_screen import Screen
from utils.logger import log
class MainScreen(Screen):
def __init__(self, driver):
super().__init__(driver)
self.locators = Locators()
def click_on_text_link(self):
"""Click on text link"""
self.click(locator=self.locators.main_menu.TEXT_LINK)
def tap_on_text_link(self):
"""Tap on text link"""
self.tap(locator=self.locators.main_menu.TEXT_LINK)
def scroll_view_by_coordinates(self, direction: Literal["down", "up"] = "down"):
"""Scroll by coordinates"""
self.tap(locator=self.locators.main_menu.VIEWS_LINK)
self.scroll(directions=direction)
def scroll_to_image_button(self):
"""Scroll to image button"""
self.tap(locator=self.locators.main_menu.VIEWS_LINK)
self.scroll_to_element(
from_el=self.locators.views_menu.ANIMATION_LINK,
destination_el=self.locators.views_menu.IMAGE_BUTTON,
)
def scroll_until_text_field_visible(self):
"""Scroll until element visible"""
self.tap(locator=self.locators.main_menu.VIEWS_LINK)
self.scroll_until_element_visible(
destination_el=self.locators.views_menu.TEXT_FIELDS
)
def swipe_tab(self):
"""Move to Scrollable tab and swipe left"""
self.tap(locator=self.locators.main_menu.VIEWS_LINK)
self.scroll_until_element_visible(
destination_el=self.locators.views_menu.TABS_LINK
)
self.tap(locator=self.locators.views_menu.TABS_LINK)
self.tap(locator=self.locators.views_menu.tabs_fields.SCROLLABLE_LINK)
self.swipe_to_delete(
locator=self.locators.views_menu.tabs_fields.SCROLLABLE_TAB,
direction="left",
)
def type_text(self, text):
"""Type text to field with HINT"""
self.tap(locator=self.locators.main_menu.VIEWS_LINK)
self.scroll_until_element_visible(
destination_el=self.locators.views_menu.TEXT_FIELDS
)
self.tap(locator=self.locators.views_menu.TEXT_FIELDS)
self.click(locator=self.locators.views_menu.text_fields.HINT_INPUT)
self.type(locator=self.locators.views_menu.text_fields.HINT_INPUT, text=text)
def double_tap_on_views_link(self):
"""Double tap"""
self.double_tap(locator=self.locators.main_menu.VIEWS_LINK)