public void SeleniumCreateNewTestObject() { this.CreateNewTestObject(); SeleniumTestObject newTestObject = this.TestObject; Assert.AreEqual(this.WebDriver.ToString(), newTestObject.WebDriver.ToString()); Assert.AreEqual(this.Log.ToString(), newTestObject.Log.ToString()); Assert.AreEqual(this.SoftAssert.ToString(), newTestObject.SoftAssert.ToString()); Assert.AreEqual(this.PerfTimerCollection.ToString(), newTestObject.PerfTimerCollection.ToString()); }
public void TestObjectWithExistingDriverAndLog() { SeleniumTestObject newTestObject = new SeleniumTestObject(this.WebDriver, this.Log, "TEST"); Assert.AreEqual(this.Log, newTestObject.Log); Assert.AreNotEqual(this.SoftAssert, newTestObject.SoftAssert); Assert.AreEqual("TEST", newTestObject.PerfTimerCollection.TestName); Assert.AreNotEqual(this.PerfTimerCollection, newTestObject.PerfTimerCollection); Assert.AreNotEqual(this.TestObject.Values, newTestObject.Values); Assert.AreNotEqual(this.TestObject.Objects, newTestObject.Objects); Assert.AreNotEqual(this.TestObject.ManagerStore, newTestObject.ManagerStore); Assert.AreNotEqual(this.TestObject.AssociatedFiles, newTestObject.AssociatedFiles); }
/// <summary> /// Add an image to our html logger /// </summary> /// <param name="testObject">The test object</param> /// <param name="path">Path to the image</param> private void IncludeScreeshot(SeleniumTestObject testObject, string path) { var writer = new StreamWriter(((FileLogger)testObject.Log).FilePath, true); writer.WriteLine(StringProcessor.SafeFormatter( "<div class='collapse col-12 show' data-logtype='IMAGE'><div class='card'><div class='card-body'><h6 class='card-subtitle mb-1'></h6></div><a class='pop'><img class='card-img-top rounded' src='{0}'style='width: 200px;'></a></div></div>", path)); writer.Flush(); writer.Close(); // Add the file as an attachment this.TestObject.AddAssociatedFile(path); }
/// <summary> /// Initializes a new instance of the <see cref="FluentElement" /> class /// </summary> /// <param name="testObject">The base Selenium test object</param> /// <param name="locator">The 'by' selector for the element</param> /// <param name="userFriendlyName">A user friendly name, for logging purposes</param> /// <example> /// <code source = "../SeleniumUnitTesting/FluentElementUnitTests.cs" region="FluentElementCreate" lang="C#" /> /// </example> public FluentElement(SeleniumTestObject testObject, By locator, string userFriendlyName) { this.TestObject = testObject; this.By = locator; this.userFriendlyName = userFriendlyName; }
/// <summary> /// Initializes a new instance of the <see cref="LazyElement" /> class /// </summary> /// <param name="testObject">The base Selenium test object</param> /// <param name="driver">The web driver</param> /// <param name="locator">The 'by' selector for the element</param> /// <param name="userFriendlyName">A user friendly name, for logging purposes</param> public LazyElement(SeleniumTestObject testObject, IWebDriver driver, By locator, [CallerMemberName] string userFriendlyName = null) : base(testObject, driver, () => driver.GetWaitDriver(), locator, userFriendlyName) { }
/// <summary> /// Initializes a new instance of the <see cref="Model1" /> class. /// </summary> /// <param name="webDriver">The selenium web driver</param> public AsyncPage(SeleniumTestObject testObject) : base(testObject) { }
/// <summary> /// Initializes a new instance of the <see cref="HomePageModel" /> class. /// </summary> /// <param name="testObject">The selenium test object</param> public HomePageModel(SeleniumTestObject testObject) { this.testObject = testObject; }
/// <summary> /// Initializes a new instance of the <see cref="UserLoginPage" /> class. /// </summary> /// <param name="testObject">The selenium test object</param> public UserLoginPage(SeleniumTestObject testObject) : base(testObject) { this.testObject = testObject; }
/// <summary> /// Initializes a new instance of the <see cref="MyOrderPageModel" /> class. /// </summary> /// <param name="testObject">The selenium test object</param> public MyOrderPageModel(SeleniumTestObject testObject) : base(testObject) { this.testObject = testObject; }
/// <summary> /// Initializes a new instance of the <see cref="LazyElement" /> class /// </summary> /// <param name="testObject">The base Selenium test object</param> /// <param name="locator">The 'by' selector for the element</param> /// <param name="userFriendlyName">A user friendly name, for logging purposes</param> /// <example> /// <code source = "../SeleniumUnitTesting/LazyElementUnitTests.cs" region="LazyElementCreate" lang="C#" /> /// </example> public LazyElement(SeleniumTestObject testObject, By locator, [CallerMemberName] string userFriendlyName = null) { this.TestObject = testObject; this.By = locator; this.userFriendlyName = userFriendlyName; }
/// <summary> /// Initializes a new instance of the <see cref="Model1" /> class. /// </summary> /// <param name="webDriver">The selenium web driver</param> public HowWorkPage(SeleniumTestObject testObject) : base(testObject) { }
/// <summary> /// Initializes a new instance of the <see cref="Model1" /> class. /// </summary> /// <param name="webDriver">The selenium web driver</param> protected BaseSubSitePage(SeleniumTestObject testObject) : base(testObject) { }
/// <summary> /// Initializes a new instance of the <see cref="HomePageModel" /> class. /// </summary> /// <param name="testObject">The selenium test object</param> public HomePageModel(SeleniumTestObject testObject) : base(testObject) { }
/// <summary> /// Initializes a new instance of the <see cref="HomePage" /> class. /// </summary> /// <param name="testObject">The selenium test object</param> public HomePage(SeleniumTestObject testObject) : base(testObject) { this.testObject = testObject; }
/// <summary> /// Initializes a new instance of the <see cref="Contact" /> class. /// </summary> /// <param name="testObject">The selenium test object</param> public Home(SeleniumTestObject testObject) : base(testObject) { }
/// <summary> /// Initializes a new instance of the <see cref="LoginPageModel" /> class. /// </summary> /// <param name="testObject">The test object</param> public LoginPageModel(SeleniumTestObject testObject) { this.testObject = testObject; }
/// <summary> /// Initializes a new instance of the <see cref="Contact" /> class. /// </summary> /// <param name="testObject">The selenium test object</param> public Contact(SeleniumTestObject testObject) : base(testObject) { }
/// <summary> /// Initializes a new instance of the <see cref="Model1" /> class. /// </summary> /// <param name="webDriver">The selenium web driver</param> public AboutPage(SeleniumTestObject testObject) : base(testObject) { }
/// <summary> /// Initializes a new instance of the <see cref="LoginPageModel" /> class. /// </summary> /// <param name="testObject">The test object</param> public LoginPageModel(SeleniumTestObject testObject) : base(testObject) { }
/// <summary> /// Initializes a new instance of the <see cref="LazyElement" /> class /// </summary> /// <param name="testObject">The base Selenium test object</param> /// <param name="locator">The 'by' selector for the element</param> /// <param name="userFriendlyName">A user friendly name, for logging purposes</param> public LazyElement(SeleniumTestObject testObject, By locator, [CallerMemberName] string userFriendlyName = null) : base(testObject, testObject.WebDriver, locator, userFriendlyName) { }