Skip to content

Instantly share code, notes, and snippets.

View ultimate-qa2's full-sized avatar

Ultimate QA ultimate-qa2

View GitHub Profile
namespace Applitools
{
[TestFixture]
[Category("Examples of different baselines")]
[Parallelizable]
public class BaselinesExamples : BaseClass
public class BaselinesExamples : BaseClass
{
//These have been moved to BaseClass
//public const string AppName = "sample app 1";
//public string TestCaseName => "Test1";
[Test]
public void SetBaselineUsingAppName()
{
GoToPricingPage();
//Here we are initializing the test in Applitools and passing in 4 parameters
// the IWebDriver, application name, test name, viewport size to open our app in
Eyes.Open(Driver, AppName, TestCaseName, Resolution1080P);
//Use the Applitools algorithm to check the whole page for visual validity
Eyes.CheckWindow();
Eyes.Open(Driver, AppName, TestCaseName, Resolution1080P);
Eyes.CheckWindow("FullPageScreenshot");
[Test]
public void SetBaselineUsingDifferentAppName()
{
GoToPricingPage();
Eyes.Open(Driver, "app 2", TestCaseName, Resolution1080P);
Eyes.CheckWindow();
[Test]
public void SetBaselineUsingTestName()
{
GoToPricingPage();
//all the parameters are the same, except we provided a new test name
Eyes.Open(Driver, AppName, "new test name", Resolution1080P);
Eyes.CheckWindow();
[Test]
public void SetBaselineUsingViewportSize()
{
GoToPricingPage();
//all the parameters are the same, except we provided a new viewport size
Eyes.Open(Driver, AppName, TestCaseName, Resolution720P);
Eyes.CheckWindow();
}
[SetUp]
public void SetupForEverySingleTestMethod()
{
Driver = new ChromeDriver();
Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
Eyes = new Eyes
{
//This sets the Applitools API key so that you can access the account
//ApiKey = "vDPsWHm9wt7dIAvfQRH79HF105is4Lhc9710rH1xW7BUl0146";
ApiKey = Environment.GetEnvironmentVariable("APPLITOOLS_API_KEY",
[TearDown]
public void TearDownForEverySingleTestMethod()
{
//Close your Selenium browser
Driver.Quit();
//Close applitools eyes so that your test run is saved
Eyes.Close();
//Quit applitools if it is not already closed
Eyes.AbortIfNotClosed();
}
[Test]
public void SetBaselineUsingDifferentAppName()
{
GoToPricingPage();
Eyes.Open(Driver, "app 2", TestCaseName, Resolution1080P);
Eyes.CheckWindow();
}
[Test]
public void SetBaselineUsingTestName()