@@ -12,6 +12,9 @@ public class SmartuiAppIos {
12
12
: System .getenv ("LT_USERNAME" );
13
13
public static String accessKey = System .getenv ("LT_ACCESS_KEY" ) == null ? "YOUR_LT_ACCESS_KEY" // Add accessKey here
14
14
: System .getenv ("LT_ACCESS_KEY" );
15
+ public static String projectToken = System .getenv ("PROJECT_TOKEN" ) == null ? "YOUR_PROJECT_TOKEN" // Add project token here
16
+ : System .getenv ("PROJECT_TOKEN" );
17
+
15
18
16
19
public static void main (String [] args ) throws Exception {
17
20
DesiredCapabilities caps = new DesiredCapabilities ();
@@ -28,30 +31,24 @@ public static void main(String[] args) throws Exception {
28
31
ltOptions .put ("smartUI.project" , "Real-Device-Project-iOS" ); // Enter your smartUI Project name
29
32
caps .setCapability ("lt:options" , ltOptions );
30
33
34
+ Map <String , String > startConfig = new HashMap <>();
35
+ startConfig .put ("projectToken" , projectToken );
31
36
32
37
AppiumDriver driver = new AppiumDriver (
33
38
new URL ("https://" +userName +":" +accessKey +"@mobile-hub.lambdatest.com/wd/hub" ), caps );
34
- String projectToken = "<<enter-project-token>>" ;
35
- String buildName = "<<enter-your-cutomised-build-name>>" ;
36
39
37
40
SmartUIAppSnapshot smartUIAppSnapshot = new SmartUIAppSnapshot ();
38
- Map <String , String > startConfig = new HashMap <>();
39
- startConfig .put ("projectToken" , projectToken );
40
- startConfig .put ("buildName" , buildName );
41
-
42
41
Map <String , String > screenshotConfig = new HashMap <>();
43
42
screenshotConfig .put ("deviceName" ,"iPhone 16" );
44
43
screenshotConfig .put ("platform" ,"iOS 17" );
45
44
try {
46
- smartUIAppSnapshot .start (startConfig ); //We can also call start w/o any param, values set from env vars
45
+ smartUIAppSnapshot .start (startConfig ); //We can also call start w/o options it'll take projectToken from env var
47
46
driver .findElement (AppiumBy .id ("color" )).click ();
48
47
smartUIAppSnapshot .smartuiAppSnapshot (driver , "screenshot1" , screenshotConfig );
49
48
Thread .sleep (3000 );
50
-
51
49
driver .navigate ().back ();
52
50
Thread .sleep (1000 );
53
-
54
- driver .findElement (AppiumBy .id ("com.lambdatest.proverbial:id/Text" )).click ();
51
+ driver .findElement (AppiumBy .id ("Text" )).click ();
55
52
smartUIAppSnapshot .smartuiAppSnapshot (driver , "screenshot2" , screenshotConfig );
56
53
Thread .sleep (3000 );
57
54
} catch (Exception e ) {
0 commit comments