diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/BasicDriverInteractions.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/BasicDriverInteractions.cs deleted file mode 100644 index cef8e96..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/BasicDriverInteractions.cs +++ /dev/null @@ -1,53 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Examples; - -public class BasicDriverInteractions : TestBase -{ - [Fact] - public void NavigateAndGetWindowTitle() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/"); - - Assert.Equal("The Internet", DriverHandler.GetWindowTitle()); - } - - [Fact] - public void FindAlert() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/javascript_alerts") - .FindElement(By.CssSelector("button[onclick='jsConfirm()']")) - .Click(); - - DriverHandler.SwitchToAlert().Accept(); - - Assert.Equal( - "You clicked: Ok", - DriverHandler.FindElement(By.CssSelector("p[id='result']")).Text()); - } - - [Fact] - public void FindWindow() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/windows") - .FindElement(By.CssSelector("a[href='/windows/new']")) - .Click(); - - // If the window is not found, this will throw - Assert.Equal("New Window", - DriverHandler - .SwitchToWindow("New Window") - .GetWindowTitle()); - } - - [Fact] - public void FindFrame() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/nested_frames"); - - Assert.Equal("LEFT", - DriverHandler.SwitchToIFrame( - By.CssSelector("frame[src='/frame_top']"), - By.CssSelector("frame[src='/frame_left']")) - .FindElement(By.CssSelector("body")) - .Text()); - } -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/BasicElementInteractions.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/BasicElementInteractions.cs deleted file mode 100644 index 3405032..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/BasicElementInteractions.cs +++ /dev/null @@ -1,102 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Examples; - -public class BasicElementInteractions : TestBase -{ - public BasicElementInteractions() - { - _DynamicLoadingPage = new DynamicLoadingPages(WebDriver); - _DynamicControlsPage = new DynamicControlsPage(WebDriver); - _DropDownPage = new DropDownPage(WebDriver); - _ShadowDomPage = new ShadowDomPage(WebDriver); - } - - private readonly DynamicLoadingPages _DynamicLoadingPage; - private readonly DynamicControlsPage _DynamicControlsPage; - private readonly DropDownPage _DropDownPage; - private readonly ShadowDomPage _ShadowDomPage; - - - // Below two tests should functionally operate the same - [Fact] - public void FindElementThatIsUnhiddenAfterPageLoad() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/dynamic_loading/1"); - - _DynamicLoadingPage.StartButton.GetWebElement().FindElements(OpenQA.Selenium.By.Id("testing")); - - _DynamicLoadingPage.StartButton.Click(); - - Assert.True( - _DynamicLoadingPage.HelloWorldLabel - .SetTimeoutSeconds(8) - .WaitForDisplayed(), - "Hello World label did not appear when we expected it to."); - } - - [Fact] - public void ClearAndSendKeys() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/dynamic_controls"); - _DynamicControlsPage.EnableDisableButton.Click(); - _DynamicControlsPage.TextBox.SendKeys("Hello!"); - Assert.Equal("Hello!", _DynamicControlsPage.TextBox.GetAttribute("value")); - _DynamicControlsPage.TextBox.Clear(); - Assert.Equal("", _DynamicControlsPage.TextBox.GetAttribute("value")); - } - - [Fact] - public void FindElementThatIsCreatedAfterPageLoad() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/dynamic_loading/2"); - - _DynamicLoadingPage.StartButton.Click(); - - Assert.True( - _DynamicLoadingPage.HelloWorldLabel - .SetTimeoutSeconds(8) - .WaitForDisplayed(), - "Hello World label did not appear when we expected it to."); - } - - [Fact] - public void CheckForVisibleStates() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/dynamic_controls"); - - Assert.True(_DynamicControlsPage.Checkbox.WaitForDisplayed()); - _DynamicControlsPage.RemoveAddButton.Click(); - Assert.True(_DynamicControlsPage.Checkbox.WaitForNotDisplayed()); - _DynamicControlsPage.RemoveAddButton.Click(); - Assert.True(_DynamicControlsPage.Checkbox.WaitForDisplayed()); - } - - [Fact] - public void CheckForElementEnabledStates() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/dynamic_controls"); - - Assert.True(_DynamicControlsPage.TextBox.WaitForDisabled()); - _DynamicControlsPage.EnableDisableButton.Click(); - Assert.True(_DynamicControlsPage.TextBox.WaitForEnabled()); - _DynamicControlsPage.EnableDisableButton.Click(); - Assert.True(_DynamicControlsPage.TextBox.WaitForDisabled()); - } - - [Fact] - public void ManipulateSelectElement() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/dropdown"); - _DropDownPage.DropDownSelect.SelectByText("Option 2"); - Assert.Equal("Option 2", _DropDownPage.DropDownSelect.SelectedOption.Text); - } - - [Fact] - public void FindElementsInShadowDom() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/shadowdom"); - string originalText = _ShadowDomPage.OriginalText.Text(); - string displayedText = _ShadowDomPage.DisplayedText.Text(); - Assert.Equal("My default text", originalText); - Assert.Equal("Let's have some different text!", displayedText); - } -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/ComplexScenarios.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/ComplexScenarios.cs deleted file mode 100644 index 2c85b64..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/ComplexScenarios.cs +++ /dev/null @@ -1,87 +0,0 @@ -using OpenQA.Selenium.Interactions; -using OpenQA.Selenium.Support.UI; -using System.Globalization; - -namespace IntelliTect.TestTools.Selenate.Examples; - -public class ComplexScenarios : TestBase -{ - public ComplexScenarios() - { - _Editor = new EditorPage(WebDriver); - _Slider = new SliderPage(WebDriver); - } - - private readonly EditorPage _Editor; - private readonly SliderPage _Slider; - - [Fact] - public void ComplexWait() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/tinymce"); - // Group together, as each menu click must occur with the prior one in order to succeed. - - Assert.True(_Editor.MenuBar.WaitForDisplayed()); - - Assert.True( - OpenMenu( - _Editor.FormatMenu.Locator, - _Editor.FormatsMenu.Locator)); - - Assert.True( - OpenMenu( - _Editor.FormatsMenu.Locator, - _Editor.HeadingsMenu.Locator)); - - Assert.True( - OpenMenu( - _Editor.HeadingsMenu.Locator, - _Editor.Heading1Option.Locator)); - - _Editor.Heading1Option.Click(); - - Assert.Equal("Heading 1", _Editor.ParagraphDropDown.Text()); - - // Each menu item must be clicked, then assess the next menu item for completeness. - // If the second item does not appear, the immediately preceding menu item must be re-clicked. - // Group both calls together in a single wait so Selenium retries both. - bool OpenMenu(By originalLocator, By secondLocator) - { - WebDriverWait wait = new( - DriverHandler.WrappedDriver, - TimeSpan.FromSeconds(5)); - - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(StaleElementReferenceException)); - - return wait.Until(x => - { - x.FindElement(originalLocator).Click(); - return x.FindElement(secondLocator).Displayed; - }); - } - } - - [Fact] - public void DragAndDrop() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/horizontal_slider"); - - Assert.True(_Slider.Slider.WaitForDisplayed(), - "Slider did not appear when we expected it to."); - - var slider = _Slider.Slider.GetWebElement(); - - Actions actions = new(DriverHandler.WrappedDriver); - actions.MoveToElement(slider, 0, 0) - .ClickAndHold() - .MoveByOffset(slider.Size.Width / 2, 0) - .Release() - .Perform(); - - decimal sliderNum = Convert.ToDecimal(_Slider.Number.Text(), CultureInfo.InvariantCulture); - Assert.True(sliderNum > 0, - $"Expected slider number to be larger than 0, but was actually {sliderNum}"); - } -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/ElementsInteractions.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/ElementsInteractions.cs deleted file mode 100644 index 147580a..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/ElementsInteractions.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Examples; - -public class ElementsInteractions : TestBase -{ - public ElementsInteractions() - { - _ChallengingDomPage = new ChallengingDomPage(WebDriver); - } - - private ChallengingDomPage _ChallengingDomPage; - - [Fact] - public void GetASingleElementFromCollection() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/challenging_dom"); - string textToFind = "Iuvaret0"; - IWebElement foundElem = _ChallengingDomPage.FirstRow.GetSingleWebElement(x => x.Text == textToFind); - // Make sure GetSingleElement actually returned the expected element. - Assert.Equal( - textToFind, - foundElem.Text); - } - - [Fact] - public void GetAListOfElementsFromCollection() - { - DriverHandler.NavigateToPage("https://the-internet.herokuapp.com/challenging_dom"); - int foundCount = _ChallengingDomPage.Headers.GetAllWebElements(x => x.Displayed).Count; - Assert.Equal( - 7, - foundCount); - } -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/Global.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/Global.cs deleted file mode 100644 index adce365..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/Global.cs +++ /dev/null @@ -1,4 +0,0 @@ -global using IntelliTect.TestTools.Selenate.Examples.Pages; -global using OpenQA.Selenium; -global using System; -global using Xunit; \ No newline at end of file diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/IntelliTect.TestTools.Selenate.Examples.csproj b/Examples/IntelliTect.TestTools.Selenate.Examples/IntelliTect.TestTools.Selenate.Examples.csproj deleted file mode 100644 index 2c83dfe..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/IntelliTect.TestTools.Selenate.Examples.csproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - netcoreapp3.1 - false - 10.0 - enable - true - 4 - CA1303;CA2234 - - - - - all - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/ChallengingDomPage.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/ChallengingDomPage.cs deleted file mode 100644 index 495eb4e..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/ChallengingDomPage.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Examples.Pages; - -public class ChallengingDomPage -{ - public ChallengingDomPage(IWebDriver driver) - { - _Driver = driver ?? throw new ArgumentNullException(nameof(driver)); - } - - // NOTE: Tables are a known deficiency in Selenate. - // An upcoming feature update will include better support for this. - public ElementHandler Table => new(_Driver, By.CssSelector("table")); - public ElementsHandler Headers => Table.FindElements(By.CssSelector("thead th")); - public ElementsHandler FirstRow => Table.FindElements(By.CssSelector("tbody>tr:nth-of-type(1)>td")); - - private IWebDriver _Driver; -} \ No newline at end of file diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/DropDownPage.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/DropDownPage.cs deleted file mode 100644 index 237ce1a..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/DropDownPage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using OpenQA.Selenium.Support.UI; - -namespace IntelliTect.TestTools.Selenate.Examples.Pages; - -public class DropDownPage -{ - public DropDownPage(IWebDriver driver) - { - _Driver = driver ?? throw new ArgumentNullException(nameof(driver)); - } - - public ElementHandler DropDown => new ElementHandler(_Driver, By.Id("dropdown")); - public SelectElement DropDownSelect => new SelectElement(DropDown.GetWebElement()); - - private IWebDriver _Driver; -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/DynamicControlsPage.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/DynamicControlsPage.cs deleted file mode 100644 index df51276..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/DynamicControlsPage.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Examples.Pages; - -public class DynamicControlsPage -{ - public DynamicControlsPage(IWebDriver driver) - { - _Driver = driver ?? throw new ArgumentNullException(nameof(driver)); - } - - public ElementHandler RemoveAddButton => new ElementHandler(_Driver, By.CssSelector("button[onclick='swapCheckbox()']")); - public ElementHandler Checkbox => new ElementHandler(_Driver, By.CssSelector("input[type='checkbox']")); - public ElementHandler TextBox => new ElementHandler(_Driver, By.CssSelector("input[type='text']")); - public ElementHandler EnableDisableButton => new ElementHandler(_Driver, By.CssSelector("button[onclick='swapInput()']")); - - private IWebDriver _Driver; -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/DynamicLoadingPages.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/DynamicLoadingPages.cs deleted file mode 100644 index 0c1a56e..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/DynamicLoadingPages.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Examples.Pages; - -public class DynamicLoadingPages -{ - public DynamicLoadingPages(IWebDriver driver) - { - _Driver = driver ?? throw new ArgumentNullException(nameof(driver)); - } - - // Multiple ways to approach element handler instantiation... - // This will reset any settings every time a new reference is made, so polling interval, timeout, etc. will not be retained across multiple calls within the same test. - public ElementHandler StartButton => new ElementHandler(_Driver, By.CssSelector("div[id='start']>button")); - - // This will retain any settings modified on the object across multiple calls within the same test, e.g. polling interval or timeout - public ElementHandler HelloWorldLabel - { - get - { - _HelloWorldLabel ??= new ElementHandler(_Driver, By.CssSelector("div[id='finish']>h4")); - return _HelloWorldLabel; - } - } - - private ElementHandler? _HelloWorldLabel; - private IWebDriver _Driver; -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/EditorPage.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/EditorPage.cs deleted file mode 100644 index 27b5e6b..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/EditorPage.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace IntelliTect.TestTools.Selenate.Examples.Pages; - -public class EditorPage -{ - public EditorPage(IWebDriver driver) - { - _Driver = driver ?? throw new ArgumentNullException(nameof(driver)); - } - - public ElementHandler MenuBar => new ElementHandler(_Driver, By.CssSelector("div[role='menubar']")); - public ElementHandler FormatMenu => new ElementHandler(_Driver, By.XPath("//span[text() = 'Format']")); - public ElementHandler FormatsMenu => new ElementHandler(_Driver, By.XPath("//div[text() = 'Formats']")); - public ElementHandler HeadingsMenu => new ElementHandler(_Driver, By.XPath("//div[text() = 'Headings']")); - public ElementHandler Heading1Option => new ElementHandler(_Driver, By.XPath("//h1[text() = 'Heading 1']")); - public ElementHandler ParagraphDropDown => new ElementHandler(_Driver, By.CssSelector("span[class='tox-tbtn__select-label']")); - - private IWebDriver _Driver; -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/ShadowDomPage.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/ShadowDomPage.cs deleted file mode 100644 index e50de8b..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/ShadowDomPage.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Examples.Pages; - -internal class ShadowDomPage -{ - public ShadowDomPage(IWebDriver driver) - { - Driver = driver; - } - - public ElementHandler ShadowRootElement => new ElementHandler(Driver, By.CssSelector("my-paragraph")); - public ISearchContext ShadowRootContext => ShadowRootElement.GetWebElement().GetShadowRoot(); - public ElementHandler OriginalText => new ElementHandler(Driver, By.CssSelector("slot[name='my-text']")).SetSearchContext(ShadowRootContext); - public ElementHandler DisplayedText => new ElementHandler(Driver, By.CssSelector("span[slot='my-text']")); - - private IWebDriver Driver { get; } -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/SliderPage.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/SliderPage.cs deleted file mode 100644 index 6ccc3f3..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/Pages/SliderPage.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Examples.Pages; - -public class SliderPage -{ - public SliderPage(IWebDriver driver) - { - _Driver = driver ?? throw new ArgumentNullException(nameof(driver)); - } - - public ElementHandler Slider => new ElementHandler(_Driver, By.CssSelector("input[type='range']")); - public ElementHandler Number => new ElementHandler(_Driver, By.Id("range")); - - private IWebDriver _Driver; -} diff --git a/Examples/IntelliTect.TestTools.Selenate.Examples/TestBase.cs b/Examples/IntelliTect.TestTools.Selenate.Examples/TestBase.cs deleted file mode 100644 index 35b33a2..0000000 --- a/Examples/IntelliTect.TestTools.Selenate.Examples/TestBase.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Examples; - -public class TestBase : IDisposable -{ - private bool _DisposedValue; - - public TestBase() - { - WebDriver = new WebDriverFactory(BrowserType.Chrome).GetDriver(); - DriverHandler = new DriverHandler(WebDriver); - } - - protected IWebDriver WebDriver { get; } - protected DriverHandler DriverHandler { get; } - - protected virtual void Dispose(bool disposing) - { - if (!_DisposedValue) - { - if (disposing) - { - WebDriver.Dispose(); - } - _DisposedValue = true; - } - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - -} diff --git a/IntelliTect.TestTools.Selenate.Tests/DriverHandlerTests.cs b/IntelliTect.TestTools.Selenate.Tests/DriverHandlerTests.cs deleted file mode 100644 index bdf596c..0000000 --- a/IntelliTect.TestTools.Selenate.Tests/DriverHandlerTests.cs +++ /dev/null @@ -1,273 +0,0 @@ -using System.Reflection; - -namespace IntelliTect.TestTools.Selenate.Tests; - -public class DriverHandlerTests -{ - [Fact] - public void SetTimeoutWithNegativeValueThrowsException() - { - var mockDriver = new Mock(); - DriverHandler handler = new(mockDriver.Object); - - Assert.Throws(() => handler.SetTimeout(TimeSpan.FromSeconds(-1))); - } - - [Fact] - public void SetTimeoutSecondsWithNegativeValueThrowsException() - { - var mockDriver = new Mock(); - DriverHandler handler = new(mockDriver.Object); - - Assert.Throws(() => handler.SetTimeoutSeconds(-1)); - } - - [Fact] - public void SetPollingIntervalWithNegativeValueThrowsException() - { - var mockDriver = new Mock(); - DriverHandler handler = new(mockDriver.Object); - - Assert.Throws(() => handler.SetPollingInterval(TimeSpan.FromSeconds(-1))); - } - - [Fact] - public void SetPollingIntervalMillisecondsWithNegativeValueThrowsException() - { - var mockDriver = new Mock(); - DriverHandler handler = new(mockDriver.Object); - - Assert.Throws(() => handler.SetPollingIntervalMilliseconds(-1)); - } - - [Theory] - [InlineData("")] - [InlineData(" ")] - public void NavigateToPageWithEmptyStringThrowsException(string val) - { - var mockDriver = new Mock(); - DriverHandler handler = new(mockDriver.Object); - - Assert.Throws(() => handler.NavigateToPage(val)); - } - - [Fact] - public void SetTimeoutChangesDefaultValue() - { - var mockDriver = new Mock(); - - DriverHandler handler = new(mockDriver.Object); - handler.SetTimeout(TimeSpan.FromSeconds(1)); - - Assert.Equal( - TimeSpan.FromSeconds(1), - handler - .GetType() - .GetProperty("Timeout", BindingFlags.Instance | BindingFlags.NonPublic)? - .GetValue(handler)); - } - - [Fact] - public void SetTimeoutSecondsChangesDefaultValue() - { - var mockDriver = new Mock(); - - DriverHandler handler = new(mockDriver.Object); - handler.SetTimeoutSeconds(1); - - Assert.Equal( - TimeSpan.FromSeconds(1), - handler - .GetType() - .GetProperty("Timeout", BindingFlags.Instance | BindingFlags.NonPublic)? - .GetValue(handler)); - } - - [Fact] - public void SetPollingIntervalChangesDefaultValue() - { - var mockDriver = new Mock(); - - DriverHandler handler = new(mockDriver.Object); - handler.SetPollingInterval(TimeSpan.FromMilliseconds(1)); - - Assert.Equal( - TimeSpan.FromMilliseconds(1), - handler.GetType().GetProperty("PollingInterval", BindingFlags.Instance | BindingFlags.NonPublic)? - .GetValue(handler)); - } - - [Fact] - public void SetPollingMillisecondsIntervalChangesDefaultValue() - { - var mockDriver = new Mock(); - - DriverHandler handler = new(mockDriver.Object); - handler.SetPollingIntervalMilliseconds(1); - - Assert.Equal( - TimeSpan.FromMilliseconds(1), - handler - .GetType() - .GetProperty("PollingInterval", BindingFlags.Instance | BindingFlags.NonPublic)? - .GetValue(handler)); - } - - [Fact] - public void NavigateToPageProperlySetsWebDriverUrl() - { - var mockNavigation = new Mock(); - mockNavigation - .Setup(n => n.GoToUrl(It.IsNotNull())) - .Verifiable(); - - var mockDriver = new Mock(); - mockDriver - .Setup(x => x.Navigate()) - .Returns(mockNavigation.Object); - - DriverHandler handler = new(mockDriver.Object); - handler.NavigateToPage(new Uri("http://www.someSuccess.com/")); - - mockNavigation.Verify(d => d.GoToUrl(It.IsNotNull()), Times.Once); - } - - [Fact] - public void NavigateToPageWithStringProperlySetsWebDriverUrl() - { - var mockNavigation = new Mock(); - mockNavigation - .Setup(n => n.GoToUrl(It.IsNotNull())) - .Verifiable(); - - var mockDriver = new Mock(); - mockDriver.Setup(x => x.Navigate()).Returns(mockNavigation.Object); - - DriverHandler handler = new(mockDriver.Object); - handler.NavigateToPage("http://www.someSuccess.com/"); - - mockNavigation.Verify(d => d.GoToUrl(It.IsNotNull()), Times.Once); - } - - [Fact] - public void FindElementReturnsElementHandler() - { - var mockElement = new Mock(); - var mockDriver = new Mock(); - mockDriver - .Setup(x => x.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - DriverHandler handler = new(mockDriver.Object); - ElementHandler elem = handler.FindElement(By.Id("Testing")); - Assert.NotNull(elem); - } - - [Fact] - public void FindElementsReturnsElementsHandler() - { - var mockElement = new Mock(); - var mockDriver = new Mock(); - mockDriver - .Setup(x => x.FindElements(It.IsAny())) - .Returns(new ReadOnlyCollection( - new List { mockElement.Object })); - - DriverHandler handler = new(mockDriver.Object); - ElementsHandler elem = handler.FindElements(By.Id("Testing")); - Assert.NotNull(elem); - } - - [Fact] - public void GetWindowTitleReturnsDriverProperty() - { - string testTitle = "Test Window Title"; - var mockDriver = new Mock(); - mockDriver - .SetupGet(w => w.Title) - .Returns(testTitle); - - DriverHandler handler = new(mockDriver.Object); - - string title = handler.GetWindowTitle(); - - Assert.Equal(testTitle, title); - } - - [Fact] - public void SwitchWindowInvokesSwitchToWindow() - { - string windowTitle = "Testing!"; - var mockDriver = new Mock(); - - var mockNavigation = new Mock(); - mockNavigation - .Setup(n => n.Window(It.IsAny())) - .Returns(mockDriver.Object) - .Verifiable(); - - mockDriver - .Setup(w => w.SwitchTo()) - .Returns(mockNavigation.Object); - - mockDriver - .Setup(w => w.Title) - .Returns(windowTitle); - mockDriver - .Setup(h => h.WindowHandles) - .Returns(new ReadOnlyCollection(new List { windowTitle })); - - - DriverHandler handler = new(mockDriver.Object); - handler.SwitchToWindow(windowTitle); - - mockNavigation.Verify(w => w.Window(It.IsAny()), Times.Once); - } - - [Fact] - public void SwitchAlertInvokesSwitchToAlert() - { - var mockAlert = new Mock(); - - var mockNavigation = new Mock(); - mockNavigation - .Setup(n => n.Alert()) - .Returns(mockAlert.Object) - .Verifiable(); - - var mockDriver = new Mock(); - mockDriver - .Setup(w => w.SwitchTo()) - .Returns(mockNavigation.Object); - - DriverHandler handler = new(mockDriver.Object); - handler.SwitchToAlert(); - - mockNavigation.Verify(w => w.Alert(), Times.Once); - } - - [Fact] - public void SwitchFrameInvokesSwitchToFrame() - { - var mockElement = new Mock(); - var mockDriver = new Mock(); - mockDriver - .Setup(x => x.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var mockNavigation = new Mock(); - mockNavigation - .Setup(n => n.Frame(It.IsAny())) - .Returns(mockDriver.Object) - .Verifiable(); - - mockDriver - .Setup(w => w.SwitchTo()) - .Returns(mockNavigation.Object); - - DriverHandler handler = new(mockDriver.Object); - handler.SwitchToIFrame(By.Id("Testing!")); - - mockNavigation.Verify(w => w.Frame(It.IsAny()), Times.Once); - } -} diff --git a/IntelliTect.TestTools.Selenate.Tests/ElementHandlerTests.cs b/IntelliTect.TestTools.Selenate.Tests/ElementHandlerTests.cs deleted file mode 100644 index dfa1c89..0000000 --- a/IntelliTect.TestTools.Selenate.Tests/ElementHandlerTests.cs +++ /dev/null @@ -1,421 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Tests; - -public class ElementHandlerTests -{ - [Fact] - public void ClickIsInvokedOnElementWhenFound() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Click()) - .Verifiable(); - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - element.Click(); - - mockElement.Verify(); - } - - [Fact] - public void ClickThrowsIfUnsuccessful() - { - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Throws(); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.Throws(() => element.Click()); - } - - [Fact] - public void SendTextIsInvokedOnElementWhenFoundl() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.SendKeys(It.IsAny())) - .Verifiable(); - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - element.SendKeys("Hello"); - - mockElement.Verify(d => d.SendKeys(It.IsAny()), Times.Once); - } - - [Fact] - public void SendTextThrowsIfUnsuccessful() - { - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Throws(); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.Throws(() => element.SendKeys("Hello")); - } - - [Fact] - public void ClearIsInvokedOnElementWhenFound() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Clear()) - .Verifiable(); - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - element.Clear(); - - mockElement.Verify(d => d.Clear(), Times.Once); - } - - [Fact] - public void ClearThrowsIfUnsuccessful() - { - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Throws(); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.Throws(() => element.Clear()); - } - - [Fact] - public void WaitForDisplayedReturnsTrueIfSuccessful() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Displayed) - .Returns(true); - - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.True(element.WaitForDisplayed()); - } - - [Fact] - public void WaitForDisplayedReturnsFalseIfUnsuccessful() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Displayed) - .Returns(false); - - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.False(element.WaitForDisplayed()); - } - - [Fact] - public void WaitForDisplayedReturnsFalseIfNoElement() - { - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Throws(); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.False(element.WaitForDisplayed()); - } - - [Fact] - public void WaitForNotDisplayedReturnsTrueIfSuccessful() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Displayed) - .Returns(false); - - var mockDriver = new Mock(); - mockDriver.Setup - (f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.True(element.WaitForNotDisplayed()); - } - - [Fact] - public void WaitForNotDisplayedReturnsTrueIfNoElement() - { - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Throws(); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.True(element.WaitForNotDisplayed()); - } - - [Fact] - public void WaitForNotDisplayedReturnsFalseUnsuccessful() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Displayed) - .Returns(true); - - var mockDriver = new Mock(); - mockDriver.Setup - (f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.False(element.WaitForNotDisplayed()); - } - - [Fact] - public void WaitForEnabledReturnsTrueIfSuccessful() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Enabled) - .Returns(true); - - var mockDriver = new Mock(); - mockDriver.Setup - (f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.True(element.WaitForEnabled()); - } - - [Fact] - public void WaitForEnabledReturnsFalseIfUnsuccessful() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Enabled) - .Returns(false); - - var mockDriver = new Mock(); - mockDriver.Setup - (f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.False(element.WaitForEnabled()); - } - - [Fact] - public void WaitForEnabledThrowsIfTimesOut() - { - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Throws(); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.Throws(() => element.WaitForEnabled()); - } - - [Fact] - public void WaitForDisabledReturnsTrueIfSuccessful() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Enabled) - .Returns(false); - - var mockDriver = new Mock(); - mockDriver.Setup - (f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.True(element.WaitForDisabled()); - } - - [Fact] - public void WaitForDisabledReturnsFalseIfUnsuccessful() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.Enabled) - .Returns(true); - - var mockDriver = new Mock(); - mockDriver.Setup - (f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.False(element.WaitForDisabled()); - } - - [Fact] - public void WaitForDisabledThrowsIfTimesOut() - { - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Throws(); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.Throws(() => element.WaitForDisabled()); - } - - [Fact] - public void GetAttributeProperlyReturnsExpectedAttribute() - { - var mockElement = new Mock(); - mockElement - .Setup(c => c.GetAttribute(It.IsAny())) - .Returns("Success"); - - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Returns(mockElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - - Assert.Equal("Success", element.GetAttribute("Test")); - } - - [Fact] - public void GetAttributeThrowsOnTimeout() - { - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Throws(); - - var element = SetupElementHandler(mockDriver.Object); - - var ex = Assert.Throws(() => element.GetAttribute("Test")); - Assert.Equal(typeof(NoSuchElementException), ex.InnerException?.GetType()); - } - - [Fact] - public void FindElementFromElementReturnsChildElement() - { - var childElement = new Mock(); - childElement - .Setup(c => c.GetAttribute(It.IsAny())) - .Returns("Success"); - - var parentElement = new Mock(); - parentElement - .Setup(c => c.FindElement(It.IsAny())) - .Returns(childElement.Object); - - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Returns(parentElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - var result = element - .FindElement(By.Id("test")) - .SetTimeout(TimeSpan.FromMilliseconds(20)) - .GetAttribute("test"); - - Assert.Equal("Success", result); - } - - [Fact] - public void ChainElementFindsThrowsExceptionIfChildNotFound() - { - var mockParentElement = new Mock(); - mockParentElement - .Setup(c => c.FindElement(It.IsAny())) - .Throws(); - - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Returns(mockParentElement.Object); - - var parentElement = SetupElementHandler(mockDriver.Object); - var childElement = parentElement - .FindElement(By.Id("test")) - .SetTimeout(TimeSpan.FromMilliseconds(20)); - - var ex = Assert.Throws(() => childElement.GetAttribute("Test")); - Assert.Equal(typeof(NoSuchElementException), ex.InnerException?.GetType()); - } - - [Fact] - public void ChainElementsFindReturnsElementHandler() - { - var childElement1 = new Mock(); - childElement1 - .Setup(c => c.Text) - .Returns("Success"); - - var childElement2 = new Mock(); - childElement2 - .Setup(c => c.Text) - .Returns("Failure"); - - List elements = new() - { - childElement1.Object, - childElement2.Object - }; - - ReadOnlyCollection childElements = new(elements); - - var parentElement = new Mock(); - parentElement - .Setup(c => c.FindElements(It.IsAny())) - .Returns(childElements); - - var mockDriver = new Mock(); - mockDriver - .Setup(f => f.FindElement(It.IsAny())) - .Returns(parentElement.Object); - - var element = SetupElementHandler(mockDriver.Object); - var result = element - .FindElements(By.Id("test")) - .SetTimeout(TimeSpan.FromMilliseconds(20)) - .GetSingleWebElement(d => d.Text == "Success"); - - Assert.Equal("Success", result.Text); - } - - private static ElementHandler SetupElementHandler(IWebDriver driver) - { - return new ElementHandler(driver, By.Id("test")) - .SetTimeout(TimeSpan.FromMilliseconds(20)) - .SetPollingIntervalMilliseconds(10); - } -} diff --git a/IntelliTect.TestTools.Selenate.Tests/ElementsHandlerTests.cs b/IntelliTect.TestTools.Selenate.Tests/ElementsHandlerTests.cs deleted file mode 100644 index 276e084..0000000 --- a/IntelliTect.TestTools.Selenate.Tests/ElementsHandlerTests.cs +++ /dev/null @@ -1,97 +0,0 @@ -namespace IntelliTect.TestTools.Selenate.Tests; - -public class ElementsHandlerTests -{ - [Fact] - public void GetTextReturnsExpectedWhenFound() - { - Assert.True(SetupMockedData().ContainsText("Testing1")); - } - - [Fact] - public void GetTextReturnsFalseWhenUnableToFindElementWithText() - { - Assert.False(SetupMockedData().ContainsText("TestingA")); - } - - [Fact] - public void GetSpecificExistingElementReturnsFoundElements() - { - Assert.NotNull( - SetupMockedData() - .GetSingleWebElement(x => - x.Displayed)); - } - - [Fact] - public void GetSpecificExistingElementThrowsWhenNoElementsMatch() - { - Assert.Throws(() => - SetupMockedData() - .GetSingleWebElement(x => - x.Text.Contains("Blaaaargh", StringComparison.OrdinalIgnoreCase))); - } - - [Fact] - public void GetElementsThrowsWhenNoElementsMatch() - { - Assert.Throws(() => - SetupMockedData() - .GetAllWebElements(x => - x.Text.Contains("Blaaaargh", StringComparison.OrdinalIgnoreCase))); - } - - [Fact] - public void GetSpecificExistingElementThrowsWhenMultipleElementsMatch() - { - Assert.Throws(() => - SetupMockedData() - .GetSingleWebElement(x => - x.Text.Contains("Testing", StringComparison.OrdinalIgnoreCase))); - } - - [Fact] - public void GetElementsReturnsWhenMultipleElementsMatch() - { - Assert.Equal(2, - SetupMockedData() - .GetAllWebElements(x => - x.Text.Contains("Testing", StringComparison.OrdinalIgnoreCase)) - .Count); - } - - [Fact] - public void GetSpecificExistingElementThrowsWhenNoElementsAreFound() - { - Assert.Throws(() => - SetupMockedData() - .SetLocator(By.Id("blarg")) - .GetSingleWebElement(x => - x.Text.Contains("Testing", StringComparison.OrdinalIgnoreCase))); - } - - private static ElementsHandler SetupMockedData() - { - var mockElement1 = new Mock(); - mockElement1.SetupGet(e1 => e1.Text).Returns("Testing1"); - mockElement1.SetupGet(e1 => e1.Displayed).Returns(true); - - var mockElement2 = new Mock(); - mockElement2.SetupGet(e2 => e2.Text).Returns("Testing2"); - mockElement2.SetupGet(e2 => e2.Displayed).Returns(false); - var mockDriver = new Mock(); - mockDriver.Setup - (f => f.FindElements(By.Id("test"))) - .Returns( - new ReadOnlyCollection( - new List { mockElement1.Object, mockElement2.Object })); - - mockDriver.Setup - (f => f.FindElements(By.Id("blarg"))) - .Returns(new ReadOnlyCollection(new List())); - - return new ElementsHandler(mockDriver.Object, By.Id("test")) - .SetTimeout(TimeSpan.FromMilliseconds(20)) - .SetPollingIntervalMilliseconds(10); - } -} \ No newline at end of file diff --git a/IntelliTect.TestTools.Selenate.Tests/Global.cs b/IntelliTect.TestTools.Selenate.Tests/Global.cs deleted file mode 100644 index 1af2183..0000000 --- a/IntelliTect.TestTools.Selenate.Tests/Global.cs +++ /dev/null @@ -1,6 +0,0 @@ -global using Moq; -global using OpenQA.Selenium; -global using System; -global using System.Collections.Generic; -global using System.Collections.ObjectModel; -global using Xunit; \ No newline at end of file diff --git a/IntelliTect.TestTools.Selenate.Tests/IntelliTect.TestTools.Selenate.Tests.csproj b/IntelliTect.TestTools.Selenate.Tests/IntelliTect.TestTools.Selenate.Tests.csproj deleted file mode 100644 index 1a799d5..0000000 --- a/IntelliTect.TestTools.Selenate.Tests/IntelliTect.TestTools.Selenate.Tests.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - netcoreapp3.1 - false - 10.0 - enable - true - 4 - CA1303;CA2234 - - - - - all - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - diff --git a/IntelliTect.TestTools.Selenate.slnf b/IntelliTect.TestTools.Selenate.slnf deleted file mode 100644 index 19ea08c..0000000 --- a/IntelliTect.TestTools.Selenate.slnf +++ /dev/null @@ -1,10 +0,0 @@ -{ - "solution": { - "path": "IntelliTect.TestTools.sln", - "projects": [ - "Examples\\IntelliTect.TestTools.Selenate.Examples\\IntelliTect.TestTools.Selenate.Examples.csproj", - "IntelliTect.TestTools.Selenate.Tests\\IntelliTect.TestTools.Selenate.Tests.csproj", - "IntelliTect.TestTools.Selenate\\IntelliTect.TestTools.Selenate\\IntelliTect.TestTools.Selenate.csproj" - ] - } -} \ No newline at end of file diff --git a/IntelliTect.TestTools.Selenate/Directory.Build.props b/IntelliTect.TestTools.Selenate/Directory.Build.props deleted file mode 100644 index 3886d3c..0000000 --- a/IntelliTect.TestTools.Selenate/Directory.Build.props +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - 1.1.1 - - Updates for moving back to WebDriverWait with more effective usage - - Mike Curn - A set of classes for interacting with Selenium in a way makes calls more reliable than the basic implementation of Selenium - selenium, ui test, automated test, testing, web test, extension - Initial release - - - diff --git a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/BrowserType.cs b/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/BrowserType.cs deleted file mode 100644 index 1eb583d..0000000 --- a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/BrowserType.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace IntelliTect.TestTools.Selenate -{ - /// - /// Enum representing all supported browser types of - /// - public enum BrowserType - { - Chrome, - HeadlessChrome, - Firefox, - Edge - } -} diff --git a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/DriverHandler.cs b/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/DriverHandler.cs deleted file mode 100644 index 2308468..0000000 --- a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/DriverHandler.cs +++ /dev/null @@ -1,217 +0,0 @@ -using OpenQA.Selenium; -using OpenQA.Selenium.Remote; -using OpenQA.Selenium.Support.UI; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; - -namespace IntelliTect.TestTools.Selenate -{ - /// - /// Class to handle interactions with a Selenium WebDriver - /// - public class DriverHandler : HandlerBase - { - /// - /// Constructor to wrap a specific instace of a WebDriver - /// - /// The WebDriver to wrap - public DriverHandler(IWebDriver driver) : base(driver) { } - - private FileInfo? ScreenshotLocation { get; set; } - - /// - /// Sets the maximum time that this instance will retry a specific interaction with a WebDriver before throwing. - /// - /// Duration to retry an action before throwing. - /// this - public DriverHandler SetTimeout(TimeSpan timeout) - { - return SetTimeout(timeout); - } - - /// - /// Sets the maximum time in seconds that this instance will retry a specific interaction with a WebDriver before throwing. - /// - /// Duration to retry an action before throwing. - /// this - public DriverHandler SetTimeoutSeconds(int timeoutInSeconds) - { - return SetTimeout(TimeSpan.FromSeconds(timeoutInSeconds)); - } - - /// - /// Sets the amount of time this instance will wait in between retrying a specific interaction. - /// - /// Time to wait in between retrying an action. - /// this - public DriverHandler SetPollingInterval(TimeSpan pollingInterval) - { - return SetPollingInterval(pollingInterval); - } - - /// - /// Sets the amount of time in milliseconds this instance will wait in between retrying a specific interaction. - /// - /// Time to wait in between retrying an action. - /// this - public DriverHandler SetPollingIntervalMilliseconds(int pollIntervalInMilliseconds) - { - return SetPollingInterval(TimeSpan.FromMilliseconds(pollIntervalInMilliseconds)); - } - - /// - /// Sets the location that will be used for saving a screenshot. - /// - /// The location to save a screensot of the browser being driven by the current WebDriver - /// this - public DriverHandler SetScreenshotLocation(FileInfo location) - { - ScreenshotLocation = location; - return this; - } - - /// - /// Send the browser being driven by the current WebDriver to a particular URL - /// - /// The page to go to by URI - /// this - public DriverHandler NavigateToPage(Uri uri) - { - if (uri is null) throw new ArgumentNullException(nameof(uri)); - WrappedDriver.Navigate().GoToUrl(uri); - return this; - } - - /// - /// Send the browser being driven by the current WebDriver to a particular URL - /// - /// The page to go to by string - /// this - public DriverHandler NavigateToPage(string uri) - { - if (string.IsNullOrWhiteSpace(uri)) throw new ArgumentNullException(nameof(uri)); - return NavigateToPage(new Uri(uri)); - } - - /// - /// Create an ElementHandler with the means to interact with a specific element in the browser - /// - /// The method to find an element - /// An ElementHandler wrapping interactions with a specific IWebElement - public ElementHandler FindElement(By by) - { - return new ElementHandler(WrappedDriver, by) - .SetPollingInterval(PollingInterval) - .SetTimeout(Timeout); - } - - /// - /// Create an ElementsHandler with the means to interact with a set of elements in the browser - /// - /// The method to find a set of elements - /// An ElementsHandler wrapping interactions with a set of IWebElements - public ElementsHandler FindElements(By by) - { - return new ElementsHandler(WrappedDriver, by) - .SetPollingInterval(PollingInterval) - .SetTimeout(Timeout); - } - - /// - /// Gets the currently wrapped Driver's window title - /// - /// The current window title - public string GetWindowTitle() - { - return WrappedDriver.Title; - } - - /// - /// Attempts to switch to the window by title for a certain number of seconds before failing if the switch is unsuccessful - /// - /// The title of the window to switch to - /// This driver focused on the new window - public DriverHandler SwitchToWindow(string title) - { - IWait wait = Wait; - wait.IgnoreExceptionTypes(typeof(NoSuchWindowException)); - wait.Until(w => { - IReadOnlyCollection handles = w.WindowHandles; - foreach(var h in handles) - { - w.SwitchTo().Window(h); - if (w.Title == title) return true; - } - - // We did not find the correct window. - return false; - }); - return this; - } - - /// - /// Checks for a present alert for a certain number of seconds before continuing - /// - /// The alert found - public IAlert SwitchToAlert() - { - IWait wait = Wait; - wait.IgnoreExceptionTypes( - typeof(NoAlertPresentException), - typeof(UnhandledAlertException)); - return wait.Until(a => a.SwitchTo().Alert()); - } - - /// - /// Switches to each frame in succession to avoid having to explicitely call SwitchTo() multipled times for nested frames - /// - /// The Selenium selectors to find the frame/iframe desired to interact with - /// The frame found - public DriverHandler SwitchToIFrame(params By[] bys) - { - IWait wait = Wait; - wait.IgnoreExceptionTypes( - typeof(NoSuchFrameException), - typeof(InvalidOperationException), - typeof(StaleElementReferenceException), - typeof(NotFoundException)); - - // Note, some applications will break out of switching to a frame if something on page is still loading. - // See if restarting the whole search like we currently do on PTT is necessary, or if we can just wait for something to finish loading - foreach (By by in bys) - { - wait.Until(f => f.SwitchTo().Frame(f.FindElement(by))); - } - - return this; - } - - /// - /// Take a screenshot of the browser and save it to the passed in fully qualified path. - /// Will not throw if the path does not exist. - /// - public void TakeScreenshot() - { - if(ScreenshotLocation is null) - { - ScreenshotLocation = new FileInfo( - Path.Combine(Path.GetTempPath(), - "screenshots", - $"{((RemoteWebDriver)WrappedDriver).Capabilities.GetCapability("browserName")}_{DateTime.Now:yyyy.MM.dd_hh.mm.ss}.png")); - } - - Directory.CreateDirectory(ScreenshotLocation.DirectoryName); - - ScreenshotLocation.Delete(); - - if (WrappedDriver is ITakesScreenshot takeScreenshot) - { - Screenshot screenshot = takeScreenshot.GetScreenshot(); - Debug.WriteLine($"Saving screenshot to location: {ScreenshotLocation.FullName}"); - screenshot?.SaveAsFile(ScreenshotLocation.FullName, ScreenshotImageFormat.Png); - } - } - } -} diff --git a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/ElementBase.cs b/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/ElementBase.cs deleted file mode 100644 index 06118b4..0000000 --- a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/ElementBase.cs +++ /dev/null @@ -1,19 +0,0 @@ -using OpenQA.Selenium; - -namespace IntelliTect.TestTools.Selenate -{ - public class ElementBase : HandlerBase - { - public ElementBase(IWebDriver driver, By locator) : base(driver) - { - Locator = locator; - SearchContext = driver; - } - - /// - /// The locator used to find IWebElements in this handler. - /// - public By Locator { get; protected set; } - protected ISearchContext SearchContext { get; set; } - } -} diff --git a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/ElementHandler.cs b/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/ElementHandler.cs deleted file mode 100644 index fee8a82..0000000 --- a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/ElementHandler.cs +++ /dev/null @@ -1,364 +0,0 @@ -using OpenQA.Selenium; -using OpenQA.Selenium.Support.UI; -using System; -using System.Collections.Generic; - -namespace IntelliTect.TestTools.Selenate -{ - /// - /// Main class for handling interactions with a specific IWebElement. - /// - public class ElementHandler : ElementBase - { - /// - /// Takes an IWebDriver and a Selenium By locator used for operations with this element. - /// - /// The WebDriver to wrap. - /// Method for locating an element. - public ElementHandler(IWebDriver driver, By locator) : base(driver, locator) - { - } - - private bool _IgnoreExceptions; - - /// - /// Sets the locator to use for operations within this instance. - /// - /// Method to find an element. - /// this - public ElementHandler SetLocator(By by) - { - Locator = by; - return this; - } - - /// - /// Sets the timeout to use when retrying operations within this instance. - /// - /// Duration to retry an action before throwing. - /// this - public ElementHandler SetTimeout(TimeSpan timeout) - { - return SetTimeout(timeout); - } - - /// - /// Sets the timeout in seconds to use when retrying operations within this instance. - /// - /// Duration to retry an action before throwing. - /// this - public ElementHandler SetTimeoutSeconds(int timeoutInSeconds) - { - return SetTimeout(TimeSpan.FromSeconds(timeoutInSeconds)); - } - - /// - /// Sets the polling interval to use when retrying operations within this instance. - /// - /// Time to wait in between retrying an action. - /// this - public ElementHandler SetPollingInterval(TimeSpan pollingInterval) - { - return SetPollingInterval(pollingInterval); - } - - /// - /// Sets the polling interval in seconds to use when retrying operations within this instance. - /// - /// Time to wait in between retrying an action. - /// this - public ElementHandler SetPollingIntervalMilliseconds(int pollIntervalInMilliseconds) - { - return SetPollingInterval(TimeSpan.FromMilliseconds(pollIntervalInMilliseconds)); - } - - public ElementHandler SetSearchContext(ISearchContext searchContext) - { - SearchContext = searchContext; - return this; - } - - /// - /// Ignores all exceptions of type WebDriverException when trying operations within this instance. This should be used as sparingly as possible. - /// - /// this - public ElementHandler IgnoreAllWebdriverExceptions(bool shouldIgnoreExceptions = true) - { - _IgnoreExceptions = shouldIgnoreExceptions; - return this; - } - - public ElementHandler FindElement(By by) - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); - IWebElement foundElem = wait.Until(_ => { - return SearchContext.FindElement(Locator); - }); - - ElementHandler newHandler = new(WrappedDriver, by); - newHandler.SetSearchContext(foundElem); - - return newHandler; - } - - public ElementsHandler FindElements(By by) - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); - IWebElement foundElem = wait.Until(_ => { - return SearchContext.FindElement(Locator); - }); - - ElementsHandler newHandler = new(WrappedDriver, by); - newHandler.SetSearchContext(foundElem); - - return newHandler; - } - - /// - /// Clicks on the element found by or . Will automatically retry if a known failure occurs. - /// - public void Click() - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(InvalidElementStateException), - typeof(ElementNotVisibleException), - typeof(StaleElementReferenceException), - typeof(ElementClickInterceptedException) - ); - - wait.Until(_ => - { - SearchContext.FindElement(Locator).Click(); - return true; - }); - } - - /// - /// Sends keys to the element found by or . Will automatically retry if a known failure occurs. - /// - /// Text to send to the element. - public void SendKeys(string textToSend) - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(InvalidElementStateException), - typeof(ElementNotVisibleException), - typeof(StaleElementReferenceException), - typeof(ElementNotInteractableException) - ); - - wait.Until(_ => - { - SearchContext.FindElement(Locator).SendKeys(textToSend); - return true; - }); - } - - /// - /// Clears text in the element found by or . Will automatically retry if a known failure occurs. - /// - public void Clear() - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(InvalidElementStateException), - typeof(StaleElementReferenceException) - ); - - wait.Until(_ => - { - SearchContext.FindElement(Locator).Clear(); - return true; - }); - } - - /// - /// Finds and returns the element found by or . - /// Subsequent actions will not automatically retry on the returned IWebElement. - /// - /// The IWebElement found. - public IWebElement GetWebElement() - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(StaleElementReferenceException) - ); - -#pragma warning disable CS8603 // Possible null reference return. Needed for proper WebDriverWait behavior - return wait.Until(_ => - { - IWebElement elem = SearchContext.FindElement(Locator); - if (elem.Displayed) return elem; - return null; - }); -#pragma warning restore CS8603 // Possible null reference return. - } - - /// - /// Gets the existing text on the element found by locator or . Will automatically retry if a known failure occurs. - /// - /// The text associated to the found element. - public string Text() - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(InvalidElementStateException), - typeof(ElementNotVisibleException), - typeof(StaleElementReferenceException) - ); - - return wait.Until(_ => - { - return SearchContext.FindElement(Locator).Text; - }); - } - - /// - /// Gets a specific attribute of the element found by locator or . Will automatically retry if a known failure occurs. - /// - /// The element attribute to search for. - /// The value of the found attribute. - public string GetAttribute(string attributeName) - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(InvalidElementStateException), - typeof(StaleElementReferenceException) - ); - - return wait.Until(_ => - { - return SearchContext.FindElement(Locator).GetAttribute(attributeName); - }); - } - - /// - /// Waits for the element found by locator or to be displayed. Will automatically retry if a known failure occurs. - /// - /// True if the element is displayed, false if the the element is not displayed or throws an ElementNotVisible or NoSuchElement exception - public bool WaitForDisplayed() - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(StaleElementReferenceException) - ); - - try - { - return wait.Until(_ => - { - return SearchContext.FindElement(Locator).Displayed; - }); - } - catch (WebDriverTimeoutException ex) - when (ex.InnerException is not StaleElementReferenceException) - { - return false; - } - } - - /// - /// Waits for the element found by or to be NOT displayed. - /// - /// True if the element is NOT displayed, false if the the element is displayed or throws an ElementNotVisible or NoSuchElement exception - public bool WaitForNotDisplayed() - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(StaleElementReferenceException) - ); - - try - { - return wait.Until(_ => - { - return !SearchContext.FindElement(Locator).Displayed; - }); - } - catch (NoSuchElementException) - { - return true; - } - catch (WebDriverTimeoutException) - { - return false; - } - } - - /// - /// Waits for the element to be enabled. - /// - /// True if the element is enabled, false if the the element is not disabled. - public bool WaitForEnabled() - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(StaleElementReferenceException) - ); - - try - { - return wait.Until(_ => - { - return SearchContext.FindElement(Locator).Enabled; - }); - } - // A Null inner exception implies the element was found but was in a disabled state - catch (WebDriverTimeoutException ex) - when (ex.InnerException is null) - { - return false; - } - } - - /// - /// Waits for the element to be disabled. - /// - /// True if the element is disabled, false if the the element is enabled. - public bool WaitForDisabled() - { - IWait wait = ElementWait(); - wait.IgnoreExceptionTypes( - typeof(NoSuchElementException), - typeof(StaleElementReferenceException) - ); - - try - { - return wait.Until(_ => - { - return !SearchContext.FindElement(Locator).Enabled; - }); - } - // A Null inner exception implies the element was found but was in an enabled state - catch (WebDriverTimeoutException ex) - when (ex.InnerException is null) - { - return false; - } - - } - - private IWait ElementWait() - { - IWait wait = Wait; - if (_IgnoreExceptions) - { - wait.IgnoreExceptionTypes(typeof(WebDriverException)); - } - - return wait; - } - } -} diff --git a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/ElementsHandler.cs b/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/ElementsHandler.cs deleted file mode 100644 index e78a50e..0000000 --- a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/ElementsHandler.cs +++ /dev/null @@ -1,161 +0,0 @@ -using OpenQA.Selenium; -using OpenQA.Selenium.Support.UI; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace IntelliTect.TestTools.Selenate -{ - /// - /// Main class for handling interactions with a group of IWebElements. - /// - public class ElementsHandler : ElementBase - { - /// - /// Constructor to wrap a specific instace of a WebDriver and to set the locator method when interacting with WebElements - /// - /// The WebDriver to wrap. - /// Method for locating elements. - public ElementsHandler(IWebDriver driver, By locator) : base(driver, locator) - { - } - - - /// - /// Sets the locator to use for operations within this instance. - /// - /// Method to find multiple elements. - /// this - public ElementsHandler SetLocator(By by) - { - Locator = by; - return this; - } - - /// - /// Sets the maximum time that this instance will retry a specific interaction with a group of WebElements before throwing. - /// - /// Duration to retry an action before throwing. - /// this - public ElementsHandler SetTimeout(TimeSpan timeout) - { - return SetTimeout(timeout); - } - - /// - /// Sets the maximum time in seconds that this instance will retry a specific interaction with a group of WebElements before throwing. - /// - /// Duration to retry an action before throwing. - /// this - public ElementsHandler SetTimeoutSeconds(int timeoutInSeconds) - { - return SetTimeout(TimeSpan.FromSeconds(timeoutInSeconds)); - } - - /// - /// Sets the amount of time this instance will wait in between retrying a specific interaction. - /// - /// Time to wait in between retrying an action. - /// this - public ElementsHandler SetPollingInterval(TimeSpan pollingInterval) - { - return SetPollingInterval(pollingInterval); - } - - /// - /// Sets the amount of time in milliseconds this instance will wait in between retrying a specific interaction. - /// - /// Time to wait in between retrying an action. - /// this - public ElementsHandler SetPollingIntervalMilliseconds(int pollIntervalInMilliseconds) - { - return SetPollingInterval(TimeSpan.FromMilliseconds(pollIntervalInMilliseconds)); - } - - /// - /// Sets the search context for this element (Driver, element, shadow dom, etc.) - /// - /// The context to use for all future searches. - /// - public ElementsHandler SetSearchContext(ISearchContext searchContext) - { - SearchContext = searchContext; - return this; - } - - /// - /// Checks if any element found by contains the matching text. - /// - /// The text to search for. - /// True if the text is found; false if it is not. - public bool ContainsText(string text) - { - IWait wait = Wait; - wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); - try - { - return wait.Until(_ => - { - IReadOnlyCollection elems = SearchContext.FindElements(Locator); - return elems.Any(h => h.Text == text); - }); - } - catch (WebDriverTimeoutException) - { - return false; - } - } - - /// - /// Checks if any element found by matches a predicate. - /// - /// The criteria to attempt to match on. - /// - public IWebElement GetSingleWebElement(Func predicate) - { - IList elems = GetElements(predicate); - - if (elems.Count is not 1) - { - throw new ArgumentOutOfRangeException(nameof(predicate), "The provided predicate did not match exactly one result."); - } - - return elems[0]; - } - - /// - /// Gets all elements found by , matching a given predicate. - /// - /// The function used to filter to one or more IWebElements - /// A list of found IWebElements - /// - /// - public IList GetAllWebElements(Func predicate) - { - return GetElements(predicate); - - } - - private IList GetElements(Func predicate) - { - IWait wait = Wait; - wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); - - return wait.Until(_ => - { - IList foundElems = SearchContext.FindElements(Locator).Where(predicate).ToList(); - if(foundElems.Any()) - { - return foundElems; - } - else - { - // Selenium treats this as a failure and will retry this action until: - // 1. Something is returned - // 2. The timeout is met and a WebDriverTimeoutException is thrown. - return null!; - } - }); - } - } -} diff --git a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/HandlerBase.cs b/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/HandlerBase.cs deleted file mode 100644 index 668315c..0000000 --- a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/HandlerBase.cs +++ /dev/null @@ -1,57 +0,0 @@ -using OpenQA.Selenium; -using OpenQA.Selenium.Support.UI; -using System; - -namespace IntelliTect.TestTools.Selenate -{ - /// - /// Base class for handling Selenium interactions. - /// - public class HandlerBase - { - /// - /// Base class for handling Selenium interactions. - /// - /// The WebDriver needed to driver all of the Selenium interactions - public HandlerBase(IWebDriver driver) - { - if (driver is null) throw new ArgumentNullException(nameof(driver)); - WrappedDriver = driver; - } - - /// - /// The WebDriver this instance is wrapping. - /// - public IWebDriver WrappedDriver { get; } - protected TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(15); - protected TimeSpan PollingInterval { get; set; } = TimeSpan.FromMilliseconds(100); - protected DefaultWait Wait => - new(WrappedDriver) - { - Timeout = Timeout, - PollingInterval = PollingInterval - }; - - protected T SetTimeout(TimeSpan timeout) where T : HandlerBase - { - if (timeout.TotalMilliseconds < 0) - { - throw new ArgumentOutOfRangeException(nameof(timeout), "Please provide a positive value."); - } - - Timeout = timeout; - return (T)this; - } - - protected T SetPollingInterval(TimeSpan pollingInterval) where T : HandlerBase - { - if (pollingInterval.TotalMilliseconds < 0) - { - throw new ArgumentOutOfRangeException(nameof(pollingInterval), "Please provide a positive value."); - } - - PollingInterval = pollingInterval; - return (T)this; - } - } -} diff --git a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate.csproj b/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate.csproj deleted file mode 100644 index 9d8434c..0000000 --- a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - netstandard2.0 - 9.0 - enable - true - 4 - CA1303 - - - - - all - - - - - diff --git a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/WebDriverFactory.cs b/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/WebDriverFactory.cs deleted file mode 100644 index a915aa6..0000000 --- a/IntelliTect.TestTools.Selenate/IntelliTect.TestTools.Selenate/WebDriverFactory.cs +++ /dev/null @@ -1,75 +0,0 @@ -using OpenQA.Selenium; -using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Edge; -using OpenQA.Selenium.Firefox; -using System; -using System.IO; - -namespace IntelliTect.TestTools.Selenate -{ - /// - /// Class for instantiating "everyday" WebDrivers. - /// - public class WebDriverFactory - { - /// - /// The type of browser to drive with a Selenium WebDriver. - /// - /// The type of WebDriver to instantiate to drive a specific browser. - public WebDriverFactory(BrowserType browserType) - { - BrowserType = browserType; - } - - private BrowserType BrowserType { get; set; } - - /// - /// Gets the driver specified in the constructor. - /// Do not forget to dispose of your driver after each test or test collection - /// - public IWebDriver GetDriver() - { - IWebDriver driver; - switch (BrowserType) - { - case BrowserType.Chrome: - ChromeOptions chromeOptions = new(); - chromeOptions.AddArgument("--disable-extension"); - chromeOptions.AddArgument("--no-sandbox"); - chromeOptions.AddArgument("--disable-infobars"); - chromeOptions.AddUserProfilePreference("credentials_enable_service", false); - chromeOptions.AddUserProfilePreference("profile.password_manager_enabled", false); - driver = new ChromeDriver(Directory.GetCurrentDirectory(), chromeOptions); - break; - case BrowserType.Firefox: - FirefoxOptions ffOptions = new(); - ffOptions.AddArgument("-safe-mode"); - driver = new FirefoxDriver(Directory.GetCurrentDirectory(), ffOptions); - break; - case BrowserType.Edge: - EdgeOptions edgeOptions = new() - { - UnhandledPromptBehavior = UnhandledPromptBehavior.Accept - }; - driver = new EdgeDriver(Directory.GetCurrentDirectory(), edgeOptions); - break; - case BrowserType.HeadlessChrome: - ChromeOptions headlessChromeOptions = new(); - headlessChromeOptions.AddArgument("--disable-extension"); - headlessChromeOptions.AddArgument("--headless"); - headlessChromeOptions.AddArgument("--no-sandbox"); - headlessChromeOptions.AddArgument("--disable-infobars"); - headlessChromeOptions.AddUserProfilePreference("credentials_enable_service", false); - headlessChromeOptions.AddUserProfilePreference("profile.password_manager_enabled", false); - driver = new ChromeDriver(Directory.GetCurrentDirectory(), headlessChromeOptions); - break; - default: - throw new ArgumentException($"Unknown browser: {BrowserType}"); - } - - driver.Manage().Window.Maximize(); - driver.Manage().Timeouts().PageLoad = TimeSpan.FromMinutes(2); - return driver; - } - } -} diff --git a/IntelliTect.TestTools.sln b/IntelliTect.TestTools.sln index 3307420..f3abc30 100644 --- a/IntelliTect.TestTools.sln +++ b/IntelliTect.TestTools.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31815.197 @@ -7,10 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.TestTools.Data" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.TestTools.Data.Test", "IntelliTect.TestTools.Data.Test\IntelliTect.TestTools.Data.Test.csproj", "{E54EDE65-5659-435C-9DDD-054AF2013A2B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.TestTools.Selenate", "IntelliTect.TestTools.Selenate\IntelliTect.TestTools.Selenate\IntelliTect.TestTools.Selenate.csproj", "{5BE4AA45-102E-4212-AB9B-BED5B47AB685}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.TestTools.Selenate.Tests", "IntelliTect.TestTools.Selenate.Tests\IntelliTect.TestTools.Selenate.Tests.csproj", "{43945E21-816A-496E-BB83-BD38811CC949}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntelliTect.TestTools.WindowsTestWrapper", "IntelliTect.TestTools.WindowsTestWrapper\IntelliTect.TestTools.WindowsTestWrapper\IntelliTect.TestTools.WindowsTestWrapper.csproj", "{AFFE1E79-C820-495E-A6AA-0CF9BA076D9B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example Projects", "Example Projects", "{E26CE360-873C-4BE2-A7C4-58F803B87411}" @@ -35,10 +31,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TheInternetExamples", "TheI EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheInternetExamples", "TheInternetExamples\TheInternetExamples.csproj", "{B5D26863-D696-4D64-B281-FC118B370FEA}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{BDBFEAA3-FBC6-48C1-8988-9D6F64875831}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.TestTools.Selenate.Examples", "Examples\IntelliTect.TestTools.Selenate.Examples\IntelliTect.TestTools.Selenate.Examples.csproj", "{6F64DE3F-6220-4302-BA3D-25D1C783B673}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3E09C5DD-F7B4-4542-AC13-0EE22DCC230C}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig @@ -49,7 +41,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution LICENSE = LICENSE Publish.ps1 = Publish.ps1 README.md = README.md - selenate-pipeline.yml = selenate-pipeline.yml Test-NuGetPackage.ps1 = Test-NuGetPackage.ps1 EndProjectSection EndProject @@ -67,14 +58,6 @@ Global {E54EDE65-5659-435C-9DDD-054AF2013A2B}.Debug|Any CPU.Build.0 = Debug|Any CPU {E54EDE65-5659-435C-9DDD-054AF2013A2B}.Release|Any CPU.ActiveCfg = Release|Any CPU {E54EDE65-5659-435C-9DDD-054AF2013A2B}.Release|Any CPU.Build.0 = Release|Any CPU - {5BE4AA45-102E-4212-AB9B-BED5B47AB685}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5BE4AA45-102E-4212-AB9B-BED5B47AB685}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5BE4AA45-102E-4212-AB9B-BED5B47AB685}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5BE4AA45-102E-4212-AB9B-BED5B47AB685}.Release|Any CPU.Build.0 = Release|Any CPU - {43945E21-816A-496E-BB83-BD38811CC949}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {43945E21-816A-496E-BB83-BD38811CC949}.Debug|Any CPU.Build.0 = Debug|Any CPU - {43945E21-816A-496E-BB83-BD38811CC949}.Release|Any CPU.ActiveCfg = Release|Any CPU - {43945E21-816A-496E-BB83-BD38811CC949}.Release|Any CPU.Build.0 = Release|Any CPU {AFFE1E79-C820-495E-A6AA-0CF9BA076D9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AFFE1E79-C820-495E-A6AA-0CF9BA076D9B}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFFE1E79-C820-495E-A6AA-0CF9BA076D9B}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -107,10 +90,6 @@ Global {B5D26863-D696-4D64-B281-FC118B370FEA}.Debug|Any CPU.Build.0 = Debug|Any CPU {B5D26863-D696-4D64-B281-FC118B370FEA}.Release|Any CPU.ActiveCfg = Release|Any CPU {B5D26863-D696-4D64-B281-FC118B370FEA}.Release|Any CPU.Build.0 = Release|Any CPU - {6F64DE3F-6220-4302-BA3D-25D1C783B673}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6F64DE3F-6220-4302-BA3D-25D1C783B673}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6F64DE3F-6220-4302-BA3D-25D1C783B673}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6F64DE3F-6220-4302-BA3D-25D1C783B673}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -124,7 +103,6 @@ Global {B5D68C0F-954E-482E-ACB5-0340FF668A43} = {D13DE286-8B5D-45A4-B7A9-EA62E7AF98A5} {A0D98D56-D48E-42E4-8E1E-6EA3EA0D7860} = {D13DE286-8B5D-45A4-B7A9-EA62E7AF98A5} {B5D26863-D696-4D64-B281-FC118B370FEA} = {EEA49773-F788-4051-8C66-30B90839FCFD} - {6F64DE3F-6220-4302-BA3D-25D1C783B673} = {BDBFEAA3-FBC6-48C1-8988-9D6F64875831} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {06F0B25C-E18B-44E5-9FD1-CD362B8626FF} diff --git a/selenate-pipeline.yml b/selenate-pipeline.yml deleted file mode 100644 index d78d149..0000000 --- a/selenate-pipeline.yml +++ /dev/null @@ -1,49 +0,0 @@ -trigger: - branches: - include: - - main - paths: - include: - - IntelliTect.TestTools.Selenate/* - - selenate-pipeline.yml - -pool: - vmImage: 'windows-2022' - -variables: - solution: '**/IntelliTect.TestTools.Selenate.slnf' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - version: '2.1.0' - -steps: -- task: NuGetToolInstaller@1 - displayName: 'Use latest NuGet' - -- task: NuGetCommand@2 - displayName: 'Restore Solution' - inputs: - restoreSolution: '**/IntelliTect.TestTools.sln' - -- task: VSBuild@1 - displayName: 'Build Solution' - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - msbuildArgs: '/p:Version=$(version)' - -- task: DotNetCoreCLI@2 - displayName: 'Pack Selenate Project' - inputs: - command: 'custom' - projects: '**/IntelliTect.TestTools.Selenate.csproj' - custom: 'pack' - arguments: '-p:Version="$(version)-ci-$(Build.BuildId)" -c Release -o $(Build.ArtifactStagingDirectory)' - -- task: PublishBuildArtifacts@1 - displayName: 'Stage Package' - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - ArtifactName: 'Selenate' - publishLocation: 'Container' \ No newline at end of file