Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
appWorkingDir tests (#13)
Browse files Browse the repository at this point in the history
* some tests for the feature

* fix test order

* Better docs
  • Loading branch information
Wolfe1 committed Aug 4, 2022
1 parent bcf18ce commit 10d1624
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/DesktopLibraryDocumentation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/MobileLibraryDocumentation.html

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion samples/WinAppDriver-DesktopTests.robot
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Switch Application By Name or Locator
Switch Application Main

Switch Application Multiple Desktop
# Open Application creates a new desktop session for this isnatnce, useful when running tests on multiple computers
# Open Application creates a new desktop session for this instance, useful when running tests on multiple computers
Open Application ${REMOTE_URL} platformName=Windows deviceName=Windows app=${Notepad} alias=Notepad desktop_alias=Desktop2
Switch Application Desktop
Switch Application Desktop2
Expand All @@ -196,6 +196,10 @@ Switch Application Multiple Desktop
# Switch back to the main window to make sure it gets closed
Switch Application Main

Working Directory Test
[Setup] Open Application ${REMOTE_URL} platformName=Windows deviceName=Windows app=C:/Windows/notepad.exe appWorkingDir=C:/Windows
Switch Application By Name ${REMOTE_URL} Notepad exact_match=False appWorkingDir=C:/Windows/System32

Switch To Desktop Test
[Setup] Driver Setup
Switch Application Desktop
Expand Down
11 changes: 10 additions & 1 deletion src/ApplicationLibrary/DesktopLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DesktopLibrary(AppiumLibrary):
The ``image`` locator strategy can only be used with Appium v1.18.0 or higher.
Example tests using the windows calculator are located in the tests directory.
Example tests using the windows calculator and notepad are located in the tests directory.
= Use of Wait Keywords =
Expand Down Expand Up @@ -257,6 +257,8 @@ def open_application(self, remote_url, alias=None, window_name=None, splash_dela
If your application has a splash screen please supply the window name of the final window that will appear.
For the capabilities of appium server and Windows please check http://appium.io/docs/en/drivers/windows
Desired capabilities for WinAppDriver (platformName, appArguments, app, etc) can be found here: https://github.com/appium/appium-windows-driver#usage
| *Option* | *Man.* | *Description* |
| remote_url | Yes | WinAppDriver or Appium server url |
| alias | No | Alias |
Expand Down Expand Up @@ -353,6 +355,9 @@ def switch_application_by_name(self, remote_url, window_name, alias=None, timeou
"""Switches to a currently opened window by ``window_name``.
For the capabilities of appium server and Windows,
Please check http://appium.io/docs/en/drivers/windows
Desired capabilities for WinAppDriver (platformName, appArguments, app, etc) can be found here: https://github.com/appium/appium-windows-driver#usage
| *Option* | *Man.* | *Description* |
| remote_url | Yes | WinAppDriver or Appium server url |
| window_name | Yes | Window name you wish to attach |
Expand Down Expand Up @@ -422,6 +427,10 @@ def switch_application_by_locator(self, remote_url, locator=None, alias=None, ti
For the capabilities of appium server and Windows,
Please check http://appium.io/docs/en/drivers/windows
Desired capabilities for WinAppDriver (platformName, appArguments, app, etc) can be found here: https://github.com/appium/appium-windows-driver#usage
| *Option* | *Man.* | *Description* |
| remote_url | Yes | WinAppDriver or Appium server url |
| locator | Yes | Locator for window name you wish to attach |
Expand Down
7 changes: 7 additions & 0 deletions test/Desktop/test_desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ def test_open_application_successful(self):
dl.open_application('remote_url')
self.assertTrue(dl._cache.current)

def test_open_application_with_working_dir_successful(self):
dl = DesktopLibrary()
webdriver.Remote = WebdriverRemoteMock
self.assertFalse(dl._cache.current)
dl.open_application('remote_url', appWorkingDir='C:/Windows/System32')
self.assertTrue(dl._cache.current)

def test_open_application_failure(self):
dl = DesktopLibrary()
dl._open_desktop_session = MagicMock()
Expand Down

0 comments on commit 10d1624

Please sign in to comment.