diff --git a/appium/webdriver/extensions/screen_record.py b/appium/webdriver/extensions/screen_record.py index 8b692577..0b7f1bc7 100644 --- a/appium/webdriver/extensions/screen_record.py +++ b/appium/webdriver/extensions/screen_record.py @@ -73,9 +73,9 @@ def start_recording_screen(self, **options): but doing so results in larger movie files. Returns: - bytes: Base-64 encoded content of the recorded media file or an empty string - if the file has been successfully uploaded to a remote location - (depends on the actual `remotePath` value). + bytes: Base-64 encoded content of the recorded media + if `stop_recording_screen` isn't called after previous `start_recording_screen`. + Otherwise returns an empty string. """ if 'password' in options: options['pass'] = options['password'] @@ -101,7 +101,7 @@ def stop_recording_screen(self, **options): Only has an effect if `remotePath` is set. Returns: - bytes:Base-64 encoded content of the recorded media file or an empty string + bytes: Base-64 encoded content of the recorded media file or an empty string if the file has been successfully uploaded to a remote location (depends on the actual `remotePath` value). """ diff --git a/test/unit/webdriver/device/app_test.py b/test/unit/webdriver/app_test.py similarity index 97% rename from test/unit/webdriver/device/app_test.py rename to test/unit/webdriver/app_test.py index 4b4616aa..e940ffec 100644 --- a/test/unit/webdriver/device/app_test.py +++ b/test/unit/webdriver/app_test.py @@ -22,7 +22,7 @@ ) -class TestApp(object): +class TestWebDriverApp(object): @httpretty.activate def test_reset(self): diff --git a/test/unit/webdriver/device/context_test.py b/test/unit/webdriver/context_test.py similarity index 95% rename from test/unit/webdriver/device/context_test.py rename to test/unit/webdriver/context_test.py index 9683859d..150fddac 100644 --- a/test/unit/webdriver/device/context_test.py +++ b/test/unit/webdriver/context_test.py @@ -17,7 +17,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command -class TestWebDriverDeviceContext(object): +class TestWebDriverContext(object): @httpretty.activate def test_get_contexts(self): diff --git a/test/unit/webdriver/device/activities_test.py b/test/unit/webdriver/device/activities_test.py index 752574db..01c0210e 100644 --- a/test/unit/webdriver/device/activities_test.py +++ b/test/unit/webdriver/device/activities_test.py @@ -21,7 +21,7 @@ ) -class TestWebDriverDeviceActivities(object): +class TestWebDriverActivities(object): @httpretty.activate def test_start_activity(self): diff --git a/test/unit/webdriver/device/clipboard_test.py b/test/unit/webdriver/device/clipboard_test.py index ce7fa5c1..22c80dbe 100644 --- a/test/unit/webdriver/device/clipboard_test.py +++ b/test/unit/webdriver/device/clipboard_test.py @@ -24,7 +24,7 @@ ) -class TestWebDriverDeviceClipboard(object): +class TestWebDriverClipboard(object): @httpretty.activate def test_set_clipboard_with_url(self): diff --git a/test/unit/webdriver/device/display.py b/test/unit/webdriver/device/display_test.py similarity index 100% rename from test/unit/webdriver/device/display.py rename to test/unit/webdriver/device/display_test.py diff --git a/test/unit/webdriver/device/fingerprint_test.py b/test/unit/webdriver/device/fingerprint_test.py index ac9f033d..cd553003 100644 --- a/test/unit/webdriver/device/fingerprint_test.py +++ b/test/unit/webdriver/device/fingerprint_test.py @@ -21,7 +21,7 @@ ) -class TestWebDriverDeviceFingerprint(object): +class TestWebDriverFingerprint(object): @httpretty.activate def test_finger_print(self): diff --git a/test/unit/webdriver/device/lock_test.py b/test/unit/webdriver/device/lock_test.py index a0c19421..c030277e 100644 --- a/test/unit/webdriver/device/lock_test.py +++ b/test/unit/webdriver/device/lock_test.py @@ -21,7 +21,7 @@ ) -class TestWebDriverDeviceLock(object): +class TestWebDriverLock(object): @httpretty.activate def test_lock(self): diff --git a/test/unit/webdriver/device/shake_test.py b/test/unit/webdriver/device/shake_test.py index c5c378ac..7604bec2 100644 --- a/test/unit/webdriver/device/shake_test.py +++ b/test/unit/webdriver/device/shake_test.py @@ -19,7 +19,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command -class TestWebDriverDeviceShake(object): +class TestWebDriverShake(object): @httpretty.activate def test_shake(self): diff --git a/test/unit/webdriver/device/execute_driver_test.py b/test/unit/webdriver/execute_driver_test.py similarity index 98% rename from test/unit/webdriver/device/execute_driver_test.py rename to test/unit/webdriver/execute_driver_test.py index 43d9b3ee..3f438c52 100644 --- a/test/unit/webdriver/device/execute_driver_test.py +++ b/test/unit/webdriver/execute_driver_test.py @@ -23,7 +23,7 @@ ) -class TestWebDriverDeviceActivities(object): +class TestWebDriverExecuteDriver(object): @httpretty.activate def test_batch(self): diff --git a/test/unit/webdriver/device/network_test.py b/test/unit/webdriver/network_test.py similarity index 100% rename from test/unit/webdriver/device/network_test.py rename to test/unit/webdriver/network_test.py diff --git a/test/unit/webdriver/device/performance_test.py b/test/unit/webdriver/performance_test.py similarity index 100% rename from test/unit/webdriver/device/performance_test.py rename to test/unit/webdriver/performance_test.py diff --git a/test/unit/webdriver/screen_record_test.py b/test/unit/webdriver/screen_record_test.py new file mode 100644 index 00000000..1f0d8e83 --- /dev/null +++ b/test/unit/webdriver/screen_record_test.py @@ -0,0 +1,48 @@ +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import httpretty + +from test.unit.helper.test_helper import ( + android_w3c_driver, + appium_command, + get_httpretty_request_body +) + + +class TestWebDriverScreenRecord(object): + + @httpretty.activate + def test_start_recording_screen(self): + driver = android_w3c_driver() + httpretty.register_uri( + httpretty.POST, + appium_command('/session/1234567890/appium/start_recording_screen'), + ) + assert driver.start_recording_screen(user='userA', password='12345') is None + + d = get_httpretty_request_body(httpretty.last_request()) + assert d['options']['user'] == 'userA' + assert d['options']['pass'] == '12345' + assert 'password' not in d['options'].keys() + + @httpretty.activate + def test_stop_recording_screen(self): + driver = android_w3c_driver() + httpretty.register_uri( + httpretty.POST, + appium_command('/session/1234567890/appium/stop_recording_screen'), + body='{"value": "b64_video_data"}' + ) + assert driver.stop_recording_screen(user='userA', password='12345') == 'b64_video_data' + + d = get_httpretty_request_body(httpretty.last_request()) + assert d['options']['user'] == 'userA' + assert d['options']['pass'] == '12345' + assert 'password' not in d['options'].keys() diff --git a/test/unit/webdriver/device/settings_test.py b/test/unit/webdriver/settings_test.py similarity index 100% rename from test/unit/webdriver/device/settings_test.py rename to test/unit/webdriver/settings_test.py