This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// <copyright file="BlobStorageService.cs" company="Automate The Planet Ltd."> | |
// Copyright 2021 Automate The Planet Ltd. | |
// Unauthorized copying of this file, via any medium is strictly prohibited | |
// Proprietary and confidential | |
// </copyright> | |
// <author>Anton Angelov</author> | |
// <site>https://bellatrix.solutions/</site> | |
using System; | |
using System.Collections.Generic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
Console.WriteLine("Hello Sukhpinder!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void VerifyFileDownloadChrome() throws IOException { | |
var expectedFilePath = Paths.get("c:\\temp\\Testing_Framework_2015_3_1314_2_Free.exe"); | |
try | |
{ | |
driver.navigate().to("https://www.telerik.com/download-trial-file/v2/telerik-testing-framework"); | |
wait.until(x -> Files.exists(expectedFilePath)); | |
long bytes = Files.size(expectedFilePath); | |
Assert.assertEquals(4326192, bytes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String downloadFilepath = "c:\\temp"; | |
HashMap<String, Object> chromePrefs = new HashMap<>(); | |
chromePrefs.put("profile.default_content_settings.popups", 0); | |
chromePrefs.put("download.default_directory", downloadFilepath); | |
chromeOptions.setExperimentalOption("prefs", chromePrefs); | |
chromeOptions.addArguments("--test-type"); | |
chromeOptions.addArguments("start-maximized", "disable-popup-blocking"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void waitForAjaxComplete() { | |
wait.until(x -> | |
{ | |
JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver; | |
Boolean isAjaxCallComplete = | |
(Boolean)javascriptExecutor.executeScript("return window.jQuery != undefined && jQuery.active == 0"); | |
return isAjaxCallComplete ; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void setHiddenField() { | |
//<input type="hidden" name="country" value="Bulgaria"/> | |
var theHiddenElem = driver.findElement(By.name("country")); | |
JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver; | |
javascriptExecutor.executeScript("arguments[0].value='Germany';", theHiddenElem); | |
String hiddenFieldValue = theHiddenElem.getAttribute("value"); | |
Assert.assertEquals("Germany", hiddenFieldValue); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void assertButtonEnabledDisabled() { | |
driver.navigate().to("http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_button_disabled"); | |
driver.switchTo().frame("iframeResult"); | |
var button = driver.findElement(By.xpath("/html/body/button")); | |
Assert.assertFalse(button.isEnabled()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void focusOnControl() { | |
driver.navigate().to("http://automatetheplanet.com/"); | |
waitUntilLoaded(); | |
var ourMissionLink = driver.findElement(By.xpath("//*[@id=\"panel-6435-0-0-4\"]/div")); | |
Actions action = new Actions(driver); | |
action.moveToElement(ourMissionLink).build().perform(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void scrollFocusToControl() { | |
driver.navigate().to("http://automatetheplanet.com/"); | |
var ourMissionLink = driver.findElement(By.xpath("//*[@id=\"panel-6435-0-0-4\"]/div")); | |
String jsToBeExecuted = String.format("window.scroll(0, {0});", ourMissionLink.getLocation().getY()); | |
JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver; | |
javascriptExecutor.executeScript(jsToBeExecuted); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void scrollFocusToControl() { | |
driver.navigate().to("http://automatetheplanet.com/"); | |
var ourMissionLink = driver.findElement(By.xpath("//*[@id=\"panel-6435-0-0-4\"]/div")); | |
String jsToBeExecuted = String.format("window.scroll(0, {0});", ourMissionLink.getLocation().getY()); | |
JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver; | |
javascriptExecutor.executeScript(jsToBeExecuted); | |
} |
NewerOlder