Skip to content

Add screenrecord unittest #426

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

Merged
merged 5 commits into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions appium/webdriver/extensions/screen_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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).
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)


class TestApp(object):
class TestWebDriverApp(object):

@httpretty.activate
def test_reset(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/unit/webdriver/device/activities_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)


class TestWebDriverDeviceActivities(object):
class TestWebDriverActivities(object):

@httpretty.activate
def test_start_activity(self):
Expand Down
2 changes: 1 addition & 1 deletion test/unit/webdriver/device/clipboard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)


class TestWebDriverDeviceClipboard(object):
class TestWebDriverClipboard(object):

@httpretty.activate
def test_set_clipboard_with_url(self):
Expand Down
2 changes: 1 addition & 1 deletion test/unit/webdriver/device/fingerprint_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)


class TestWebDriverDeviceFingerprint(object):
class TestWebDriverFingerprint(object):

@httpretty.activate
def test_finger_print(self):
Expand Down
2 changes: 1 addition & 1 deletion test/unit/webdriver/device/lock_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)


class TestWebDriverDeviceLock(object):
class TestWebDriverLock(object):

@httpretty.activate
def test_lock(self):
Expand Down
2 changes: 1 addition & 1 deletion test/unit/webdriver/device/shake_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
)


class TestWebDriverDeviceActivities(object):
class TestWebDriverExecuteDriver(object):

@httpretty.activate
def test_batch(self):
Expand Down
48 changes: 48 additions & 0 deletions test/unit/webdriver/screen_record_test.py
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[memo] should be empty string


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()