Skip to content

Instantly share code, notes, and snippets.

View nadvolod's full-sized avatar
🏖️
Just living the good life

Nikolay Advolodkin nadvolod

🏖️
Just living the good life
View GitHub Profile
@nadvolod
nadvolod / gist:c4fb9a41387789818b16
Created January 22, 2016 00:28
Sample code for an equivalence partition example
if(integerEntered >= 1 && integerEntered <= 5)
DisplayMessage(“Success”);
@nadvolod
nadvolod / gist:6029c9f93be7bc346ec7
Created February 19, 2016 13:08
Sample code that works with Nunit to prepare it for parallelization
using NUnit.Framework;
using OpenQA.Selenium.Firefox;
namespace ParallelLocal
{
[TestFixture]
public class ParallelLocal
{
[Test]
public void Test1()
@nadvolod
nadvolod / gist:8af1bb1dd39c5a684382
Created February 19, 2016 13:34
Two parallel Nunit tests ready to be ran
using NUnit.Framework;
using OpenQA.Selenium.Firefox;
namespace ParallelLocal
{
[TestFixture]
[Parallelizable]
public class ParallelLocal
{
[Test]
@nadvolod
nadvolod / gist:2841fa4ccb24ac4b26ff
Created February 23, 2016 13:54
Sample Selenium Webdriver test that is ready to be ran in BrowserStack in parallel mode.
[TestFixture]
[Parallelizable]
public class BrowserstackTest2
{
private IWebDriver driver;
[SetUp]
public void Init()
{
DesiredCapabilities capability = DesiredCapabilities.Firefox();
@nadvolod
nadvolod / gist:34c01cda52889c112d32
Last active March 10, 2016 13:27
Parallel test using sauce labs
using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
namespace SauceLabsParallelTests
{
[TestFixture("chrome", "39", "Windows 7", "", "")]
[Parallelizable]
public class SauceNUnitTest2
@nadvolod
nadvolod / gist:22622da95e405d38482ccf345eb9f479
Created April 18, 2016 00:02
Simple automated functional test that attempts to interact with an element that does not yet exist on the page
public class UnitTest1
{
private IWebDriver _driver;
[TestInitialize]
public void Setup()
{
//LocalInitialize();
BasicInitialize();
}
//find the element that has the text Hello World
var text = _driver.FindElement(By.XPath(".//*[contains(text(),'Hello World!')]"));
@nadvolod
nadvolod / Fluent Wait in Selenium Webdriver
Created May 2, 2016 23:20
How to create a fluent wait for IWebDriver
var _driver = new FirefoxDriver();
var wait = new DefaultWait<IWebDriver>(_driver)
{
Timeout = TimeSpan.FromSeconds(10),
Message = "Dude, where's my element?",
PollingInterval = TimeSpan.FromSeconds(1)
};
wait.IgnoreExceptionTypes(typeof(NoSuchElementException));
var myElement = wait.Until(ElementIsVisible(elementId));
@nadvolod
nadvolod / WebDriverWait class
Created May 3, 2016 22:43
WebDriverWait class definition
namespace OpenQA.Selenium.Support.UI
{
//
// Summary:
// Provides the ability to wait for an arbitrary condition during test execution.
public class WebDriverWait : DefaultWait<IWebDriver>
{
public WebDriverWait(IWebDriver driver, TimeSpan timeout);
public WebDriverWait(IClock clock, IWebDriver driver, TimeSpan timeout, TimeSpan sleepInterval);
}
@nadvolod
nadvolod / Complicated app
Created May 15, 2016 02:09
How to handle a complicated with application with frames and dynamic elements
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)