pomcorn 0.5.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pomcorn might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pomcorn
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Base implementation of Page Object Model
5
5
  Home-page: https://pypi.org/project/pomcorn/
6
6
  License: MIT
@@ -45,7 +45,7 @@ class ComponentWithBaseLocator(Generic[TPage], Component[TPage]):
45
45
 
46
46
  Args:
47
47
  page: An instance of the page that uses this component.
48
- base_locator: locator: Instance of a class to locate the element in
48
+ base_locator: Instance of a class to locate the element in
49
49
  the browser. Used in relative element initialization methods
50
50
  and visibility waits. You also can specify it as attribute.
51
51
  wait_until_visible: Whether to wait for the component to become
@@ -251,7 +251,7 @@ class ListComponent(
251
251
 
252
252
  items: list[ListItemType] = []
253
253
  for locator in self.iter_locators(self.base_item_locator):
254
- items.append(self.item_class(self.page, locator))
254
+ items.append(self.item_class(page=self.page, base_locator=locator))
255
255
  return items
256
256
 
257
257
  def get_item_by_text(self, text: str) -> ListItemType:
@@ -200,13 +200,18 @@ class ButtonWithTextLocator(ElementWithTextLocator):
200
200
  super().__init__(text=text, element="button", exact=exact)
201
201
 
202
202
 
203
- class InputByLabelLocator(XPathLocator):
203
+ class InputInLabelLocator(XPathLocator):
204
204
  """Locator to looking for input with label by XPath.
205
205
 
206
206
  Specify the query as the string
207
207
  ``//label[contains(., "label")]//input``, where ``label`` is the text of
208
208
  the input label.
209
209
 
210
+ Example:
211
+ <label>Title</label>
212
+ <input value="Value">
213
+ </label>
214
+
210
215
  """
211
216
 
212
217
  def __init__(self, label: str):
@@ -216,6 +221,28 @@ class InputByLabelLocator(XPathLocator):
216
221
  )
217
222
 
218
223
 
224
+ class InputByLabelLocator(XPathLocator):
225
+ """Locator to looking for input next to label by XPath.
226
+
227
+ Specify the query as the string
228
+ ``//label[contains(., "label")]/following-sibling::input``, where ``label``
229
+ is the text of the input label.
230
+
231
+ Example:
232
+ <div>
233
+ <label for="InputWithLabel">Title</label>
234
+ <input id="InputWithLabel" value="Value">
235
+ </div>
236
+
237
+ """
238
+
239
+ def __init__(self, label: str):
240
+ """Init XPathLocator."""
241
+ super().__init__(
242
+ query=f'//label[contains(., "{label}")]/following-sibling::input',
243
+ )
244
+
245
+
219
246
  class TextAreaByLabelLocator(XPathLocator):
220
247
  """Locator to looking for textarea with label by XPath.
221
248
 
@@ -3,7 +3,6 @@ from typing import Self
3
3
  from selenium.common.exceptions import TimeoutException
4
4
  from selenium.webdriver.remote.webdriver import WebDriver
5
5
 
6
- from . import locators
7
6
  from .exceptions import PageDidNotLoadedError
8
7
  from .web_view import WebView
9
8
 
@@ -146,14 +145,19 @@ class Page(WebView):
146
145
  self._get_full_relative_url(self.app_root, relative_url),
147
146
  )
148
147
 
149
- def click_on_page(self):
150
- """Click on page `html` tag.
148
+ def click_on_page(self) -> None:
149
+ """Click on (1, 1) coordinates in the upper left corner of the page.
151
150
 
152
151
  Allows you to move focus away from an element, for example, if it
153
152
  is currently unavailable for interaction.
154
153
 
155
154
  """
156
- self.init_element(locator=locators.TagNameLocator("html")).click()
155
+ from selenium.webdriver.common.action_chains import ActionChains
156
+
157
+ ActionChains(self.webdriver).move_by_offset(
158
+ xoffset=1, # cspell:disable-line
159
+ yoffset=1, # cspell:disable-line
160
+ ).click().perform()
157
161
 
158
162
  @staticmethod
159
163
  def _get_full_relative_url(app_root: str, relative_url: str) -> str:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pomcorn"
3
- version = "0.5.0"
3
+ version = "0.6.0"
4
4
  description = "Base implementation of Page Object Model"
5
5
  authors = [
6
6
  "Saritasa <pypi@saritasa.com>",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes