Skip to content

Instantly share code, notes, and snippets.

View ultimate-qa2's full-sized avatar

Ultimate QA ultimate-qa2

View GitHub Profile
[Test]
public void TestBaseline()
{
GoToPricingPage();
UpdateElements();
Eyes.Open(Driver, AppName, TestCaseName, Resolution1080P);
Eyes.CheckWindow();
}
public void IgnoreRegionUsingFindElements()
{
Eyes.Open(Driver, AppName, "IgnoreRegionUsingFindElements", Resolution1080P);
//Ignoring with FindElement()
Eyes.Check("IgnoreRegionUsingFindElements", Target.Window().
Ignore(Driver.FindElements(PriceLocator)[1]));
}
public void IgnoreRegionUsingBy()
{
Eyes.Open(Driver, AppName, "IgnoreRegionUsingBy", Resolution1080P);
//Ignoring an element with By
Eyes.Check("IgnoreRegionUsingBy", Target.Window().Ignore(PriceLocator));
}
public void IgnoreMultipleElements()
{
Eyes.Open(Driver, AppName, "IgnoreMultipleElements", Resolution1080P);
//Ignore multiple elements with a single Check()
Eyes.Check("IgnoreMultipleElements", Target.Window().Ignore(PriceLocator, SubheaderLocator));
}
public void FloatingRegion()
{
Eyes.Open(Driver, AppName, "FloatingRegion", Resolution1080P);
//This will add a floating region to the social sharing toolbar
Eyes.Check("FloatingRegion", Target.Window().Floating(SocialSharingToolbar));
}
[Test]
public void StrictRegion()
{
Eyes.Open(Driver, AppName, "StrictRegion", Resolution1080P);
Eyes.MatchLevel = MatchLevel.Layout;
//This will add a strict region to all the price options
Eyes.Check("StrictRegion", Target.Window().Strict(PriceLocator));
}
[Test]
public void ContentRegion()
{
Eyes.Open(Driver, AppName, "ContentRegion", Resolution1080P);
//This will add a content region to all the price options
Eyes.Check("ContentRegion", Target.Window().Content(PriceLocator));
}
[Test]
public void LayoutRegion()
{
Eyes.Open(Driver, AppName, "LayoutRegion", Resolution1080P);
//This will add a layout region to the section that holds price information
Eyes.Check("LayoutRegion", Target.Window().Layout(
Driver.FindElement(By.XPath("//*[@class='et_pb_module et_pb_pricing " +
"clearfix et_pb_pricing_1 et_pb_pricing_tables_0 " +
"et_pb_no_featured_in_first_row']"))));
}
public class MatchLevels : BaseClass
{
[Test]
public void ContentMatchLevel()
{
//Set the applitools match level to Content
Eyes.MatchLevel = MatchLevel.Content;
//Will open the fake pricing page
GoToPricingPage();
//Will change the first element to a Euro symbol instead of the $
private void ChangeToEuroAndUpdateColor()
{
//take the first element with class name et_pb_sum and update the value to what's specified
Javascript.ExecuteScript(
"document.getElementsByClassName('et_pb_sum')[0].innerText = \"€0\";");
var element = Driver.FindElement(By.TagName("h1"));
//Executes some javascript that updates the color of the h1 element on the page to the color specified
Javascript.ExecuteScript(
"arguments[0].setAttribute('style', 'color:#f9ca33!important')",element);
}