Skip to content

Commit b9a1940

Browse files
authored
Merge pull request #485 from seleniumbase/improve-demo-mode-on-mobile
Improve demo-mode on mobile device tests
2 parents 53c3002 + 0a80d3a commit b9a1940

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

examples/test_skype_site.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
This is a mobile device test for Chromium-based browsers (such as MS Edge)
3+
Usage: pytest test_skype_site.py --mobile --browser=edge
4+
5+
Default mobile settings for User Agent and Device Metrics if not specifed:
6+
User Agent: --agent="Mozilla/5.0 (Linux; Android 9; Pixel 3 XL)"
7+
CSS Width, CSS Height, Pixel-Ratio: --metrics="411,731,3"
8+
"""
9+
from seleniumbase import BaseCase
10+
11+
12+
class SkypeWebsiteTestClass(BaseCase):
13+
14+
def test_skype_website_on_mobile(self):
15+
if not self.mobile_emulator:
16+
print("\n This test is only for mobile devices / emulators!")
17+
print(" (Usage: '--mobile' with a Chromium-based browser.)")
18+
self.skip_test("Please rerun this test using '--mobile!'!")
19+
self.open("https://www.skype.com/en/")
20+
self.assert_text("Install Skype", "div.appInfo")
21+
self.highlight("div.appBannerContent")
22+
self.highlight('[itemprop="url"]')
23+
self.highlight("h1")
24+
self.highlight_click('[title="Download Skype"]')
25+
self.assert_element('[aria-label="Microsoft"]')
26+
self.assert_text("Download Skype", "h1")
27+
self.highlight("div.appBannerContent")
28+
self.highlight("h1")
29+
self.assert_text("Skype for Mobile", "h2")
30+
self.highlight("h2")
31+
self.highlight("#get-skype-0")
32+
self.highlight_click('[title*="Select from list"]')
33+
self.highlight('[data-bi-id*="android"]')
34+
self.highlight('[data-bi-id*="ios"]')
35+
self.highlight('[data-bi-id*="windows10"]')

seleniumbase/config/proxy_list.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
PROXY_LIST = {
2222
"example1": "52.187.121.7:3128", # (Example) - set your own proxy here
2323
"example2": "193.32.6.6:8080", # (Example) - set your own proxy here
24-
"example3": "185.204.208.78:8080", # (Example) - set your own proxy here
2524
"proxy1": None,
2625
"proxy2": None,
2726
"proxy3": None,

seleniumbase/fixtures/js_utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import requests
77
import time
88
from selenium.common.exceptions import WebDriverException
9+
from seleniumbase import config as sb_config
910
from seleniumbase.common import decorators
1011
from seleniumbase.config import settings
1112
from seleniumbase.core import style_sheet
@@ -542,7 +543,12 @@ def post_messenger_success_message(driver, message, msg_dur):
542543
msg_dur = settings.DEFAULT_MESSAGE_DURATION
543544
msg_dur = float(msg_dur)
544545
try:
545-
set_messenger_theme(driver, theme="future", location="bottom_right")
546+
theme = "future"
547+
location = "bottom_right"
548+
if sb_config.mobile_emulator:
549+
theme = "block"
550+
location = "top_center"
551+
set_messenger_theme(driver, theme=theme, location=location)
546552
post_message(
547553
driver, message, msg_dur, style="success")
548554
time.sleep(msg_dur + 0.07)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
setup(
4747
name='seleniumbase',
48-
version='1.34.23',
48+
version='1.34.24',
4949
description='Fast, Easy, and Reliable Browser Automation & Testing.',
5050
long_description=long_description,
5151
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)