Skip to content

Commit

Permalink
chore - also build the docs on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jjpaulo2 committed Aug 3, 2024
1 parent 7084f7d commit 03069cf
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 16 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ concurrency:

jobs:
python:

strategy:
matrix:
python_version: ['3.10']

environment:
name: pypi
url: https://pypi.org/project/fastrpa/
Expand All @@ -33,7 +28,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
python-version: '3.10'

- name: Install and configure Poetry
uses: snok/install-poetry@v1
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,25 @@ jobs:

- name: Build the project
run: poetry build

docs:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install and configure Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: poetry install --with dev

- name: Build the docs
run: poetry run mkdocs build
6 changes: 3 additions & 3 deletions fastrpa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ def file_input(self, xpath: str, wait: bool = True) -> FileInputElement:

def radio_input(self, xpath: str, wait: bool = True) -> RadioInputElement:
return self._specific_element(xpath, RadioInputElement, wait)

def checkbox(self, xpath: str, wait: bool = True) -> CheckboxElement:
return self._specific_element(xpath, CheckboxElement, wait)

def select(self, xpath: str, wait: bool = True) -> SelectElement:
return self._specific_element(xpath, SelectElement, wait)

def button(self, xpath: str, wait: bool = True) -> ButtonElement:
return self._specific_element(xpath, ButtonElement, wait)

Expand Down
10 changes: 5 additions & 5 deletions fastrpa/core/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,22 @@ def options_labels(self) -> list[str]:
for element in self.radio_sources
if (xpath := f'//label[@for="{element.get_attribute("id")}"]')
]

@property
def options(self) -> dict[str, str]:
return {
value: label
for value, label in zip(self.options_values, self.options_labels)
}

def select(self, label: str | None = None, value: str | None = None):
if label:
index = self.options_labels.index(label)
element = self.radio_sources[index]
self.actions.move_to_element(element)
self.actions.click(element)
self.actions.perform()

elif value:
index = self.options_values.index(value)
element = self.radio_sources[index]
Expand All @@ -216,11 +216,10 @@ def print(self):


class CheckboxElement(Element):

@property
def is_checked(self) -> bool:
return self.source.is_selected()

def check(self):
if not self.is_checked:
self.click()
Expand All @@ -232,6 +231,7 @@ def uncheck(self):
def switch(self):
self.click()


class ListElement(Element):
@property
def items_sources(self) -> list[WebElement]:
Expand Down
4 changes: 2 additions & 2 deletions fastrpa/core/elements_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ def element_class(self, element: WebElement) -> Type[Element]:
]
):
return FileInputElement

elif all(
[
element.tag_name == 'input',
element.get_attribute('type') == 'radio',
]
):
return RadioInputElement

elif all(
[
element.tag_name == 'input',
Expand Down

0 comments on commit 03069cf

Please sign in to comment.