Skip to content

TTN-23587 bare minimum changes to get the repo back in running state #16

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/
44 changes: 27 additions & 17 deletions android.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from appium.options.android import UiAutomator2Options
import time
import os

Expand Down Expand Up @@ -31,57 +32,66 @@ def startingTest():
else:
accesskey = os.environ.get("LT_ACCESS_KEY")

driver = None
try:
driver = webdriver.Remote(desired_capabilities=desired_caps, command_executor="https://" +
username+":"+accesskey+"@mobile-hub.lambdatest.com/wd/hub")
options = UiAutomator2Options()
for key, value in desired_caps.items():
options.set_capability(key, value)

driver = webdriver.Remote(
command_executor="https://" + username + ":" + accesskey + "@mobile-hub.lambdatest.com/wd/hub",
options=options
)
colorElement = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(MobileBy.ID, "com.lambdatest.proverbial:id/color")))
(AppiumBy.ID, "com.lambdatest.proverbial:id/color")))
colorElement.click()

textElement = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ID, "com.lambdatest.proverbial:id/Text")))
EC.element_to_be_clickable((AppiumBy.ID, "com.lambdatest.proverbial:id/Text")))
textElement.click()

toastElement = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(MobileBy.ID, "com.lambdatest.proverbial:id/toast")))
(AppiumBy.ID, "com.lambdatest.proverbial:id/toast")))
toastElement.click()

notification = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(MobileBy.ID, "com.lambdatest.proverbial:id/notification")))
(AppiumBy.ID, "com.lambdatest.proverbial:id/notification")))
notification.click()

geolocation = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(MobileBy.ID, "com.lambdatest.proverbial:id/geoLocation")))
(AppiumBy.ID, "com.lambdatest.proverbial:id/geoLocation")))
geolocation.click()
time.sleep(5)

driver.back()

home = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(MobileBy.ID, "com.lambdatest.proverbial:id/buttonPage")))
(AppiumBy.ID, "com.lambdatest.proverbial:id/buttonPage")))
home.click()

speedTest = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(MobileBy.ID, "com.lambdatest.proverbial:id/speedTest")))
(AppiumBy.ID, "com.lambdatest.proverbial:id/speedTest")))
speedTest.click()
time.sleep(5)

driver.back()

browser = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(MobileBy.ID, "com.lambdatest.proverbial:id/webview")))
(AppiumBy.ID, "com.lambdatest.proverbial:id/webview")))
browser.click()

url = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(MobileBy.ID, "com.lambdatest.proverbial:id/url")))
(AppiumBy.ID, "com.lambdatest.proverbial:id/url")))
url.send_keys("https://www.lambdatest.com")

find = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(MobileBy.ID, "com.lambdatest.proverbial:id/find")))
(AppiumBy.ID, "com.lambdatest.proverbial:id/find")))
find.click()
driver.quit()
except:
driver.quit()

except Exception as e:
if driver:
driver.quit()
print(f"Test failed: {e}")

startingTest()
if __name__ == "__main__":
startingTest()
53 changes: 27 additions & 26 deletions androidWeb.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
from appium import webdriver
from appium.webdriver.common.mobileby import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from appium.options.android import UiAutomator2Options
import time
import os

desired_caps = {
"deviceName": "Galaxy .*",
"platformName": "Android",
"platformVersion": "10",
"platformVersion": "14",
"isRealMobile": True,
"build": "Python Vanilla Android",
"name": "Sample Test - Python",
Expand All @@ -32,31 +30,34 @@ def startingTest():
accesskey = os.environ.get("LT_ACCESS_KEY")

try:
driver = webdriver.Remote(desired_capabilities=desired_caps, command_executor="https://" +
username+":"+accesskey+"@mobile-hub.lambdatest.com/wd/hub")
options = UiAutomator2Options()
for key, value in desired_caps.items():
options.set_capability(key, value)
driver = webdriver.Remote(
command_executor="https://" + username + ":" + accesskey + "@mobile-hub.lambdatest.com/wd/hub",
options=options
)

driver.get("https://mfml.in/api/getInfo")
colorElement = WebDriverWait(driver, 30).until(EC.element_to_be_clickable(
(By.ID, "resolution")))
colorElement.click()

textElement = WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.ID, "location")))
textElement.click()

toastElement = WebDriverWait(driver, 30).until(EC.element_to_be_clickable(
(By.ID, "details")))
toastElement.click()

notification = WebDriverWait(driver, 30).until(EC.element_to_be_clickable(
(By.ID, "timezone")))
notification.click()

time.sleep(5)
time.sleep(3)
print("Available contexts:", driver.contexts)

try:
driver.execute_script('document.getElementById("resolution").click();')
print("Clicked 'resolution' using JS.")
driver.execute_script('document.getElementById("location").click();')
print("Clicked 'location' using JS.")
driver.execute_script('document.getElementById("details").click();')
print("Clicked 'details' using JS.")
driver.execute_script('document.getElementById("timezone").click();')
print("Clicked 'timezone' using JS.")
except Exception as js_e:
print(f"JS click failed: {js_e}")

driver.quit()
except:
except Exception as e:
print(f"Test failed: {e}")
driver.quit()


