Skip to content

Commit

Permalink
fixes (#6)
Browse files Browse the repository at this point in the history
* first commit by codeSolicitor

* environment variable fix

* fixing environment variable

* adding fixes
  • Loading branch information
codeSolicitor authored Jan 5, 2023
1 parent d9e00d0 commit f608a6a
Show file tree
Hide file tree
Showing 17 changed files with 162 additions and 25 deletions.
Binary file added .DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,11 @@ dmypy.json

# Pyre type checker
.pyre/
/.idea/
/report.html
/log.html

/output.xml
log.html
report.html
output.xml
18 changes: 9 additions & 9 deletions Makefile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
run_all_in_parallel:
make -j test_Android1 test_Android2 test_iOS1 test_iOS2
make -j test_GalaxyS20Plus #test_GalaxyS10

test_Android1:
robot --variable version:10 --variable platform:Android --variable deviceName:"Galaxy S20" --variable isRealMobile:true --variable visual:true --variable network:false --variable console:false --variable app:"lt://" Tests/Android.robot
test_GalaxyS20Plus:
robot --variable version:10 --variable platformName:Android --variable deviceName:"Galaxy S20" --variable isRealMobile:true --variable visual:false --variable network:false --variable console:false Tests/Android.robot

test_Android2:
robot --variable version:10 --variable platform:Android --variable deviceName:"Galaxy S10" --variable isRealMobile:true --variable visual:true --variable network:false --variable console:false --variable app:"lt://" Tests/Android.robot
test_GalaxyS10:
robot --variable version:10 --variable platformName:Android --variable deviceName:"Galaxy S10" --variable isRealMobile:true --variable visual:false --variable network:false --variable console:false Tests/Android.robot

test_iOS1:
robot --variable version:14 --variable platform:iOS --variable deviceName:"iPhone 11" --variable isRealMobile:true --variable visual:true --variable network:false --variable console:false --variable app:"lt://" Tests/IOS.robot
test_Android1:
robot --variable version:10 --variable platformName:android --variable deviceName:"Galaxy S20" --variable isRealMobile:true --variable visual:false --variable network:false --variable console:false Tests/Android.robot

test_iOS2:
robot --variable version:14 --variable platform:iOS --variable deviceName:"iPhone 12" --variable isRealMobile:true --variable visual:true --variable network:false --variable console:false --variable app:"lt://" Tests/IOS.robot
test_ios1:
robot --variable version:14 --variable platformName:ios --variable deviceName:"iPhone 12" --variable isRealMobile:true --variable visual:false --variable network:false --variable console:false Tests/IOS.robot
Empty file modified README.md
100644 → 100755
Empty file.
31 changes: 31 additions & 0 deletions Resources/AndroidCommon.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*** Settings ***
Library AppiumLibrary

*** Variables ***

@{_tmp}
... platformName: ${platformName}
... platformVersion: ${version}
... deviceName: ${deviceName}
... visual: ${visual}
... network: ${network}
... isRealMobile: ${isRealMobile}
... name: 'RobotFramework Lambda Test'
... app: 'lt://proverbial-android'

#${BROWSER} ${ROBOT_BROWSER}
${CAPABILITIES} ${EMPTY.join(${_tmp})}
${REMOTE_URL} https://%{LT_USERNAME}:%{LT_ACCESS_KEY}@mobile-hub.lambdatest.com/wd/hub
#${app} lt://APP100201841649255527998398
${app} lt://proverbial-android
${TIMEOUT} 3000

*** Keywords ***

Open test app
[Timeout] ${TIMEOUT}
#Open Application ${REMOTE_URL} platformName=${platformName} platformVersion=${version} deviceName=${deviceName} visual=${visual} network=${network} isRealMobile=${isRealMobile} name="RobotFramework Lambda Test"
Open Application ${REMOTE_URL} platformName=${platformName} platformVersion=${version} deviceName=${deviceName} visual=${visual} network=${network} isRealMobile=${isRealMobile} app=${app} name="RobotFramework Lambda Test"

Close test app
Close All Applications
27 changes: 21 additions & 6 deletions Resources/Common.robot
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,29 @@ Library AppiumLibrary

*** Variables ***

${username} username
${accesskey} accesskey
${REMOTE_URL} https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub
${TIMEOUT} 3000
@{_tmp}
... platformName: ${platformName}
... platformVersion: ${version}
... deviceName: ${deviceName}
... visual: ${visual}
... network: ${network}
... isRealMobile: ${isRealMobile}
... name: 'RobotFramework Lambda Test'
... app: 'lt://proverbial-ios'

#${BROWSER} ${ROBOT_BROWSER}
${CAPABILITIES} ${EMPTY.join(${_tmp})}
${REMOTE_URL} https://%{LT_USERNAME}:%{LT_ACCESS_KEY}@mobile-hub.lambdatest.com/wd/hub
#${app} lt://APP100201841649255527998398
${app} lt://proverbial-ios
${TIMEOUT} 3000

*** Keywords ***

Open test app
Open Application ${REMOTE_URL} platformName=${platform} platformVersion=${version} deviceName=${deviceName} visual=${visual} network=${network} isRealMobile=${isRealMobile} app=${app} name=Robot Framework Sample Test build=Appium Python Robot
[Timeout] ${TIMEOUT}
#Open Application ${REMOTE_URL} platformName=${platformName} platformVersion=${version} deviceName=${deviceName} visual=${visual} network=${network} isRealMobile=${isRealMobile} name="RobotFramework Lambda Test"
Open Application ${REMOTE_URL} platformName=${platformName} platformVersion=${version} deviceName=${deviceName} visual=${visual} network=${network} isRealMobile=${isRealMobile} app=${app} name="RobotFramework Lambda Test"

Close test app
Close Application
Close All Applications
16 changes: 16 additions & 0 deletions Resources/LambdaTestStatus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
from robot.libraries.BuiltIn import BuiltIn

def report_lambdatest_status(name, status):
selenium = BuiltIn().get_library_instance('Selenium2Library')

# Mark test status pass/failed
lambda_status = "passed" if status=="PASS" else "failed"
lambda_status_script = 'lambda-status={}'.format(lambda_status)
selenium.execute_javascript(lambda_status_script)
# Update test name
lambda_status_script = 'lambda-name={}'.format(name)
selenium.execute_javascript(lambda_status_script)



6 changes: 3 additions & 3 deletions Tests/Android.robot
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
*** Settings ***

Resource ../Resources/Common.robot
Resource ../Resources/AndroidCommon.robot

Test Setup Common.Open test app
Test Teardown Common.Close test app
Test Setup AndroidCommon.Open test app
Test Teardown AndroidCommon.Close test app

*** Variables ***
${TIMEOUT} 3000
Expand Down
19 changes: 14 additions & 5 deletions Tests/IOS.robot
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@ ${TIMEOUT} 3000

Example of connecting to Lambdatest via Robot Framework
[Timeout] ${TIMEOUT}
Click element id=color
Click element id=Text
Click element id=toast
Click element id=notification
Click element id=geoLocation
Click button id=color
Click button id=Text
Click button id=toast

Click button id=notification
Click button id=geoLocation
sleep ${delay}
Click button id=Speed Test
sleep ${delay}

Click button id='start speed test - connection type multi'
sleep ${delay}
Click button id=Browser
Input Text id=Search https://lambdatest.com
Click button id=find
Empty file modified make.exe
100644 → 100755
Empty file.
58 changes: 58 additions & 0 deletions output.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<robot generator="Robot 6.0.1 (Python 3.10.8 on darwin)" generated="20230105 16:02:28.538" rpa="false" schemaversion="3">
<suite id="s1" name="IOS" source="/Users/ankitagarwal/Documents/Code-Snippet/LT-appium-python-robot/Tests/IOS.robot">
<test id="s1-t1" name="Example of connecting to Lambdatest via Robot Framework" line="13">
<kw name="Open test app" library="Common" type="SETUP">
<kw name="Open Application" library="AppiumLibrary">
<arg>${REMOTE_URL}</arg>
<arg>platformName=${platformName}</arg>
<arg>platformVersion=${version}</arg>
<arg>deviceName=${deviceName}</arg>
<arg>visual=${visual}</arg>
<arg>network=${network}</arg>
<arg>isRealMobile=${isRealMobile}</arg>
<arg>app=${app}</arg>
<arg>name="RobotFramework Lambda Test"</arg>
<doc>Opens a new application to given Appium server.
Capabilities of appium server, Android and iOS,
Please check https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md
| *Option* | *Man.* | *Description* |
| remote_url | Yes | Appium server url |
| alias | no | alias |</doc>
<kw name="Capture Page Screenshot" library="AppiumLibrary">
<doc>Takes a screenshot of the current page and embeds it into the log.</doc>
<status status="FAIL" starttime="20230105 16:02:43.680" endtime="20230105 16:02:43.681"/>
</kw>
<msg timestamp="20230105 16:02:43.682" level="WARN">Keyword 'Capture Page Screenshot' could not be run on failure: Execution terminated by signal</msg>
<status status="FAIL" starttime="20230105 16:02:28.623" endtime="20230105 16:02:43.682"/>
</kw>
<timeout value="50 minutes"/>
<status status="FAIL" starttime="20230105 16:02:28.623" endtime="20230105 16:02:43.682"/>
</kw>
<kw name="Close test app" library="Common" type="TEARDOWN">
<kw name="Close All Applications" library="AppiumLibrary">
<doc>Closes all open applications.</doc>
<status status="PASS" starttime="20230105 16:02:43.683" endtime="20230105 16:02:43.683"/>
</kw>
<status status="PASS" starttime="20230105 16:02:43.682" endtime="20230105 16:02:43.683"/>
</kw>
<timeout value="50 minutes"/>
<status status="FAIL" starttime="20230105 16:02:28.623" endtime="20230105 16:02:43.683">Setup failed:
Execution terminated by signal</status>
</test>
<status status="FAIL" starttime="20230105 16:02:28.539" endtime="20230105 16:02:43.684"/>
</suite>
<statistics>
<total>
<stat pass="0" fail="1" skip="0">All Tests</stat>
</total>
<tag>
</tag>
<suite>
<stat pass="0" fail="1" skip="0" id="s1" name="IOS">IOS</stat>
</suite>
</statistics>
<errors>
<msg timestamp="20230105 16:02:43.682" level="WARN">Keyword 'Capture Page Screenshot' could not be run on failure: Execution terminated by signal</msg>
</errors>
</robot>
4 changes: 2 additions & 2 deletions requirements.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
selenium
selenium==3.141.0
robotframework
robotframework-appiumlibrary
robotframework-appiumlibrary
Binary file added tutorial-images/logo.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tutorial-images/rfpt.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tutorial-images/rfsample.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tutorial-images/rfst.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tutorial-images/tn.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f608a6a

Please sign in to comment.