Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky test in examples python #2042

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Conversation

VietND96
Copy link
Member

@VietND96 VietND96 commented Nov 5, 2024

User description

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Description

Added lines of code. And updated code-blocks in docs also

Motivation and Context

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

PR Type

Bug fix, Tests, Documentation


Description

  • Improved the stability of Python tests by adding explicit waits using WebDriverWait and expected_conditions.
  • Fixed formatting issues in Python test files for better readability and consistency.
  • Updated documentation to reflect new line numbers in Python code examples across multiple languages.

Changes walkthrough 📝

Relevant files
Bug fix
2 files
test_mouse.py
Improve stability and formatting of mouse action tests     

examples/python/tests/actions_api/test_mouse.py

  • Added pytest import.
  • Added WebDriverWait and expected_conditions imports.
  • Improved test stability by using WebDriverWait.
  • Fixed formatting issues with ActionChains method chaining.
  • +22/-27 
    test_script.py
    Enhance test stability with explicit waits                             

    examples/python/tests/bidi/cdp/test_script.py

  • Added WebDriverWait and expected_conditions imports.
  • Improved test stability by waiting for element to be clickable.
  • +3/-0     
    Documentation
    8 files
    mouse.en.md
    Update Python code block references in documentation         

    website_and_docs/content/documentation/webdriver/actions_api/mouse.en.md

    • Updated code block line references for Python examples.
    +12/-12 
    mouse.ja.md
    Update Python code block references in Japanese documentation

    website_and_docs/content/documentation/webdriver/actions_api/mouse.ja.md

    • Updated code block line references for Python examples.
    +12/-12 
    mouse.pt-br.md
    Update Python code block references in Portuguese documentation

    website_and_docs/content/documentation/webdriver/actions_api/mouse.pt-br.md

    • Updated code block line references for Python examples.
    +12/-12 
    mouse.zh-cn.md
    Update Python code block references in Chinese documentation

    website_and_docs/content/documentation/webdriver/actions_api/mouse.zh-cn.md

    • Updated code block line references for Python examples.
    +12/-12 
    script.en.md
    Update Python code block references in BiDi script documentation

    website_and_docs/content/documentation/webdriver/bidi/cdp/script.en.md

    • Updated code block line references for Python examples.
    +1/-1     
    script.ja.md
    Update Python code block references in Japanese BiDi script
    documentation

    website_and_docs/content/documentation/webdriver/bidi/cdp/script.ja.md

    • Updated code block line references for Python examples.
    +1/-1     
    script.pt-br.md
    Update Python code block references in Portuguese BiDi script
    documentation

    website_and_docs/content/documentation/webdriver/bidi/cdp/script.pt-br.md

    • Updated code block line references for Python examples.
    +1/-1     
    script.zh-cn.md
    Update Python code block references in Chinese BiDi script
    documentation

    website_and_docs/content/documentation/webdriver/bidi/cdp/script.zh-cn.md

    • Updated code block line references for Python examples.
    +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Signed-off-by: Viet Nguyen Duc <[email protected]>
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Formatting
    The ActionChains method chaining has been reformatted for better readability. Verify that this new formatting is consistent with the project's style guide and doesn't introduce any functional changes.

    Test Stability
    A WebDriverWait has been added to improve test stability. Ensure that this wait is necessary and doesn't mask any underlying issues with the page load or element availability.

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Replace static sleep with explicit wait for improved test reliability and performance

    Use WebDriverWait instead of sleep() to wait for the element status to change. This
    makes the test more reliable and faster in most cases.

    examples/python/tests/actions_api/test_mouse.py [19-20]

    -sleep(0.5)
    -assert driver.find_element(By.ID, "click-status").text == "click-held"
    +WebDriverWait(driver, 10).until(EC.text_to_be_present_in_element((By.ID, "click-status"), "click-held"))
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Using WebDriverWait instead of sleep() significantly improves test reliability and performance by waiting for the specific condition rather than a fixed time.

    8
    Use context manager for ActionChains to ensure proper resource management

    Use a context manager for ActionChains to ensure proper cleanup and improve code
    readability.

    examples/python/tests/actions_api/test_mouse.py [15-17]

    -ActionChains(driver) \
    -    .click_and_hold(clickable) \
    -    .perform()
    +with ActionChains(driver) as actions:
    +    actions.click_and_hold(clickable)
    +    actions.perform()
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Using a context manager for ActionChains improves code readability and ensures proper cleanup, which is a good practice for resource management.

    6

    💡 Need additional feedback ? start a PR chat

    Copy link

    netlify bot commented Nov 5, 2024

    Deploy Preview for selenium-dev ready!

    Name Link
    🔨 Latest commit 3b1f808
    🔍 Latest deploy log https://app.netlify.com/sites/selenium-dev/deploys/6729c30356798400084019b9
    😎 Deploy Preview https://deploy-preview-2042--selenium-dev.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Nov 5, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit 3b1f808)

    Action: tests (macos, stable)

    Failed stage: Run tests [❌]

    Failed test name: test_basic_options

    Failure summary:

    The action failed due to multiple test failures:

  • The test test_basic_options in tests/browsers/test_safari.py failed with a TypeError because the
    init method of SafariRemoteConnection was missing the required positional argument
    remote_server_addr.
  • The test test_enable_logging in tests/browsers/test_safari.py also failed with the same TypeError
    for the same reason.
  • Additionally, there was a PytestUnknownMarkWarning in tests/bidi/test_bidi_logging.py due to an
    unknown pytest mark driver_type.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  macOS
    ...
    
    152:  Installing collected packages: pip
    153:  Successfully installed pip-24.3.1
    154:  Install OpenSSL certificates
    155:  Collecting certifi
    156:  Using cached certifi-2024.8.30-py3-none-any.whl.metadata (2.2 kB)
    157:  Using cached certifi-2024.8.30-py3-none-any.whl (167 kB)
    158:  Installing collected packages: certifi
    159:  Successfully installed certifi-2024.8.30
    160:  ##[error][notice] A new release of pip is available: 21.1.1 -> 24.3.1
    ...
    
    310:  timeout_minutes: 20
    311:  max_attempts: 3
    312:  command: cd examples/python
    313:  pytest
    314:  
    315:  retry_wait_seconds: 10
    316:  polling_interval_seconds: 1
    317:  warning_on_retry: true
    318:  continue_on_error: false
    ...
    
    354:  tests/elements/test_file_upload.py .                                     [ 77%]
    355:  tests/interactions/test_alerts.py ...                                    [ 79%]
    356:  tests/interactions/test_print_options.py .......                         [ 84%]
    357:  tests/interactions/test_prints_page.py .                                 [ 85%]
    358:  tests/interactions/test_virtual_authenticator.py ..........              [ 93%]
    359:  tests/support/test_select_list.py ...                                    [ 95%]
    360:  tests/troubleshooting/test_logging.py .                                  [ 96%]
    361:  tests/waits/test_waits.py .....                                          [100%]
    362:  =================================== FAILURES ===================================
    ...
    
    414:  |     raise exception.with_traceback(exception.__traceback__)
    415:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pluggy/_callers.py", line 103, in _multicall
    416:  |     res = hook_impl.function(*args)
    417:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/_pytest/python.py", line 159, in pytest_pyfunc_call
    418:  |     result = testfunction(**testargs)
    419:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytest_trio/plugin.py", line 348, in wrapper
    420:  |     return run(partial(fn, **kwargs), clock=clock, instruments=instruments)
    421:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trio/_core/_run.py", line 2407, in run
    422:  |     raise runner.main_task_outcome.error
    423:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytest_trio/plugin.py", line 426, in _bootstrap_fixtures_and_run_test
    424:  |     raise test_ctx.error_list[0]
    425:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytest_trio/plugin.py", line 197, in _fixture_manager
    426:  |     nursery_fixture.cancel_scope.cancel()
    427:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trio/_core/_run.py", line 1039, in __aexit__
    428:  |     raise combined_error_from_nursery
    ...
    
    439:  |     await self.gen.athrow(typ, value, traceback)
    440:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 1081, in bidi_connection
    441:  |     yield BidiConnection(session, cdp, devtools)
    442:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", line 189, in __aexit__
    443:  |     await self.gen.athrow(typ, value, traceback)
    444:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/common/bidi/cdp.py", line 489, in open_cdp
    445:  |     await conn.aclose()
    446:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/trio/_core/_run.py", line 1039, in __aexit__
    447:  |     raise combined_error_from_nursery
    ...
    
    456:  |     driver.find_element(By.ID, "reveal").click()
    457:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", line 178, in __aexit__
    458:  |     await self.gen.__anext__()
    459:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/common/log.py", line 93, in mutation_events
    460:  |     elements: list = self.driver.find_elements(By.CSS_SELECTOR, f"*[data-__webdriver_id={payload['target']}]")
    461:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 788, in find_elements
    462:  |     return self.execute(Command.FIND_ELEMENTS, {"using": by, "value": value})["value"] or []
    463:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 380, in execute
    464:  |     self.error_handler.check_response(response)
    465:  |   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    466:  |     raise exception_class(message, screen, stacktrace)
    467:  | selenium.common.exceptions.InvalidSelectorException: Message: invalid selector
    468:  | from javascript error: {"status":32,"value":"An invalid or illegal selector was specified"}
    469:  |   (Session info: chrome=130.0.6723.59); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#invalid-selector-exception
    ...
    
    492:  +------------------------------------
    493:  ______________________________ test_basic_options ______________________________
    494:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    495:  def test_basic_options():
    496:  options = webdriver.SafariOptions()
    497:  >       driver = webdriver.Safari(options=options)
    498:  tests/browsers/test_safari.py:10: 
    499:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    500:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x104d54790>
    ...
    
    520:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    521:  if not self.service.reuse_service:
    522:  self.service.start()
    523:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    524:  >       executor = SafariRemoteConnection(
    525:  ignore_proxy=options._ignore_local_proxy,
    526:  client_config=client_config,
    527:  )
    528:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    529:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    530:  _____________________________ test_enable_logging ______________________________
    531:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    532:  def test_enable_logging():
    533:  service = webdriver.SafariService(service_args=["--diagnose"])
    534:  >       driver = webdriver.Safari(service=service)
    535:  tests/browsers/test_safari.py:19: 
    536:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    537:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x104e881f0>
    ...
    
    557:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    558:  if not self.service.reuse_service:
    559:  self.service.start()
    560:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    561:  >       executor = SafariRemoteConnection(
    562:  ignore_proxy=options._ignore_local_proxy,
    563:  client_config=client_config,
    564:  )
    565:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    566:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    ...
    
    574:  tests/bidi/test_bidi_logging.py:30
    575:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/bidi/test_bidi_logging.py:30: PytestUnknownMarkWarning: Unknown pytest.mark.driver_type - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    576:  @pytest.mark.driver_type("bidi")
    577:  tests/bidi/test_bidi_logging.py:42
    578:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/bidi/test_bidi_logging.py:42: PytestUnknownMarkWarning: Unknown pytest.mark.driver_type - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    579:  @pytest.mark.driver_type("bidi")
    580:  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
    581:  =========================== short test summary info ============================
    582:  FAILED tests/bidi/cdp/test_script.py::test_mutation - exceptiongroup.ExceptionGroup: Exceptions from Trio nursery (1 sub-exception)
    583:  FAILED tests/browsers/test_safari.py::test_basic_options - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    584:  FAILED tests/browsers/test_safari.py::test_enable_logging - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    585:  ======= 3 failed, 121 passed, 7 skipped, 4 warnings in 216.43s (0:03:36) =======
    586:  ##[warning]Attempt 1 failed. Reason: Child_process exited with error code 1
    ...
    
    610:  tests/elements/test_file_upload.py .                                     [ 77%]
    611:  tests/interactions/test_alerts.py ...                                    [ 79%]
    612:  tests/interactions/test_print_options.py .......                         [ 84%]
    613:  tests/interactions/test_prints_page.py .                                 [ 85%]
    614:  tests/interactions/test_virtual_authenticator.py ..........              [ 93%]
    615:  tests/support/test_select_list.py ...                                    [ 95%]
    616:  tests/troubleshooting/test_logging.py .                                  [ 96%]
    617:  tests/waits/test_waits.py .....                                          [100%]
    618:  =================================== FAILURES ===================================
    619:  ______________________________ test_basic_options ______________________________
    620:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    621:  def test_basic_options():
    622:  options = webdriver.SafariOptions()
    623:  >       driver = webdriver.Safari(options=options)
    624:  tests/browsers/test_safari.py:10: 
    625:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    626:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x103001b80>
    ...
    
    646:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    647:  if not self.service.reuse_service:
    648:  self.service.start()
    649:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    650:  >       executor = SafariRemoteConnection(
    651:  ignore_proxy=options._ignore_local_proxy,
    652:  client_config=client_config,
    653:  )
    654:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    655:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    656:  _____________________________ test_enable_logging ______________________________
    657:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    658:  def test_enable_logging():
    659:  service = webdriver.SafariService(service_args=["--diagnose"])
    660:  >       driver = webdriver.Safari(service=service)
    661:  tests/browsers/test_safari.py:19: 
    662:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    663:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x10301cb50>
    ...
    
    683:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    684:  if not self.service.reuse_service:
    685:  self.service.start()
    686:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    687:  >       executor = SafariRemoteConnection(
    688:  ignore_proxy=options._ignore_local_proxy,
    689:  client_config=client_config,
    690:  )
    691:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    692:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    ...
    
    700:  tests/bidi/test_bidi_logging.py:30
    701:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/bidi/test_bidi_logging.py:30: PytestUnknownMarkWarning: Unknown pytest.mark.driver_type - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    702:  @pytest.mark.driver_type("bidi")
    703:  tests/bidi/test_bidi_logging.py:42
    704:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/bidi/test_bidi_logging.py:42: PytestUnknownMarkWarning: Unknown pytest.mark.driver_type - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    705:  @pytest.mark.driver_type("bidi")
    706:  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
    707:  =========================== short test summary info ============================
    708:  FAILED tests/browsers/test_safari.py::test_basic_options - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    709:  FAILED tests/browsers/test_safari.py::test_enable_logging - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    710:  ======= 2 failed, 122 passed, 7 skipped, 4 warnings in 246.62s (0:04:06) =======
    711:  ##[warning]Attempt 2 failed. Reason: Child_process exited with error code 1
    ...
    
    735:  tests/elements/test_file_upload.py .                                     [ 77%]
    736:  tests/interactions/test_alerts.py ...                                    [ 79%]
    737:  tests/interactions/test_print_options.py .......                         [ 84%]
    738:  tests/interactions/test_prints_page.py .                                 [ 85%]
    739:  tests/interactions/test_virtual_authenticator.py ..........              [ 93%]
    740:  tests/support/test_select_list.py ...                                    [ 95%]
    741:  tests/troubleshooting/test_logging.py .                                  [ 96%]
    742:  tests/waits/test_waits.py .....                                          [100%]
    743:  =================================== FAILURES ===================================
    744:  ______________________________ test_basic_options ______________________________
    745:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    746:  def test_basic_options():
    747:  options = webdriver.SafariOptions()
    748:  >       driver = webdriver.Safari(options=options)
    749:  tests/browsers/test_safari.py:10: 
    750:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    751:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x1076f99d0>
    ...
    
    771:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    772:  if not self.service.reuse_service:
    773:  self.service.start()
    774:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    775:  >       executor = SafariRemoteConnection(
    776:  ignore_proxy=options._ignore_local_proxy,
    777:  client_config=client_config,
    778:  )
    779:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    780:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    781:  _____________________________ test_enable_logging ______________________________
    782:  @pytest.mark.skipif(sys.platform != "darwin", reason="requires Mac")
    783:  def test_enable_logging():
    784:  service = webdriver.SafariService(service_args=["--diagnose"])
    785:  >       driver = webdriver.Safari(service=service)
    786:  tests/browsers/test_safari.py:19: 
    787:  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    788:  self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x107047be0>
    ...
    
    808:  self.service.path = self.service.env_path() or DriverFinder(self.service, options).get_driver_path()
    809:  if not self.service.reuse_service:
    810:  self.service.start()
    811:  client_config = ClientConfig(remote_server_addr=self.service.service_url, keep_alive=keep_alive, timeout=120)
    812:  >       executor = SafariRemoteConnection(
    813:  ignore_proxy=options._ignore_local_proxy,
    814:  client_config=client_config,
    815:  )
    816:  E       TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    817:  /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/safari/webdriver.py:55: TypeError
    ...
    
    825:  tests/bidi/test_bidi_logging.py:30
    826:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/bidi/test_bidi_logging.py:30: PytestUnknownMarkWarning: Unknown pytest.mark.driver_type - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    827:  @pytest.mark.driver_type("bidi")
    828:  tests/bidi/test_bidi_logging.py:42
    829:  /Users/runner/work/seleniumhq.github.io/seleniumhq.github.io/examples/python/tests/bidi/test_bidi_logging.py:42: PytestUnknownMarkWarning: Unknown pytest.mark.driver_type - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    830:  @pytest.mark.driver_type("bidi")
    831:  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
    832:  =========================== short test summary info ============================
    833:  FAILED tests/browsers/test_safari.py::test_basic_options - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    834:  FAILED tests/browsers/test_safari.py::test_enable_logging - TypeError: __init__() missing 1 required positional argument: 'remote_server_addr'
    835:  ======= 2 failed, 122 passed, 7 skipped, 4 warnings in 256.67s (0:04:16) =======
    836:  ##[error]Final attempt failed. Child_process exited with error code 1
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    @VietND96 VietND96 changed the base branch from trunk to example-http-client November 5, 2024 07:50
    @VietND96 VietND96 merged commit a5d1955 into example-http-client Nov 5, 2024
    15 of 18 checks passed
    @VietND96 VietND96 deleted the fix-flaky branch November 5, 2024 07:50
    VietND96 added a commit that referenced this pull request Nov 5, 2024
    VietND96 added a commit that referenced this pull request Nov 5, 2024
    * Add examples for http_client java and python
    * Updated for other languages
    * Fix flaky test in examples python (#2042)
    
    [deploy site]
    
    ---------
    
    Signed-off-by: Viet Nguyen Duc <[email protected]>
    selenium-ci added a commit that referenced this pull request Nov 5, 2024
    * Add examples for http_client java and python
    * Updated for other languages
    * Fix flaky test in examples python (#2042)
    
    [deploy site]
    
    ---------
    
    Signed-off-by: Viet Nguyen Duc <[email protected]> 2ce6752
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant