From 49610728f8b33f34ea61e577bca63bc46b620233 Mon Sep 17 00:00:00 2001 From: Aleksandr Kotlyar Date: Sun, 4 Aug 2024 23:11:34 +0300 Subject: [PATCH 1/2] CHORE: build & deploy docs in master repo only --- .github/workflows/deploy-mkdocs-poetry.yml | 2 ++ .github/workflows/traffic2badge.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/deploy-mkdocs-poetry.yml b/.github/workflows/deploy-mkdocs-poetry.yml index a617888f..f2c8ceaf 100644 --- a/.github/workflows/deploy-mkdocs-poetry.yml +++ b/.github/workflows/deploy-mkdocs-poetry.yml @@ -22,6 +22,7 @@ jobs: # Build docs via MkDocs with poetry shell (environment) build-docs: + if: github.repository_owner == 'yashaka' # The type of runner that the job will run on runs-on: ubuntu-latest @@ -56,6 +57,7 @@ jobs: # Deploy docs job deploy-docs: + if: github.repository_owner == 'yashaka' # Add a dependency to the build job needs: build-docs diff --git a/.github/workflows/traffic2badge.yml b/.github/workflows/traffic2badge.yml index 92b97f7e..4e82d9ff 100644 --- a/.github/workflows/traffic2badge.yml +++ b/.github/workflows/traffic2badge.yml @@ -8,6 +8,7 @@ on: jobs: run: + if: github.repository_owner == 'yashaka' name: Make GitHub Traffic to Badge runs-on: ubuntu-latest steps: From 6498e85d0bc661365d624b29624d7ead159de882 Mon Sep 17 00:00:00 2001 From: Aleksandr Kotlyar Date: Sun, 4 Aug 2024 23:27:57 +0300 Subject: [PATCH 2/2] TESTS: core wait tests --- tests/integration/core_wait_test.py | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/integration/core_wait_test.py diff --git a/tests/integration/core_wait_test.py b/tests/integration/core_wait_test.py new file mode 100644 index 00000000..30cd8b2f --- /dev/null +++ b/tests/integration/core_wait_test.py @@ -0,0 +1,46 @@ +import time + +from selene import be +from tests.integration.helpers.givenpage import GivenPage + + +def test_waits_for_visibility_minimum_needed_time(session_browser): + page = GivenPage(session_browser.driver) + page.opened_with_body( + ''' + go to Heading 2 +

Heading 2

+ ''' + ).execute_script_with_timeout( + 'document.getElementsByTagName("a")[0].style = "display:block";', 1 + ) + stamp_before = time.time_ns() + session_browser.element('a').wait.at_most(1).for_(be.visible) + + session_browser.driver.find_element_by_css_selector('a').click() + + stamp_after = time.time_ns() + deviation_sec = 0.2 + assert stamp_after - stamp_before < (1 + deviation_sec) * pow(10, 9) + assert "second" in session_browser.driver.current_url + + +def test_fails_on_timeout_during_waits_first_for_present_in_dom_then_visibility(session_browser): + page = GivenPage(session_browser.driver) + page.opened_with_body( + ''' + go to Heading 2 +

Heading 2

+ ''' + ).execute_script_with_timeout( + 'document.getElementsByTagName("a")[0].style = "display:block";', 1.1 + ) + stamp_before = time.time_ns() + session_browser.element('a').wait.at_most(1).for_(be.visible) + + session_browser.driver.find_element_by_css_selector('a').click() + + stamp_after = time.time_ns() + deviation_sec = 0.2 + assert stamp_after - stamp_before < (1 + deviation_sec) * pow(10, 9) + assert "second" in session_browser.driver.current_url