diff --git a/src/main/java/magicleapTesting/DesignPlane.java b/src/main/java/magicleapTesting/DesignPlane.java new file mode 100644 index 0000000..2020d44 --- /dev/null +++ b/src/main/java/magicleapTesting/DesignPlane.java @@ -0,0 +1,60 @@ +package magicleapTesting; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.RemoteWebDriver; +import org.openqa.selenium.remote.SessionId; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +import java.util.concurrent.TimeUnit; + +public class DesignPlane { + + public void plane(RemoteWebDriver driver, SessionId session) { + try { + driver.get("https://designyourown.newairplane.com/"); + driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + WebDriverWait wait = new WebDriverWait(driver, 60); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("container-canvas"))); + + wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#gallery > div.accordion-section-title.active > span.hint"))); + Actions slider = new Actions(driver); + WebElement daylight = driver.findElement(By.id("container-canvas")); + slider.dragAndDropBy(daylight, 50, 0).build().perform(); + slider.dragAndDropBy(daylight, 10, 0).build().perform(); + slider.dragAndDropBy(daylight, -50, 0).build().perform(); + driver.findElement(By.cssSelector("#gallery > div.accordion-section-title.active > span.hint")).click(); + + driver.findElement(By.cssSelector("#designs-items > div.layers-item.static.off > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(2) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(3) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(4) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(5) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(6) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(7) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(8) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(9) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(10) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(11) > div.toggle")).click(); + driver.findElement(By.cssSelector("#designs-items > div:nth-child(12) > div.toggle")).click(); + Thread.sleep(5000); + + driver.findElement(By.cssSelector("#gallery > div.accordion-section-title")).click(); + driver.findElement(By.cssSelector("document.querySelector(\"#gallery > div.accordion-section-content.open > div.gallery-scroll-area.ps-container.ps-theme-default.ps-active-y > div.gallery-items-list > div.item.active > div.top > div.thumb > img\")")).click(); + driver.findElement(By.cssSelector("document.querySelector(\"#gallery > div.accordion-section-content.open > div.gallery-scroll-area.ps-container.ps-theme-default.ps-active-y > div.gallery-items-list > div.item.active > div.top > div.thumb > img\")")).click(); + + Thread.sleep(5000); + + } catch (Exception p) { + System.out.println(p); + System.out.println(p+" "+" SessionID --->"+" "+session); + + } + + + } +} diff --git a/src/main/java/magicleapTesting/DownloadTest.java b/src/main/java/magicleapTesting/DownloadTest.java index 4acb09c..c6ca4b6 100644 --- a/src/main/java/magicleapTesting/DownloadTest.java +++ b/src/main/java/magicleapTesting/DownloadTest.java @@ -1,34 +1,40 @@ package magicleapTesting; +import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.Assert; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.util.Base64; + public class DownloadTest { public void FileDownload(RemoteWebDriver driver) { try { -// driver.get("https://www.stats.govt.nz/large-datasets/csv-files-for-download/"); + driver.get("https://www.stats.govt.nz/large-datasets/csv-files-for-download/"); // driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); // // driver.switchTo().frame("iframeResult"); // -// WebElement element = driver.findElement(By.linkText("Business employment data: December 2020 quarter – CSV")); -// element.click(); + WebElement element = driver.findElement(By.linkText("International trade: March 2021 quarter – CSV – corrected")); + element.click(); // -// Thread.sleep(4000); + Thread.sleep(10000); - Assert.assertEquals(((JavascriptExecutor) driver).executeScript("lambda-file-exists=ex.xpi"), true); //file exist check + Assert.assertEquals(((JavascriptExecutor) driver).executeScript("lambda-file-exists=international-trade-march-2021-quarter-csv-corrected.zip"), true); //file exist check - System.out.println(((JavascriptExecutor) driver).executeScript("lambda-file-stats=ex.xpi")); //retrieve file stats + ((JavascriptExecutor) driver).executeScript("lambda-file-stats=international-trade-march-2021-quarter-csv-corrected.zip"); //retrieve file stats + // System.out.println(((JavascriptExecutor) driver).executeScript("lambda-file-list=.jpg")); //retrieve file stats -// String base64EncodedFile = ((JavascriptExecutor) driver).executeScript("lambda-file-content=business-employment-data-december-2020-quarter-csv.zip").toString(); // file content download -// System.out.println(base64EncodedFile); -// -// -// byte[] data = Base64.getDecoder().decode(base64EncodedFile); -// OutputStream stream = new FileOutputStream("business-employment-data-december-2020-quarter-csv.zip"); -// stream.write(data); + String base64EncodedFile = ((JavascriptExecutor) driver).executeScript("lambda-file-content=international-trade-march-2021-quarter-csv-corrected.zip").toString(); // file content download + + + byte[] data = Base64.getDecoder().decode(base64EncodedFile); + OutputStream stream = new FileOutputStream("International trade: March 2021 quarter – CSV – corrected.zip"); + stream.write(data); } catch (Exception e) { diff --git a/src/main/java/magicleapTesting/LambdaTutrial.java b/src/main/java/magicleapTesting/LambdaTutrial.java new file mode 100644 index 0000000..b354fad --- /dev/null +++ b/src/main/java/magicleapTesting/LambdaTutrial.java @@ -0,0 +1,52 @@ +package magicleapTesting; + +import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.remote.RemoteWebDriver; +import org.openqa.selenium.remote.SessionId; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.Select; +import org.openqa.selenium.support.ui.WebDriverWait; + +public class LambdaTutrial { + public void Lambdacert(RemoteWebDriver driver, SessionId session) { + try { + driver.get("https://www.lambdatest.com/automation-demos/"); + driver.manage().window().maximize(); + WebElement login = driver.findElement(By.cssSelector("#newapply > div.w-360.ml-auto.text-center.smtablet\\:w-full.smtablet\\:ml-0 > button")); + login.isDisplayed(); + WebDriverWait wait = new WebDriverWait(driver, 30); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#newapply > div.w-360.ml-auto.text-center.smtablet\\:w-full.smtablet\\:ml-0 > button"))); + driver.findElement(By.id("username")).sendKeys("lambda"); + driver.findElement(By.id("password")).sendKeys("lambda123"); + login.click(); + wait.until(ExpectedConditions.visibilityOfElementLocated((By.id("populate")))); + driver.findElement(By.id("developer-name")).sendKeys("prateeks@lambdatest.com"); + driver.findElement(By.xpath("/html/body/div[1]/div[1]/section[2]/div/div/div[1]/p[4]/label/input")).click(); + driver.findElement(By.id("others")).click(); + Select dropdown = new Select(driver.findElement(By.id("preferred-payment"))); + dropdown.selectByIndex(2); + driver.findElement(By.cssSelector("#tried-ecom")).click(); + WebElement buttondrag = driver.findElement(By.cssSelector("#__next > div.wrapper > section.my-50.automationbar.smtablet\\:px-20 > div > div > div.form-bottom > div.sliderBar > div > div > div:nth-child(1) > div > div:nth-child(12)")); + Actions hold = new Actions(driver); + + hold.dragAndDropBy(buttondrag, -11, -6).build().perform(); + hold.dragAndDropBy(buttondrag, 49, -6).build().perform(); + hold.dragAndDropBy(buttondrag, 109, -6).build().perform(); + hold.dragAndDropBy(buttondrag, 169, -6).build().perform(); + hold.dragAndDropBy(buttondrag, 469, -6).build().perform(); + // hold.dragAndDropBy(buttondrag, 589, -6).build().perform(); + + driver.findElement(By.xpath("/html/body/div[1]/div[1]/section[2]/div/div/div[4]/div[3]/textarea")).sendKeys("Hi This is Prateek Support Team is the best. Whatever it takes"); + JavascriptExecutor jse = (JavascriptExecutor) driver; + jse.executeScript("window.scrollBy(0,350)"); +// driver.findElement(By.cssSelector("#file")).sendKeys("5mb.jpg"); + } catch (Exception t) { + System.out.println(t); + System.out.println(t + " " + " SessionID --->" + " " + session); + } + + } +} diff --git a/src/main/java/magicleapTesting/LocalDriver.java b/src/main/java/magicleapTesting/LocalDriver.java index 931562e..d9ceeac 100644 --- a/src/main/java/magicleapTesting/LocalDriver.java +++ b/src/main/java/magicleapTesting/LocalDriver.java @@ -1,239 +1,69 @@ package magicleapTesting; +import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; -import org.openqa.selenium.firefox.FirefoxDriver; -import org.openqa.selenium.firefox.FirefoxOptions; -import org.openqa.selenium.firefox.FirefoxProfile; - -import java.io.File; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.Select; +import org.openqa.selenium.support.ui.WebDriverWait; public class LocalDriver { public static void main(String[] args) { - String status = null; - System.setProperty("webdriver.gecko.driver", "E:\\drivers\\geckodriver.exe"); - FirefoxProfile profile = new FirefoxProfile(); - profile.addExtension(new File("E:\\extensions\\bugfix_editor.xpi")); + System.setProperty("webdriver.chrome.driver", "E:\\drivers\\chromedriver.exe"); + + /* FirefoxProfile profile = new FirefoxProfile(); + profile.addExtension(new File("E:\\extensions\\bugfix_editor.xpi"));*/ // Instantiate a ChromeDriver class. /*Map prefs = new HashMap(); prefs.put("download.default_directory", "C:\\Users\\LenovoE14\\Downloads");*/ - FirefoxOptions options = new FirefoxOptions(); - options.setProfile(profile); - // options.addArguments("--headless"); - // options.setExperimentalOption("prefs",prefs); - // options.addExtensions(new File("E:\\extensions\\1.2.3_0.crx")); + /* FirefoxOptions options = new FirefoxOptions(); + options.setProfile(profile);*/ + // options.addArguments("--headless"); + // options.setExperimentalOption("prefs",prefs); + // options.addExtensions(new File("E:\\extensions\\1.2.3_0.crx")); // For use with ChromeDriver: - WebDriver driver = new FirefoxDriver(options); // System.setProperty("webdriver.gecko.driver", "E:\\drivers\\geckodriver.exe"); + WebDriver driver = new ChromeDriver(); // System.setProperty("webdriver.gecko.driver", "E:\\drivers\\geckodriver.exe"); try { - - driver.get("https://www.googl.com"); - Thread.sleep(50000000); - JavascriptExecutor js = (JavascriptExecutor) driver; - js.executeScript("window.postMessage('clicked_browser_action', '*')"); - -// driver.get("https://www.stats.govt.nz/large-datasets/csv-files-for-download/"); -// driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); -// // driver.switchTo().frame("iframeResult"); -// -// WebElement element = driver.findElement(By.linkText("Business employment data: December 2020 quarter – CSV")); -// element.click(); -// -// Thread.sleep(10000); - - /* driver.manage().window().maximize(); - driver.get("https://shop-stage.scholastic.com/teachers-ecommerce/teacher/tsohomepage.html"); - Thread.sleep(5000); - driver.findElement(By.className("sch-global-profile-icon")).click(); - driver.findElement(By.linkText("Sign In")).click(); - Thread.sleep(15000); - driver.switchTo().frame(driver.findElement(By.className("loginframe"))); - driver.switchTo().frame("loginIframe"); - Thread.sleep(5000); - driver.findElement(By.id("signin-email-input")).sendKeys("testqa@test.com"); - Thread.sleep(10000); - driver.findElement(By.id("signin-email-submit-button")).click(); - - Thread.sleep(10000); - driver.findElement(By.id("signin-password-input")).sendKeys("test1234"); - driver.findElement(By.id("signin-password-submit-button")).click(); - Thread.sleep(10000); - driver.findElement(By.className("sch-global-username")).click();*/ - - - - - - - /*driver.get("https://pa-ua.fadv.com"); + driver.get("https://www.lambdatest.com/automation-demos/"); driver.manage().window().maximize(); - Thread.sleep(10000); - driver.findElement(By.id("loginInputEmail")).sendKeys("snvinl21@example.com"); - driver.findElement(By.id("loginInputPwd")).sendKeys("Test1234"); - - driver.findElement(By.name("action")).click(); - System.out.println("Login Button CLicked"); - JavascriptExecutor scroll = (JavascriptExecutor) driver; - scroll.executeScript("window.scrollBy(0,500)"); - Thread.sleep(30000); - driver.findElement(By.id("paNameNext")).click(); - scroll.executeScript("window.scrollBy(0,500)"); - Thread.sleep(5000); - System.out.println("Name next CLicked"); - driver.findElement(By.id("paNoMiddleName")).click(); - scroll.executeScript("window.scrollBy(0,500)"); - System.out.println("NoMName next CLicked"); - Thread.sleep(5000); - driver.findElement(By.id("aliasNoName")).click(); - scroll.executeScript("window.scrollBy(0,500)"); - System.out.println("alias next CLicked"); - Thread.sleep(5000); - driver.findElement(By.id("paGenderSkipContinue")).click(); - Thread.sleep(15000); - driver.findElement(By.id("dobdp-widget")).click(); - Thread.sleep(15000); - driver.findElement(By.id("dobdp-widget")).sendKeys("11-11-1991"); - System.out.println("Calendar date Clicked");*/ - // Thread.sleep(15000); -// WebElement elm = driver.findElement(By.xpath("#slick-slide01 > div > div > form > div > div.row.form-element-section.btn_center > div > div > input")); -// Thread.sleep(30000); -// JavascriptExecutor js = (JavascriptExecutor) driver; -// js.executeScript("arguments[0].value='January 05,2001';",elm); - -// driver.get("https://127.0.0.1:8001/"); -// driver.manage().window().maximize(); -// System.out.println(driver.getTitle()); -// driver.manage().addCookie(new Cookie("test1", "cookie1")); -// driver.manage().addCookie(new Cookie("test2", "cookie2")); -// String Cache = driver.manage().getCookies().toString(); -// -// System.out.println(Cache); -// Thread.sleep(5000); -// JavascriptExecutor scroll = (JavascriptExecutor) driver; -// scroll.executeScript("window.scrollBy(0,500)"); -// driver.findElement(By.linkText("legOfenris")).click(); -// -// Thread.sleep(7000); -// /* ((JavascriptExecutor) driver).executeScript("lambda-throttle-network", "GPRS"); -// Thread.sleep(7000);*/ -// driver.navigate().back(); -// // ((JavascriptExecutor) driver).executeScript("lambda-throttle-network", obj.toString()); -// String CacheTwo = driver.manage().getCookies().toString(); -// System.out.println(CacheTwo); -// scroll.executeScript("window.scrollBy(0,-500)"); -// Thread.sleep(50000); - - /*String username = "storefront"; - String password = "storefront"; - - driver.get("https://shop-qa.scholastic.com/teachers-ecommerce/teacher/tsohomepage.html"); - // SessionStorage username= new RemoteSessionStorage() - - Set beforeAuthCookies= driver.manage().getCookies(); - FileUtils.writeStringToFile(new File("src/test/java/beforeAuthCookies.txt"), String.valueOf(beforeAuthCookies)); - - driver.findElement(By.className("sch-global-cart-icon")).click(); - String getUrl = driver.getCurrentUrl(); - String newURl = getUrl.replace("https://", ""); - System.out.println(newURl); - driver.get("https://" + username + ":" + password + "@" + newURl); - System.out.println(driver.getCurrentUrl()); - Set afterAuthCookies= driver.manage().getCookies(); - FileUtils.writeStringToFile(new File("src/test/java/afterAuthCookies.txt"), String.valueOf(afterAuthCookies)); - System.out.println(driver.getTitle());*/ - //scroll.executeScript("window.scrollBy(0,500)"); - /* JavascriptExecutor scroll = (JavascriptExecutor) driver; - scroll.executeScript("window.scrollBy(0,600)"); - - driver.findElement(By.id("win2")).click(); -*/ - - - - - /* *//* driver.manage().window().maximize(); - WebDriverWait wait=new WebDriverWait(driver, 20); - driver.get("https://www.nsw.gov.au/"); - driver.findElement(By.id("home-search-autosuggest-input")).sendKeys("Jobs"); - WebElement link; - link= wait.until(ExpectedConditions.visibilityOfElementLocated (By.xpath( "//*[@id=\"home-search-autosuggest-list\"]/li[2]"))); - link.click();*//* - driver.manage().window().maximize(); - driver.get("https://www.lambdatest.com/"); - WebElement homePageLogin= driver.findElement(By.xpath("/html/body/div[1]/header/div[3]/nav/div/ul/li[6]/a")); - homePageLogin.click(); - Thread.sleep(2000); - WebElement username= driver.findElement(By.name("email")); - username.sendKeys("prateeks@lambdatest.com"); - Thread.sleep(2000); - WebElement password= driver.findElement(By.name("password")); - password.sendKeys("9582334806"); - Thread.sleep(2000); - WebElement loginPlatform= driver.findElement(By.xpath("/html/body/div[1]/div/div/div/div/form/div[3]/button")); - loginPlatform.click(); - Thread.sleep(2000); - WebElement VisualUIOption= driver.findElement(By.className("arrow-menu")); - VisualUIOption.click(); - Thread.sleep(2000); - WebElement clickScreenShot= driver.findElement(By.xpath("/html/body/div[2]/header/aside/ul/li[3]/ul/li[1]/a")); - clickScreenShot.click(); - Thread.sleep(2000); - WebElement ClickAutomation= driver.findElement(By.cssSelector("body > app-root > app-console > app-header > header > aside > ul > li:nth-child(4) > a")); - ClickAutomation.click(); - Thread.sleep(2000); - WebElement AutomationLogs= driver.findElement(By.xpath("/html/body/div[2]/div/div/main/div/main/div/div[2]/div[2]/ul/li[2]/a")); - AutomationLogs.click(); - Thread.sleep(2000); - JavascriptExecutor scroll = (JavascriptExecutor) driver; - scroll.executeScript("window.scrollBy(0,600)"); - scroll.executeScript("window.scrollBy(0,-500)"); - Thread.sleep(2000); - WebElement AutoamtionAnalyticls= driver.findElement(By.xpath("/html/body/div[2]/div/div/main/div/main/div/div[2]/div[2]/ul/li[3]/a")); - AutoamtionAnalyticls.click(); - Thread.sleep(2000); - WebElement userPofile= driver.findElement(By.xpath("/html/body/div[2]/div/div/main/div/main/div/div[2]/div[1]/nav/div/div[2]/ul/li[5]/a/div/span/img")); - userPofile.click(); - Thread.sleep(2000); - WebElement Profile= driver.findElement(By.xpath("/html/body/div[2]/div/div/main/div/main/div/div[2]/div[1]/nav/div/div[2]/ul/li[5]/ul/li[2]/a")); - Profile.click(); - Thread.sleep(2000); - WebElement userPofilepage= driver.findElement(By.xpath("/html/body/div[2]/header/div/div/div[3]/div/ul/li[5]/a")); - userPofilepage.click(); - Thread.sleep(2000); - WebElement LogOut= driver.findElement(By.xpath("/html/body/div[2]/header/div/div/div[3]/div/ul/li[5]/div/a[9]")); - LogOut.click(); - // WebElement DownloadSPeed = driver.findElement(By.xpath("/html/body/section/div[2]/div/div[1]/table/tbody/tr/td/div[2]/div[2]/div/div[1]/h3")); - - *//* driver.get("http://teachables-stage.scholastic.com/teachables/guesthomepage.html"); - driver.manage().window().maximize(); - - WebElement search= driver.findElement(By.className("teachablesnav-search--field")); - // search.setAttribute - String val = "hello"; - - Actions actions = new Actions(driver); - actions.moveToElement(driver.findElement(By.className("teachablesnav-search--field"))); - actions.click(); - - - for (int i = 0; i < val.length(); i++) { - - char c = val.charAt(i); - String s = new StringBuilder().append(c).toString(); - System.out.println(s); - actions.sendKeys(s); + WebElement login = driver.findElement(By.cssSelector("#newapply > div.w-360.ml-auto.text-center.smtablet\\:w-full.smtablet\\:ml-0 > button")); + login.isDisplayed(); + WebDriverWait wait = new WebDriverWait(driver, 30); + wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#newapply > div.w-360.ml-auto.text-center.smtablet\\:w-full.smtablet\\:ml-0 > button"))); + driver.findElement(By.id("username")).sendKeys("lambda"); + driver.findElement(By.id("password")).sendKeys("lambda123"); + login.click(); + wait.until(ExpectedConditions.visibilityOfElementLocated((By.id("populate")))); + driver.findElement(By.id("developer-name")).sendKeys("prateeks@lambdatest.com"); + driver.findElement(By.xpath("/html/body/div[1]/div[1]/section[2]/div/div/div[1]/p[4]/label/input")).click(); + driver.findElement(By.id("others")).click(); + Select dropdown = new Select(driver.findElement(By.id("preferred-payment"))); + dropdown.selectByIndex(2); + driver.findElement(By.cssSelector("#tried-ecom")).click(); + WebElement buttondrag = driver.findElement(By.cssSelector("#__next > div.wrapper > section.my-50.automationbar.smtablet\\:px-20 > div > div > div.form-bottom > div.sliderBar > div > div > div:nth-child(1) > div > div:nth-child(12)")); + Actions hold = new Actions(driver); + + hold.dragAndDropBy(buttondrag, -11, -6).build().perform(); + hold.dragAndDropBy(buttondrag, 49, -6).build().perform(); + hold.dragAndDropBy(buttondrag, 109, -6).build().perform(); + hold.dragAndDropBy(buttondrag, 169, -6).build().perform(); + hold.dragAndDropBy(buttondrag, 469, -6).build().perform(); + // hold.dragAndDropBy(buttondrag, 589, -6).build().perform(); + + driver.findElement(By.xpath("/html/body/div[1]/div[1]/section[2]/div/div/div[4]/div[3]/textarea")).sendKeys("Hi This is Prateek Support Team is the best. Whatever it takes"); + JavascriptExecutor jse = (JavascriptExecutor) driver; + jse.executeScript("window.scrollBy(0,350)"); + driver.findElement(By.cssSelector("#file")).sendKeys("5mb.jpg"); - actions.build().perform(); - Thread.sleep(5000); - } - search.sendKeys(Keys.ARROW_DOWN); - Thread.sleep(20000);*//* - Thread.sleep(30000);*/ driver.quit(); } catch (Exception e) { System.out.println(e); diff --git a/src/main/java/magicleapTesting/aPiCalls.java b/src/main/java/magicleapTesting/aPiCalls.java new file mode 100644 index 0000000..3e5392d --- /dev/null +++ b/src/main/java/magicleapTesting/aPiCalls.java @@ -0,0 +1,47 @@ +package magicleapTesting; + +import java.io.*; + +import static io.restassured.RestAssured.given; + +public class aPiCalls { + + private final String username; //LT_username + private final String accesskey; //LT_accessKey + private final String ApiBaseUrl; + + // Authorization with username and accesskey + aPiCalls(String username, String accesskey) { + this.username = username; + this.accesskey = accesskey; + this.ApiBaseUrl = "https://" + username + ":" + accesskey + "@api.lambdatest.com/automation/api/v1/"; // API base URL with authorization + } + + // API session detail function + public void getSessionDetails(String sid) throws IOException { + System.setOut(new PrintStream(createLogFile(sid))); + + //given().when().get(ApiBaseUrl + "builds").then().log().body(); // Request to fetch all the build details + given().when().get(ApiBaseUrl + "sessions/" + sid).then().log().body(); // Request to fetch particular session details contains command, visual, video, selenium logs + //given().when().get(ApiBaseUrl + "lighthouse/report/" + sid).then().log().body(); // Request to fetch performance report if exist + //https://${apiCredentials}@api.lambdatest.com/automation/api/v1/builds/${buildId}/sessions + + + + + + } + + // Create new file to save output Data + private FileOutputStream createLogFile(String sid) throws FileNotFoundException { + + if (new File( sid + ".json").exists()) { + System.out.println("file already exists"); + + } else { + return new FileOutputStream( sid + ".json"); + } + return null; + } + +} diff --git a/src/main/java/magicleapTesting/browserStack.java b/src/main/java/magicleapTesting/browserStack.java index 1ed5a4f..ebb4446 100644 --- a/src/main/java/magicleapTesting/browserStack.java +++ b/src/main/java/magicleapTesting/browserStack.java @@ -151,7 +151,7 @@ public void setUp() throws Exception { StopWatch driverStart = new StopWatch(); driverStart.start(); - hub = "";//"https://" + username + ":" + accesskey + "@" + gridURL + "/wd/hub"; + hub = "https://" + username + ":" + accesskey + "@" + gridURL + "/wd/hub"; System.out.println(hub); driver = new RemoteWebDriver(new URL(hub), capabilities); @@ -187,17 +187,23 @@ public void DesktopScript() { System.out.println("==================TestStart+++++++++++++" + session + "++++++++++++++++TestStart=================="); SuiteStart = System.currentTimeMillis(); - TodoApp TodoAppTestObject = new TodoApp(); TodoAppTestObject.TodoAppTest(driver, status, session); ResolutionTest ResolutionTestObject = new ResolutionTest(); + ResolutionTestObject.Resolution(driver, ResolutionValue, status, ResolutionTotal, this.ResolutionValueCap, session); GeolocationTest geo = new GeolocationTest(); geo.Geolocation(driver, status, GeolocationTotal, session); + DownloadTest down = new DownloadTest(); + down.FileDownload(driver); TestCase SeleniumTest = new TestCase(); SeleniumTest.LongCase(driver, session); + LambdaTutrial tut = new LambdaTutrial(); + tut.Lambdacert(driver,session); GoogleSpace space = new GoogleSpace(); space.GSpace(driver, session); + DesignPlane plane = new DesignPlane(); + plane.plane(driver,session); SuiteStop = System.currentTimeMillis(); SuiteTotalTime = SuiteStop - SuiteStart; System.out.println("Total Time Took for Test suite execute" + " " + SuiteTotalTime / 1000f); diff --git a/src/main/java/magicleapTesting/magicLeap.java b/src/main/java/magicleapTesting/magicLeap.java index f09ac5d..7681fe7 100644 --- a/src/main/java/magicleapTesting/magicLeap.java +++ b/src/main/java/magicleapTesting/magicLeap.java @@ -19,9 +19,9 @@ public class magicLeap { public String username = "prateeks"; - public String accesskey = "lvF4drFWBItNhamTk2CP7fVioGBU4GZqaK67khwpKcQA9jeQUo"; + public String accesskey = "IuCSesD83A7LsTFzEKS0Lb6tzvEfBQ38DMkFTEpudatxxxsdjH"; public RemoteWebDriver driver; - public String gridURL = "hub.lambdatest.com"; //hub-virginia.lambdatest.com/wd/hub"@eu-central-1-hub.lambdatest.com/wd/hub"; + public String gridURL = "stage-hub.lambdatest.com"; //hub-virginia.lambdatest.com/wd/hub"@eu-central-1-hub.lambdatest.com/wd/hub"; String status; String ResolutionValue; long quitestoptime; @@ -84,10 +84,10 @@ public void setUp() throws Exception { DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); formatter.setTimeZone(TimeZone.getTimeZone("Asia/Kolkata")); date = new Date(); - for (int i = 0; i < 10; i++) { - for (int j = 0; j < 5; j++) { + for (int i = 0; i < 100; i++) { + for (int j = 0; j < 10; j++) { try { - + String[] file = {"5mb.jpg", "10MB.jpg", "2mb.jpg", "real time.png", "15mb.jpg", "10MB1.jpg", "10MB2.jpg", "10MB3.jpg", "My15mb2.jpg", "My15mb3.jpg", "My15mb3.jpg"}; DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("browserName", this.BrowserValue); @@ -95,12 +95,13 @@ public void setUp() throws Exception { capabilities.setCapability("version", "latest" + "-" + j); capabilities.setCapability("platform", this.PlatformValue); //capabilities.setCapability("build", date +" "+this.PlatformValue + System.getenv("LT_BUILD_NAME")); - capabilities.setCapability("build", "Jenkins US"+" " + formatter.format(date) + " " + this.PlatformValue +" "+ System.getProperty("BUILD_NUMBER")); + capabilities.setCapability("build", "Jenkins 60 parallel" + " " + formatter.format(date) + " " + this.PlatformValue + " " + System.getProperty("BUILD_NUMBER")); capabilities.setCapability("name", this.TestName); - // capabilities.setCapability("resolution", this.ResolutionValueCap); + // capabilities.setCapability("lambda:userFiles", file); capabilities.setCapability("console", true); capabilities.setCapability("network", false); capabilities.setCapability("visual", false); + capabilities.setCapability("selenium_version", "3.141.59"); // capabilities.setCapability("fixedIP", this.FixedIpValue); /*capabilities.setCapability("safari.cookies", true); capabilities.setCapability("safari.popups", true);*/ @@ -188,13 +189,21 @@ public void DesktopScript() { TodoApp TodoAppTestObject = new TodoApp(); TodoAppTestObject.TodoAppTest(driver, status, session); ResolutionTest ResolutionTestObject = new ResolutionTest(); + ResolutionTestObject.Resolution(driver, ResolutionValue, status, ResolutionTotal, this.ResolutionValueCap, session); GeolocationTest geo = new GeolocationTest(); geo.Geolocation(driver, status, GeolocationTotal, session); + DownloadTest down = new DownloadTest(); + down.FileDownload(driver); TestCase SeleniumTest = new TestCase(); SeleniumTest.LongCase(driver, session); + LambdaTutrial tut = new LambdaTutrial(); + tut.Lambdacert(driver, session); GoogleSpace space = new GoogleSpace(); space.GSpace(driver, session); + /* + DesignPlane plane = new DesignPlane(); + plane.plane(driver,session);*/ SuiteStop = System.currentTimeMillis(); SuiteTotalTime = SuiteStop - SuiteStart; System.out.println("Total Time Took for Test suite execute" + " " + SuiteTotalTime / 1000f); @@ -219,7 +228,6 @@ public void tearDown() throws Exception { driver.quit(); - } quitestoptime = System.currentTimeMillis(); quitetimestop = quitestoptime - quitetimestart; diff --git a/src/test/java/BigSur.xml b/src/test/java/BigSur.xml index ba0ab32..2b82380 100644 --- a/src/test/java/BigSur.xml +++ b/src/test/java/BigSur.xml @@ -16,729 +16,729 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --> \ No newline at end of file diff --git a/src/test/java/Combination.xml b/src/test/java/Combination.xml index 3cf7c1d..472db80 100644 --- a/src/test/java/Combination.xml +++ b/src/test/java/Combination.xml @@ -2,330 +2,198 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - + + + + + - + + + - - - - - - - - - - - - - - + - - - - + + + + + + - + + + - + - - - - + + + + + + - + + - + - - - - + + + + + + - + + - + - - - - + + + + + + + + + - - - - - - - - - - - - - - + - - - - + + + + + - + + + - - - - - - + + + + + + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - + + + + + - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + + + + - + + - - - - - - + + + + + + + - \ No newline at end of file diff --git a/src/test/java/Edge.xml b/src/test/java/Edge.xml new file mode 100644 index 0000000..472db80 --- /dev/null +++ b/src/test/java/Edge.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/ElCapitan.xml b/src/test/java/ElCapitan.xml new file mode 100644 index 0000000..472db80 --- /dev/null +++ b/src/test/java/ElCapitan.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/Win10.xml b/src/test/java/Win10.xml index d66f684..aa7a666 100644 --- a/src/test/java/Win10.xml +++ b/src/test/java/Win10.xml @@ -1,100 +1,564 @@ + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + - + + + + + + + + + + + + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + - - - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + @@ -102,15 +566,29 @@ + + + + + + + + + + + + + + - + - - - - + + + + - + @@ -118,14 +596,29 @@ - + + + + + + + + + + + + + + + + - - - - + + + + - + @@ -133,17 +626,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + - + + @@ -151,14 +672,29 @@ - - - - - - + + + + + - + + + + + + + + + + + + + + + + + @@ -166,15 +702,29 @@ + + + + + + + + + + + + + + - - - - - - + + + + + - + + @@ -182,1399 +732,846 @@ - - - - - - + + + + + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/Yosemite.xml b/src/test/java/Yosemite.xml new file mode 100644 index 0000000..472db80 --- /dev/null +++ b/src/test/java/Yosemite.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/classes/magicleapTesting/DownloadTest.class b/target/classes/magicleapTesting/DownloadTest.class index bdbee62..5ff3d81 100644 Binary files a/target/classes/magicleapTesting/DownloadTest.class and b/target/classes/magicleapTesting/DownloadTest.class differ diff --git a/target/classes/magicleapTesting/LocalDriver.class b/target/classes/magicleapTesting/LocalDriver.class index 356872b..3ae99e8 100644 Binary files a/target/classes/magicleapTesting/LocalDriver.class and b/target/classes/magicleapTesting/LocalDriver.class differ diff --git a/target/classes/magicleapTesting/Random.class b/target/classes/magicleapTesting/Random.class index 5273419..e4f4725 100644 Binary files a/target/classes/magicleapTesting/Random.class and b/target/classes/magicleapTesting/Random.class differ diff --git a/target/classes/magicleapTesting/magicLeap.class b/target/classes/magicleapTesting/magicLeap.class index 1e0a807..ae0f607 100644 Binary files a/target/classes/magicleapTesting/magicLeap.class and b/target/classes/magicleapTesting/magicLeap.class differ