Skip to content

Instantly share code, notes, and snippets.

Avatar
🏖️
Just living the good life

nadvolod

🏖️
Just living the good life
View GitHub Profile
@nadvolod
nadvolod / azureOnSauceWithJava.yml
Created Feb 1, 2021
A working Azure Pipelines for Java, Selenium, SauceLabs
View azureOnSauceWithJava.yml
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
trigger:
- main
pr:
- main
pool:
View SimpleExample.cs
public void mainTestCode(){
//put all the logic here
}
[TestMethod]
public void test1(){
mainTestCode();
}
[TestMethod]
public void test2(){
mainTestCode();
@nadvolod
nadvolod / cypress.spec.js
Created Sep 11, 2020
Sample Cypress tests
View cypress.spec.js
context('Login page', ()=>{
beforeEach(()=> {
cy.visit('https://www.saucedemo.com/')
})
it('can open page', () => {
cy.title().should('eq', 'Swag Labs')
})
it('can login', () => {
cy.get('#user-name').type('standard_user')
@nadvolod
nadvolod / OptimizedRadioButtonTest.java
Created Sep 8, 2020
An optimized radio button clicking test
View OptimizedRadioButtonTest.java
@Test
public void optimizedTest() throws AssertionError {
driver.navigate().to("https://www.techlistic.com/p/selenium-practice-form.html");
var male = driver.findElement(By.id("sex-0"));
var actions = new Actions(driver);
actions.moveToElement(male).click().perform();
assertTrue(male.isSelected());
var female = driver.findElement(By.id("sex-1"));
@nadvolod
nadvolod / BadGherkin.feature
Last active Aug 31, 2020
Bad Gherkin example
View BadGherkin.feature
Given driver webUrl + "/demo"
And input("#abr02tre", Key.CONTROL + "a")
And match temp contains "565d"
And match temp contains "5d"
When input("#rc02ert", "test")
Then text("divId45")
View mocha.test.js
var assert = require('assert');
let failureCount = 0;
before(function () {
console.log('before()', failureCount)
});
beforeEach(function () {
console.log('beforeEach()', failureCount)
});
View AppiumCapabilities.java
@Before
public void setUp() throws MalformedURLException {
logger.debug("Started setUp();");
logger.debug("platformVersion=>" + platformVersion + ". deviceName=>" + deviceName);
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("appiumVersion", "1.16.0");
capabilities.setCapability("autoAcceptAlerts", "true");
capabilities.setCapability("idleTimeout", "90");
capabilities.setCapability("noReset", "true");
@nadvolod
nadvolod / AndroidCapabilities.cs
Created Jul 15, 2020
Setting up Android capabilities for a real device test in Sauce Labs
View AndroidCapabilities.cs
var capabilities = new AppiumOptions();
//We can run on any version of the platform as long as it's the correct device
//Make sure to pick an Android or iOS device based on your app
capabilities.AddAdditionalCapability(MobileCapabilityType.DeviceName, "Google Pixel 4");
capabilities.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android");
//make sure you set locale as sometimes it opens in a different location and throws off locations
capabilities.AddAdditionalCapability("locale", "en");
capabilities.AddAdditionalCapability("language", "en");
//The next major version of Appium (2.x) will **require** this capability
capabilities.AddAdditionalCapability("automationName", "UiAutomator2");
View setBuildName.java
import com.saucelabs.saucebindings;
SauceOptions sauceOptions = new SauceOptions();
//Set a build name
sauceOptions.setBuild("Sample Build Name");
new SauceSession(sauceOptions).start();
@nadvolod
nadvolod / POM.xml
Created Jun 14, 2020
How to fix maven compiler errors
View POM.xml
<build>
<pluginManagement>
<plugins>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>