namespace SanityTesting
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework.Constraints;
using NUnit.Framework;
using NUnit.Core.Extensions;
using System.Configuration;
using System.IO;
using System.Reflection;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium;
using Syncfusion.UnitTesting.Framework;
using OpenQA.Selenium.Remote;
using System.Threading;
using OpenQA.Selenium.Support.UI;
using System.Collections;
using OpenQA.Selenium.Firefox;
using System.Diagnostics;
using System.Globalization;
using System.Drawing;
using SanityTesting.AccordionFluent;
using System.Windows.Forms;
[TestFixture("Firefox")]
[TestDirectory("..\\..\\Accordion\\")]
public class EmberJS_Accordion : NUnitUtil
{
string activeBrowser;
public EmberJS_Accordion(string browser)
{
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\Drivers");
service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
System.Environment.SetEnvironmentVariable("webdriver.gecko.driver", "C:\\Drivers\\geckodriver.exe");
FirefoxDriver driver = new FirefoxDriver(service); // FirefoxDriver driver = new FirefoxDriver();
//driver = GetWebDriverForBrowser(browser);
//FirefoxProfile profile = new FirefoxProfile();
//profile.SetPreference("browser.startup.page", 0); // Empty start page
//profile.SetPreference("browser.startup.homepage_override.mstone", "ignore"); // Suppress the "What's new" page
// return new FirefoxDriver(profile);
activeBrowser = browser;
}
[TestFixtureTearDown]
public void quitDriver()
{
driver.Quit();
}
public void TakeAndCompareScreenshotByLocator(By Locator, string fileName)
{
IWebElement contents = driver.FindElementAfterClickable(Locator);
TakeAndCompareScreenshot(contents, fileName);
}
[Test, TestCaseSource(typeof(AccordionModel), "Sanity_Accordion")]
[Category("Sanity")]
[Component(Component.Accordion)]
public void EmberJS_Accordion_Sanity(string url, int time)
{
AutomationHelpers.GotoPage(driver, url);
driver.Navigate().Refresh();
driver.WaitForElementClickable(By.CssSelector(".e-acrdn"), time);
Thread.Sleep(200);
IWebElement contents = driver.FindElement(By.ClassName("cols-sample-area"));
TakeAndCompareScreenshot(contents);
}
}