Merge pull request #485 from seleniumbase/improve-demo-mode-on-mobile

Improve demo-mode on mobile device tests
This commit is contained in:
Michael Mintz 2020-01-19 02:29:17 -05:00 committed by GitHub
commit b9a1940d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 3 deletions

35
examples/test_skype_site.py Executable file
View File

@ -0,0 +1,35 @@
"""
This is a mobile device test for Chromium-based browsers (such as MS Edge)
Usage: pytest test_skype_site.py --mobile --browser=edge
Default mobile settings for User Agent and Device Metrics if not specifed:
User Agent: --agent="Mozilla/5.0 (Linux; Android 9; Pixel 3 XL)"
CSS Width, CSS Height, Pixel-Ratio: --metrics="411,731,3"
"""
from seleniumbase import BaseCase
class SkypeWebsiteTestClass(BaseCase):
def test_skype_website_on_mobile(self):
if not self.mobile_emulator:
print("\n This test is only for mobile devices / emulators!")
print(" (Usage: '--mobile' with a Chromium-based browser.)")
self.skip_test("Please rerun this test using '--mobile!'!")
self.open("https://www.skype.com/en/")
self.assert_text("Install Skype", "div.appInfo")
self.highlight("div.appBannerContent")
self.highlight('[itemprop="url"]')
self.highlight("h1")
self.highlight_click('[title="Download Skype"]')
self.assert_element('[aria-label="Microsoft"]')
self.assert_text("Download Skype", "h1")
self.highlight("div.appBannerContent")
self.highlight("h1")
self.assert_text("Skype for Mobile", "h2")
self.highlight("h2")
self.highlight("#get-skype-0")
self.highlight_click('[title*="Select from list"]')
self.highlight('[data-bi-id*="android"]')
self.highlight('[data-bi-id*="ios"]')
self.highlight('[data-bi-id*="windows10"]')

View File

@ -21,7 +21,6 @@ you can try finding one from one of following sites:
PROXY_LIST = {
"example1": "52.187.121.7:3128", # (Example) - set your own proxy here
"example2": "193.32.6.6:8080", # (Example) - set your own proxy here
"example3": "185.204.208.78:8080", # (Example) - set your own proxy here
"proxy1": None,
"proxy2": None,
"proxy3": None,

View File

@ -6,6 +6,7 @@ import re
import requests
import time
from selenium.common.exceptions import WebDriverException
from seleniumbase import config as sb_config
from seleniumbase.common import decorators
from seleniumbase.config import settings
from seleniumbase.core import style_sheet
@ -542,7 +543,12 @@ def post_messenger_success_message(driver, message, msg_dur):
msg_dur = settings.DEFAULT_MESSAGE_DURATION
msg_dur = float(msg_dur)
try:
set_messenger_theme(driver, theme="future", location="bottom_right")
theme = "future"
location = "bottom_right"
if sb_config.mobile_emulator:
theme = "block"
location = "top_center"
set_messenger_theme(driver, theme=theme, location=location)
post_message(
driver, message, msg_dur, style="success")
time.sleep(msg_dur + 0.07)

View File

@ -45,7 +45,7 @@ if sys.argv[-1] == 'publish':
setup(
name='seleniumbase',
version='1.34.23',
version='1.34.24',
description='Fast, Easy, and Reliable Browser Automation & Testing.',
long_description=long_description,
long_description_content_type='text/markdown',