@@ -398,230 +398,6 @@ driver = webdriver.Remote(
398398</TabItem >
399399</Tabs >
400400
401- </TabItem >
402- </Tabs >
403- <TabItem value =' python ' label =' Python ' >
404-
405- ``` python title="Example: Python Configuration with SmartUI Hooks and GitLab"
406- from appium import webdriver
407- import os
408-
409- # Get GitLab URL from environment
410- github_url = os.getenv(" GITHUB_URL" )
411-
412- capabilities = {
413- " deviceName" : " iPhone 12" ,
414- " platformName" : " ios" ,
415- " platformVersion" : " 14" ,
416- " isRealMobile" : True ,
417- " app" : " APP_URL" , # Your uploaded app URL
418- " visual" : True , # Mandatory for SmartUI
419- " name" : " Mobile App Test Session" ,
420- " build" : f " { os.getenv(' CI_PROJECT_NAME' )} - { os.getenv(' CI_PIPELINE_ID' )} " if os.getenv(" CI" ) else " smartui-local-build" ,
421-
422- # SmartUI Hooks Configuration
423- " smartUI.project" : f " { os.getenv(' SMARTUI_PROJECT_NAME' )} -visual " ,
424- " smartUI.build" : f " { os.getenv(' CI_PROJECT_NAME' )} - { os.getenv(' CI_PIPELINE_ID' )} " if os.getenv(" CI" ) else " smartui-local-build" ,
425- " smartUI.baseline" : False ,
426- " smartUI.cropStatusBar" : True ,
427-
428- # GitLab Integration Capability
429- " github" : {
430- " url" : github_url # GitLab API URL for status updates
431- }
432- }
433-
434- driver = webdriver.Remote(
435- command_executor = f " https:// { os.getenv(' LT_USERNAME' )} : { os.getenv(' LT_ACCESS_KEY' )} @mobile-hub.lambdatest.com/wd/hub " ,
436- desired_capabilities = capabilities
437- )
438- ```
439-
440- </TabItem >
441- <TabItem value =' ruby-web ' label =' Ruby (Web) ' >
442-
443- ``` ruby title="Example: Ruby Selenium Configuration with SmartUI Hooks and GitLab"
444- require ' selenium-webdriver'
445-
446- # Get GitLab URL from environment
447- github_url = ENV [' GITHUB_URL' ]
448-
449- capabilities = {
450- browserName: " Chrome" ,
451- browserVersion: " latest" ,
452- platformName: " Windows 10" ,
453- " LT:Options" => {
454- username: ENV [' LT_USERNAME' ],
455- accessKey: ENV [' LT_ACCESS_KEY' ],
456- project: " Your Project Name" ,
457- w3c: true ,
458- name: " Web Test Session" ,
459- build: ENV [' CI' ] ? " #{ ENV [' CI_PROJECT_NAME' ]} -#{ ENV [' CI_PIPELINE_ID' ]} " : " smartui-local-build" ,
460-
461- # SmartUI Hooks Configuration
462- " smartUI.project" => " #{ ENV [' SMARTUI_PROJECT_NAME' ]} -visual" ,
463- " smartUI.build" => ENV [' CI' ] ? " #{ ENV [' CI_PROJECT_NAME' ]} -#{ ENV [' CI_PIPELINE_ID' ]} " : " smartui-local-build" ,
464- " smartUI.baseline" => false ,
465-
466- # GitLab Integration Capability
467- github: {
468- url: github_url
469- }
470- }
471- }
472-
473- driver = Selenium ::WebDriver .for(:remote ,
474- url: " https://#{ ENV [' LT_USERNAME' ]} :#{ ENV [' LT_ACCESS_KEY' ]} @hub.lambdatest.com/wd/hub" ,
475- desired_capabilities: capabilities
476- )
477- ```
478-
479- </TabItem >
480- <TabItem value =' ruby-mobile ' label =' Ruby (Mobile) ' >
481-
482- ``` ruby title="Example: Ruby Appium Configuration with SmartUI Hooks and GitLab"
483- require ' selenium-webdriver'
484-
485- # Get GitLab URL from environment
486- github_url = ENV [' GITHUB_URL' ]
487-
488- capabilities = {
489- deviceName: " iPhone 12" ,
490- platformName: " ios" ,
491- platformVersion: " 14" ,
492- isRealMobile: true ,
493- app: " APP_URL" , # Your uploaded app URL
494- visual: true , # Mandatory for SmartUI
495- name: " Mobile App Test Session" ,
496- build: ENV [' CI' ] ? " #{ ENV [' CI_PROJECT_NAME' ]} -#{ ENV [' CI_PIPELINE_ID' ]} " : " smartui-local-build" ,
497-
498- # SmartUI Hooks Configuration
499- " smartUI.project" => " #{ ENV [' SMARTUI_PROJECT_NAME' ]} -visual" ,
500- " smartUI.build" => ENV [' CI' ] ? " #{ ENV [' CI_PROJECT_NAME' ]} -#{ ENV [' CI_PIPELINE_ID' ]} " : " smartui-local-build" ,
501- " smartUI.baseline" => false ,
502- " smartUI.cropStatusBar" => true ,
503-
504- # GitLab Integration Capability
505- github: {
506- url: github_url # GitLab API URL for status updates
507- }
508- }
509-
510- driver = Selenium ::WebDriver .for(:remote ,
511- url: " https://#{ ENV [' LT_USERNAME' ]} :#{ ENV [' LT_ACCESS_KEY' ]} @mobile-hub.lambdatest.com/wd/hub" ,
512- desired_capabilities: capabilities
513- )
514- ```
515-
516- </TabItem >
517- <TabItem value =' csharp-web ' label =' C# (Web) ' >
518-
519- ``` csharp title="Example: C# Selenium Configuration with SmartUI Hooks and GitLab"
520- using OpenQA .Selenium ;
521- using OpenQA .Selenium .Remote ;
522- using System ;
523- using System .Collections .Generic ;
524-
525- public class BaseClassWebhook
526- {
527- public IWebDriver driver ;
528- public string githubURL = Environment .GetEnvironmentVariable (" GITHUB_URL" ); // GitLab URL from CI/CD
529-
530- public void Setup ()
531- {
532- string username = Environment .GetEnvironmentVariable (" LT_USERNAME" ) ?? " Your LT Username" ;
533- string authkey = Environment .GetEnvironmentVariable (" LT_ACCESS_KEY" ) ?? " Your LT AccessKey" ;
534-
535- var capabilities = new DesiredCapabilities ();
536- capabilities .SetCapability (" browserName" , " Chrome" );
537- capabilities .SetCapability (" browserVersion" , " latest" );
538- capabilities .SetCapability (" platformName" , " Windows 10" );
539- capabilities .SetCapability (" visual" , true ); // Mandatory for SmartUI
540- capabilities .SetCapability (" name" , " Web Test Session" );
541-
542- string buildName = Environment .GetEnvironmentVariable (" CI" ) != null
543- ? $" {Environment .GetEnvironmentVariable (" CI_PROJECT_NAME" )}-{Environment .GetEnvironmentVariable (" CI_PIPELINE_ID" )}"
544- : " smartui-local-build" ;
545- capabilities .SetCapability (" build" , buildName );
546-
547- // SmartUI Hooks Configuration
548- string projectName = Environment .GetEnvironmentVariable (" SMARTUI_PROJECT_NAME" ) != null
549- ? $" {Environment .GetEnvironmentVariable (" SMARTUI_PROJECT_NAME" )}-visual"
550- : " Your SmartUI Project Name" ;
551- capabilities .SetCapability (" smartUI.project" , projectName );
552- capabilities .SetCapability (" smartUI.build" , buildName );
553- capabilities .SetCapability (" smartUI.baseline" , false );
554-
555- // GitLab Integration Capability
556- if (! string .IsNullOrEmpty (gitURL ))
557- {
558- var git = new Dictionary <string , string > { { " url" , gitURL } };
559- capabilities .SetCapability (" github" , git );
560- Console .WriteLine ($" GitLab URL received successfully: {gitURL }" );
561- }
562-
563- string remoteUrl = $" https://{username }:{authkey }@hub.lambdatest.com/wd/hub" ;
564- driver = new RemoteWebDriver (new Uri (remoteUrl ), capabilities );
565- }
566- }
567- ```
568-
569- </TabItem >
570- <TabItem value =' csharp-mobile ' label =' C# (Mobile) ' >
571-
572- ``` csharp title="Example: C# Appium Configuration with SmartUI Hooks and GitLab"
573- using OpenQA .Selenium ;
574- using OpenQA .Selenium .Remote ;
575- using System ;
576- using System .Collections .Generic ;
577-
578- public class BaseClassWebhook
579- {
580- public IWebDriver driver ;
581- public string githubURL = Environment .GetEnvironmentVariable (" GITHUB_URL" ); // GitLab URL from CI/CD
582-
583- public void Setup ()
584- {
585- string username = Environment .GetEnvironmentVariable (" LT_USERNAME" ) ?? " Your LT Username" ;
586- string authkey = Environment .GetEnvironmentVariable (" LT_ACCESS_KEY" ) ?? " Your LT AccessKey" ;
587-
588- var capabilities = new DesiredCapabilities ();
589- capabilities .SetCapability (" deviceName" , " iPhone 12" );
590- capabilities .SetCapability (" platformName" , " ios" );
591- capabilities .SetCapability (" platformVersion" , " 14" );
592- capabilities .SetCapability (" isRealMobile" , true );
593- capabilities .SetCapability (" app" , " APP_URL" );
594- capabilities .SetCapability (" visual" , true ); // Mandatory for SmartUI
595- capabilities .SetCapability (" name" , " Mobile App Test Session" );
596-
597- string buildName = Environment .GetEnvironmentVariable (" CI" ) != null
598- ? $" {Environment .GetEnvironmentVariable (" CI_PROJECT_NAME" )}-{Environment .GetEnvironmentVariable (" CI_PIPELINE_ID" )}"
599- : " smartui-local-build" ;
600- capabilities .SetCapability (" build" , buildName );
601-
602- // SmartUI Hooks Configuration
603- string projectName = Environment .GetEnvironmentVariable (" SMARTUI_PROJECT_NAME" ) != null
604- ? $" {Environment .GetEnvironmentVariable (" SMARTUI_PROJECT_NAME" )}-visual"
605- : " Your SmartUI Project Name" ;
606- capabilities .SetCapability (" smartUI.project" , projectName );
607- capabilities .SetCapability (" smartUI.build" , buildName );
608- capabilities .SetCapability (" smartUI.baseline" , false );
609- capabilities .SetCapability (" smartUI.cropStatusBar" , true );
610-
611- // GitLab Integration Capability
612- if (! string .IsNullOrEmpty (gitURL ))
613- {
614- var git = new Dictionary <string , string > { { " url" , gitURL } };
615- capabilities .SetCapability (" github" , git );
616- Console .WriteLine ($" GitLab URL received successfully: {gitURL }" );
617- }
618-
619- string remoteUrl = $" https://{username }:{authkey }@mobile-hub.lambdatest.com/wd/hub" ;
620- driver = new RemoteWebDriver (new Uri (remoteUrl ), capabilities );
621- }
622- }
623- ```
624-
625401</TabItem >
626402</Tabs >
627403
0 commit comments