startingTest()
if __name__ == "__main__":
startingTest()
80 changes: 50 additions & 30 deletions ios.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from appium.options.ios import XCUITestOptions
import time
import os

desired_caps = {
"deviceName": "iPhone 12",
"platformName": "ios",
"platformName": "iOS",
"platformVersion": "14",
"isRealMobile": True,
"app": "lt://proverbial-ios", # Enter app_url here
Expand All @@ -31,48 +32,67 @@ def startingTest():
else:
accesskey = os.environ.get("LT_ACCESS_KEY")

driver = None
try:
driver = webdriver.Remote(desired_capabilities=desired_caps, command_executor="https://" +
username+":"+accesskey+"@mobile-hub.lambdatest.com/wd/hub")
time.sleep(3)
colorElement = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "color")))
options = XCUITestOptions()
for key, value in desired_caps.items():
options.set_capability(key, value)

driver = webdriver.Remote(
command_executor="https://" + username + ":" + accesskey + "@mobile-hub.lambdatest.com/wd/hub",
options=options
)
colorElement = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(AppiumBy.ACCESSIBILITY_ID, "color")))
colorElement.click()

textElement = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text")))
EC.element_to_be_clickable((AppiumBy.ACCESSIBILITY_ID, "Text")))
textElement.click()
toastElement = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "toast")))

toastElement = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(AppiumBy.ACCESSIBILITY_ID, "toast")))
toastElement.click()
notification = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "notification")))

notification = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(AppiumBy.ACCESSIBILITY_ID, "notification")))
notification.click()
time.sleep(3)
geolocation = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "geoLocation")))

geolocation = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(AppiumBy.ACCESSIBILITY_ID, "geoLocation")))
geolocation.click()
time.sleep(5)
time.sleep(15)

driver.back()
home = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Home")))

home = WebDriverWait(driver, 30, poll_frequency=1, ignored_exceptions=[Exception]).until(
EC.presence_of_element_located((AppiumBy.ACCESSIBILITY_ID, "Home"))
)
home.click()
speedTest = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "speedTest")))

speedTest = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(AppiumBy.ACCESSIBILITY_ID, "speedTest")))
speedTest.click()
time.sleep(5)

driver.back()
browser = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Browser")))

browser = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(AppiumBy.ACCESSIBILITY_ID, "Browser")))
browser.click()
url = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "url")))

url = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(AppiumBy.ACCESSIBILITY_ID, "url")))
url.send_keys("https://www.lambdatest.com")
find = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((MobileBsy.ACCESSIBILITY_ID, "find")))

find = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(AppiumBy.ACCESSIBILITY_ID, "find")))
find.click()
driver.quit()
except:
driver.quit()

except Exception as e:
if driver:
driver.quit()
print(f"Test failed: {e}")

startingTest()
if __name__ == "__main__":
startingTest()
60 changes: 40 additions & 20 deletions iosWeb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from appium import webdriver
from appium.webdriver.common.mobileby import By
from appium.options.ios import XCUITestOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
Expand Down Expand Up @@ -30,28 +31,47 @@ def startingTest():
else:
accesskey = os.environ.get("LT_ACCESS_KEY")

driver = webdriver.Remote(desired_capabilities=desired_caps, command_executor="https://" +
username+":"+accesskey+"@mobile-hub.lambdatest.com/wd/hub")
try:
options = XCUITestOptions()
for key, value in desired_caps.items():
options.set_capability(key, value)
driver = webdriver.Remote(
command_executor="https://" + username + ":" + accesskey + "@mobile-hub.lambdatest.com/wd/hub",
options=options
)

driver.get("https://mfml.in/api/getInfo")
driver.get("https://mfml.in/api/getInfo")
time.sleep(3)
print("Available contexts:", driver.contexts)

# Wait for and click resolution
resolution = WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.ID, "resolution")))
resolution.click()
print("Clicked 'resolution' using Selenium.")

colorElement = WebDriverWait(driver, 30).until(EC.element_to_be_clickable(
(By.ID, "resolution")))
colorElement.click()
# Wait for and click location
location = WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.ID, "location")))
location.click()
print("Clicked 'location' using Selenium.")

textElement = WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.ID, "location")))
textElement.click()
# Wait for and click details
details = WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.ID, "details")))
details.click()
print("Clicked 'details' using Selenium.")

toastElement = WebDriverWait(driver, 30).until(EC.element_to_be_clickable(
(By.ID, "details")))
toastElement.click()
# Wait for and click timezone
timezone = WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.ID, "timezone")))
timezone.click()
print("Clicked 'timezone' using Selenium.")

notification = WebDriverWait(driver, 30).until(EC.element_to_be_clickable(
(By.ID, "timezone")))
notification.click()
time.sleep(5)
driver.quit()
driver.quit()
except Exception as e:
print(f"Test failed: {e}")
driver.quit()


startingTest()
if __name__ == "__main__":
startingTest()
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Appium-Python-Client==0.52;python_version < '3.0'
Appium-Python-Client==1.0.2;python_version >= '3.0'
Appium-Python-Client==3.1.1
selenium==4.18.1