diff --git a/Objectivity.Test.Automation.Common/App.config b/Objectivity.Test.Automation.Common/App.config index ca73b8531..76f498608 100644 --- a/Objectivity.Test.Automation.Common/App.config +++ b/Objectivity.Test.Automation.Common/App.config @@ -15,6 +15,7 @@ + diff --git a/Objectivity.Test.Automation.Common/BaseConfiguration.cs b/Objectivity.Test.Automation.Common/BaseConfiguration.cs index 545b6ac92..dab469479 100644 --- a/Objectivity.Test.Automation.Common/BaseConfiguration.cs +++ b/Objectivity.Test.Automation.Common/BaseConfiguration.cs @@ -36,11 +36,11 @@ public static class BaseConfiguration /// /// Gets the Driver. /// - public static DriverContext.BrowserType TestBrowser + public static BrowserType TestBrowser { get { - DriverContext.BrowserType browserType; + BrowserType browserType; bool supportedBrowser = Enum.TryParse(ConfigurationManager.AppSettings["browser"], out browserType); if (supportedBrowser) @@ -48,7 +48,7 @@ public static DriverContext.BrowserType TestBrowser return browserType; } - return DriverContext.BrowserType.None; + return BrowserType.None; } } @@ -101,7 +101,7 @@ public static string Password } /// - /// Gets the java script or ajax waiting time. + /// Gets the java script or ajax waiting time [seconds]. /// public static double MediumTimeout { @@ -109,7 +109,7 @@ public static double MediumTimeout } /// - /// Gets the page load waiting time. + /// Gets the page load waiting time [seconds]. /// public static double LongTimeout { @@ -117,13 +117,21 @@ public static double LongTimeout } /// - /// Gets the assertion waiting time. + /// Gets the assertion waiting time [seconds]. /// public static double ShortTimeout { get { return Convert.ToDouble(ConfigurationManager.AppSettings["shortTimeout"], CultureInfo.CurrentCulture); } } + /// + /// Gets the Implicitly Wait time [milliseconds]. + /// + public static double ImplicitlyWaitMilliseconds + { + get { return Convert.ToDouble(ConfigurationManager.AppSettings["ImplicitlyWaitMilliseconds"], CultureInfo.CurrentCulture); } + } + /// /// Gets the firefox path /// @@ -245,5 +253,34 @@ public static string PageSourceFolder { get { return ConfigurationManager.AppSettings["PageSourceFolder"]; } } + + /// + /// Gets the URL value 'Protocol://HostURL'. + /// + public static string GetUrlValue + { + get + { + return string.Format(CultureInfo.CurrentCulture, "{0}://{1}{2}", Protocol, Host, Url); + } + } + + /// + /// Gets the URL value with user credentials 'Protocol://Username:Password@HostURL'. + /// + public static string GetUrlValueWithUserCredentials + { + get + { + return string.Format( + CultureInfo.CurrentCulture, + "{0}://{1}:{2}@{3}{4}", + Protocol, + Username, + Password, + Host, + Url); + } + } } } diff --git a/Objectivity.Test.Automation.Common/BrowserType.cs b/Objectivity.Test.Automation.Common/BrowserType.cs new file mode 100644 index 000000000..59585a6c3 --- /dev/null +++ b/Objectivity.Test.Automation.Common/BrowserType.cs @@ -0,0 +1,57 @@ +/* +The MIT License (MIT) + +Copyright (c) 2015 Objectivity Bespoke Software Specialists + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +namespace Objectivity.Test.Automation.Common +{ + /// + /// Supported browsers + /// + public enum BrowserType + { + /// + /// Firefox browser + /// + Firefox, + + /// + /// Firefox portable + /// + FirefoxPortable, + + /// + /// InternetExplorer browser + /// + InternetExplorer, + + /// + /// Chrome browser + /// + Chrome, + + /// + /// Not supported browser + /// + None + } +} diff --git a/Objectivity.Test.Automation.Common/DriverContext.cs b/Objectivity.Test.Automation.Common/DriverContext.cs index 1c0760c11..5e279d490 100644 --- a/Objectivity.Test.Automation.Common/DriverContext.cs +++ b/Objectivity.Test.Automation.Common/DriverContext.cs @@ -65,37 +65,6 @@ public class DriverContext private TestLogger logTest; - /// - /// Supported browsers - /// - public enum BrowserType - { - /// - /// Firefox browser - /// - Firefox, - - /// - /// Firefox portable - /// - FirefoxPortable, - - /// - /// InternetExplorer browser - /// - InternetExplorer, - - /// - /// Chrome browser - /// - Chrome, - - /// - /// Not supported browser - /// - None - } - /// /// Gets or sets the test title. /// @@ -347,8 +316,11 @@ public void Start() default: throw new NotSupportedException( string.Format(CultureInfo.CurrentCulture, "Driver {0} is not supported", BaseConfiguration.TestBrowser)); - } - + } + + this.driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(BaseConfiguration.LongTimeout)); + this.driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(BaseConfiguration.ShortTimeout)); + this.driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(BaseConfiguration.ImplicitlyWaitMilliseconds)); this.driver.Manage().Window.Maximize(); } @@ -360,9 +332,10 @@ public void Stop() this.driver.Quit(); } - /// - /// Takes the screenshot. - /// + /// + /// Takes the screenshot. + /// + /// An image of the page currently loaded in the browser. public Screenshot TakeScreenshot() { try diff --git a/Objectivity.Test.Automation.Common/Exceptions/WaitTimeoutException.cs b/Objectivity.Test.Automation.Common/Exceptions/WaitTimeoutException.cs index 254f36a00..d7b41911d 100644 --- a/Objectivity.Test.Automation.Common/Exceptions/WaitTimeoutException.cs +++ b/Objectivity.Test.Automation.Common/Exceptions/WaitTimeoutException.cs @@ -28,7 +28,7 @@ namespace Objectivity.Test.Automation.Common.Exceptions using System.Runtime.Serialization; /// - /// Exception to throw when problem with setting the test case name from parameters + /// The exception that is thrown when the time for a process or operation has expired. /// public class WaitTimeoutException : Exception { diff --git a/Objectivity.Test.Automation.Common/Extensions/SearchContextExtensions.cs b/Objectivity.Test.Automation.Common/Extensions/SearchContextExtensions.cs index e84b51761..416d9de9e 100644 --- a/Objectivity.Test.Automation.Common/Extensions/SearchContextExtensions.cs +++ b/Objectivity.Test.Automation.Common/Extensions/SearchContextExtensions.cs @@ -127,7 +127,7 @@ public static IWebElement GetElement(this ISearchContext element, ElementLocator } /// - /// Finds and waits for an element that meets specified conditions at specified time . + /// Finds and waits for an element that meets specified conditions at specified time, recheck condition at specific time interval. /// /// The element. /// The locator. @@ -139,7 +139,7 @@ public static IWebElement GetElement(this ISearchContext element, ElementLocator /// Return found element /// /// How to use it: - /// this.Driver.GetElement(this.loginButton, timeout, e => e.Displayed); + /// this.Driver.GetElement(this.loginButton, timeout, timeInterval, e => e.Displayed & e.Enabled); /// public static IWebElement GetElement(this ISearchContext element, ElementLocator locator, double timeout, double timeInterval, Func condition, [Optional] string customMessage) { diff --git a/Objectivity.Test.Automation.Common/Extensions/WebDriverExtensions.cs b/Objectivity.Test.Automation.Common/Extensions/WebDriverExtensions.cs index 7775b5e1b..09a9804f0 100644 --- a/Objectivity.Test.Automation.Common/Extensions/WebDriverExtensions.cs +++ b/Objectivity.Test.Automation.Common/Extensions/WebDriverExtensions.cs @@ -300,7 +300,7 @@ public static IJavaScriptExecutor JavaScripts(this IWebDriver webDriver) /// The web driver. private static void ApproveCertificateForInternetExplorer(this IWebDriver webDriver) { - if (BaseConfiguration.TestBrowser.Equals(DriverContext.BrowserType.InternetExplorer) && webDriver.Title.Contains("Certificate")) + if (BaseConfiguration.TestBrowser.Equals(BrowserType.InternetExplorer) && webDriver.Title.Contains("Certificate")) { webDriver.FindElement(By.Id("overridelink")).JavaScriptClick(); } diff --git a/Objectivity.Test.Automation.Common/Helpers/FilesHelper.cs b/Objectivity.Test.Automation.Common/Helpers/FilesHelper.cs index b4d00db90..770fb5257 100644 --- a/Objectivity.Test.Automation.Common/Helpers/FilesHelper.cs +++ b/Objectivity.Test.Automation.Common/Helpers/FilesHelper.cs @@ -362,7 +362,7 @@ public static void RenameFile(string oldName, string newName, string subFolder, /// /// The application configuration value. /// Directory where assembly files are located - /// + /// The path to folder public static string GetFolder(string appConfigValue, string currentFolder) { Logger.Trace(CultureInfo.CurrentCulture, "appConfigValue '{0}', currentFolder '{1}', UseCurrentDirectory '{2}'", appConfigValue, currentFolder, BaseConfiguration.UseCurrentDirectory); diff --git a/Objectivity.Test.Automation.Common/Helpers/MdxHelper.cs b/Objectivity.Test.Automation.Common/Helpers/MdxHelper.cs index ebfa244b9..7363d6a9c 100644 --- a/Objectivity.Test.Automation.Common/Helpers/MdxHelper.cs +++ b/Objectivity.Test.Automation.Common/Helpers/MdxHelper.cs @@ -47,7 +47,7 @@ public static class MdxHelper /// MDX query string. /// The Analysis Services connection string. /// The index of column. - /// + /// Collection of MDX query results [SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities", Justification = "Mdx injection is in this case expected.")] public static ICollection ExecuteMdxCommand(string command, string connectionString, int index) { diff --git a/Objectivity.Test.Automation.Common/Helpers/SqlHelper.cs b/Objectivity.Test.Automation.Common/Helpers/SqlHelper.cs index 1c5fa580e..ab1709cd9 100644 --- a/Objectivity.Test.Automation.Common/Helpers/SqlHelper.cs +++ b/Objectivity.Test.Automation.Common/Helpers/SqlHelper.cs @@ -51,6 +51,8 @@ public static class SqlHelper [SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities", Justification = "SQL injection is in this case expected.")] public static ICollection ExecuteSqlCommand(string command, string connectionString, string column) { + Logger.Trace(CultureInfo.CurrentCulture, "Execute sql query '{0}'", command); + var resultList = new List(); using (var connection = new SqlConnection(connectionString)) @@ -63,7 +65,7 @@ public static ICollection ExecuteSqlCommand(string command, string conne { if (!sqlDataReader.HasRows) { - Logger.Error("No result for: {0} \n {1}", command, connectionString); + Logger.Error(CultureInfo.CurrentCulture, "No result for: {0} \n {1} \n {2}", command, connectionString, column); return resultList; } @@ -77,11 +79,11 @@ public static ICollection ExecuteSqlCommand(string command, string conne if (resultList.Count == 0) { - Logger.Error("No result for: {0} \n {1}", command, connectionString); + Logger.Error(CultureInfo.CurrentCulture, "No result for: {0} \n {1} \n {2}", command, connectionString, column); } else { - Logger.Trace("sql results: {0}", resultList); + Logger.Trace(CultureInfo.CurrentCulture, "Sql results: {0}", resultList); } return resultList; @@ -97,6 +99,8 @@ public static ICollection ExecuteSqlCommand(string command, string conne [SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities", Justification = "SQL injection is in this case expected.")] public static Dictionary ExecuteSqlCommand(string command, string connectionString, IEnumerable columns) { + Logger.Trace(CultureInfo.CurrentCulture, "Execute sql query '{0}'", command); + var resultList = new Dictionary(); var resultTemp = new Dictionary(); @@ -110,7 +114,7 @@ public static Dictionary ExecuteSqlCommand(string command, strin { if (!sqlDataReader.HasRows) { - Logger.Error("No result for: {0} \n {1}", command, connectionString); + Logger.Error(CultureInfo.CurrentCulture, "No result for: {0} \n {1}", command, connectionString); return resultList; } @@ -139,6 +143,11 @@ public static Dictionary ExecuteSqlCommand(string command, strin } } + foreach (KeyValuePair entry in resultList) + { + Logger.Trace(CultureInfo.CurrentCulture, "Sql results: {0} = {1}", entry.Key, entry.Value); + } + return resultList; } } diff --git a/Objectivity.Test.Automation.Common/Helpers/WaitHelper.cs b/Objectivity.Test.Automation.Common/Helpers/WaitHelper.cs index a1b28dc15..0345cbf96 100644 --- a/Objectivity.Test.Automation.Common/Helpers/WaitHelper.cs +++ b/Objectivity.Test.Automation.Common/Helpers/WaitHelper.cs @@ -92,7 +92,7 @@ public static void Wait(Func condition, TimeSpan timeout, TimeSpan sleepIn if (!result) { - throw new WaitTimeoutException(string.Format(CultureInfo.CurrentCulture, "Timeout after {0} second(s), {1}", timeout, message)); + throw new WaitTimeoutException(string.Format(CultureInfo.CurrentCulture, "Timeout after {0} second(s), {1}", timeout.Seconds, message)); } } diff --git a/Objectivity.Test.Automation.Common/Logger/TestLogger.cs b/Objectivity.Test.Automation.Common/Logger/TestLogger.cs index f9338b21a..0afd5ad34 100644 --- a/Objectivity.Test.Automation.Common/Logger/TestLogger.cs +++ b/Objectivity.Test.Automation.Common/Logger/TestLogger.cs @@ -47,6 +47,7 @@ public class TestLogger /// /// Logs the test starting. /// + /// The driver context. public void LogTestStarting(DriverContext driverContext) { this.startTestTime = DateTime.Now; @@ -56,6 +57,7 @@ public void LogTestStarting(DriverContext driverContext) /// /// Logs the test ending. /// + /// The driver context. public void LogTestEnding(DriverContext driverContext) { var endTestTime = DateTime.Now; diff --git a/Objectivity.Test.Automation.Common/Objectivity.Test.Automation.Common.csproj b/Objectivity.Test.Automation.Common/Objectivity.Test.Automation.Common.csproj index b47e1f709..14d9de1a7 100644 --- a/Objectivity.Test.Automation.Common/Objectivity.Test.Automation.Common.csproj +++ b/Objectivity.Test.Automation.Common/Objectivity.Test.Automation.Common.csproj @@ -57,6 +57,7 @@ + @@ -113,12 +114,14 @@ - - ..\packages\Selenium.WebDriver.2.48.2\lib\net40\WebDriver.dll + + + + ..\packages\Selenium.WebDriver.2.50.1\lib\net40\WebDriver.dll True - - ..\packages\Selenium.Support.2.48.2\lib\net40\WebDriver.Support.dll + + ..\packages\Selenium.Support.2.50.1\lib\net40\WebDriver.Support.dll True diff --git a/Objectivity.Test.Automation.Common/TestBase.cs b/Objectivity.Test.Automation.Common/TestBase.cs index b9e9de48c..ebd38e559 100644 --- a/Objectivity.Test.Automation.Common/TestBase.cs +++ b/Objectivity.Test.Automation.Common/TestBase.cs @@ -50,6 +50,7 @@ protected static void StopPerfromanceMeasure() /// /// Take screenshot if test failed and delete cached page objects. /// + /// The driver context. public void SaveTestDetailsIfTestFailed(DriverContext driverContext) { if (driverContext.IsTestFailed) @@ -73,9 +74,8 @@ public void SavePageSource(DriverContext driverContext) /// /// Fail Test If Verify Failed and clear verify messages /// - /// - /// Driver context includes - /// + /// Driver context includes + /// True if test failed public bool IsVerifyFailedAndClearMessages(DriverContext driverContext) { if (!driverContext.VerifyMessages.Count.Equals(0) && !driverContext.IsTestFailed) diff --git a/Objectivity.Test.Automation.Common/Types/ElementLocator.cs b/Objectivity.Test.Automation.Common/Types/ElementLocator.cs index 919d4491d..c4e3863cf 100644 --- a/Objectivity.Test.Automation.Common/Types/ElementLocator.cs +++ b/Objectivity.Test.Automation.Common/Types/ElementLocator.cs @@ -24,6 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE namespace Objectivity.Test.Automation.Common.Types { + using System; using System.Globalization; /// @@ -70,9 +71,24 @@ public ElementLocator(Locator kind, string value) /// /// The parameters. /// New element locator with value changed by injected parameters + [Obsolete("Evaluate is deprecated, please use Format instead.", true)] public ElementLocator Evaluate(params object[] parameters) { return new ElementLocator(this.Kind, string.Format(CultureInfo.CurrentCulture, this.Value, parameters)); } + + /// + /// Formats the generic element locator definition and create the instance + /// + /// How we can replace parts of defined locator: + /// private readonly ElementLocator menuLink = new ElementLocator(Locator.XPath, "//*[@title='{0}' and @ms.title='{1}']"); + /// var element = this.Driver.GetElement(this.menuLink.Format("info","news")); + /// + /// The parameters. + /// New element locator with value changed by injected parameters + public ElementLocator Format(params object[] parameters) + { + return new ElementLocator(this.Kind, string.Format(CultureInfo.CurrentCulture, this.Value, parameters)); + } } } \ No newline at end of file diff --git a/Objectivity.Test.Automation.Common/packages.config b/Objectivity.Test.Automation.Common/packages.config index d55ac77cc..da2b2a222 100644 --- a/Objectivity.Test.Automation.Common/packages.config +++ b/Objectivity.Test.Automation.Common/packages.config @@ -2,9 +2,9 @@ - - - - + + + + \ No newline at end of file diff --git a/Objectivity.Test.Automation.Tests.Features/App.config b/Objectivity.Test.Automation.Tests.Features/App.config index ceee5f057..b1408b82d 100644 --- a/Objectivity.Test.Automation.Tests.Features/App.config +++ b/Objectivity.Test.Automation.Tests.Features/App.config @@ -2,9 +2,9 @@
+
+
-
-
@@ -20,14 +20,15 @@ + - - - + + + @@ -42,7 +43,7 @@ - + diff --git a/Objectivity.Test.Automation.Tests.Features/Objectivity.Test.Automation.Tests.Features.csproj b/Objectivity.Test.Automation.Tests.Features/Objectivity.Test.Automation.Tests.Features.csproj index 7d3399c87..e57f2ce3e 100644 --- a/Objectivity.Test.Automation.Tests.Features/Objectivity.Test.Automation.Tests.Features.csproj +++ b/Objectivity.Test.Automation.Tests.Features/Objectivity.Test.Automation.Tests.Features.csproj @@ -67,7 +67,7 @@ - ..\packages\SpecFlow.2.0.0-preview20151221-10\lib\net45\TechTalk.SpecFlow.dll + ..\packages\SpecFlow.2.0.0\lib\net45\TechTalk.SpecFlow.dll True @@ -127,7 +127,7 @@ - + diff --git a/Objectivity.Test.Automation.Tests.Features/packages.config b/Objectivity.Test.Automation.Tests.Features/packages.config index 31dbf82b0..bb2c60d54 100644 --- a/Objectivity.Test.Automation.Tests.Features/packages.config +++ b/Objectivity.Test.Automation.Tests.Features/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/Objectivity.Test.Automation.Tests.MsTest/App.config b/Objectivity.Test.Automation.Tests.MsTest/App.config index a79c4fa6e..a2acdd253 100644 --- a/Objectivity.Test.Automation.Tests.MsTest/App.config +++ b/Objectivity.Test.Automation.Tests.MsTest/App.config @@ -19,6 +19,7 @@ + diff --git a/Objectivity.Test.Automation.Tests.MsTest/Objectivity.Test.Automation.Tests.MsTest.csproj b/Objectivity.Test.Automation.Tests.MsTest/Objectivity.Test.Automation.Tests.MsTest.csproj index c06b93f3f..4c9ec432d 100644 --- a/Objectivity.Test.Automation.Tests.MsTest/Objectivity.Test.Automation.Tests.MsTest.csproj +++ b/Objectivity.Test.Automation.Tests.MsTest/Objectivity.Test.Automation.Tests.MsTest.csproj @@ -63,9 +63,9 @@ - - False - ..\packages\Selenium.WebDriver.2.48.2\lib\net40\WebDriver.dll + + ..\packages\Selenium.WebDriver.2.50.1\lib\net40\WebDriver.dll + True diff --git a/Objectivity.Test.Automation.Tests.MsTest/packages.config b/Objectivity.Test.Automation.Tests.MsTest/packages.config index 96367c7c1..1cd23ff1f 100644 --- a/Objectivity.Test.Automation.Tests.MsTest/packages.config +++ b/Objectivity.Test.Automation.Tests.MsTest/packages.config @@ -2,4 +2,5 @@ + \ No newline at end of file diff --git a/Objectivity.Test.Automation.Tests.NUnit/App.config b/Objectivity.Test.Automation.Tests.NUnit/App.config index 243e6776d..628ffd5c5 100644 --- a/Objectivity.Test.Automation.Tests.NUnit/App.config +++ b/Objectivity.Test.Automation.Tests.NUnit/App.config @@ -21,6 +21,7 @@ + diff --git a/Objectivity.Test.Automation.Tests.NUnit/Tests/HerokuappTestsNUnit.cs b/Objectivity.Test.Automation.Tests.NUnit/Tests/HerokuappTestsNUnit.cs index 3aa9bf4af..341611d0d 100644 --- a/Objectivity.Test.Automation.Tests.NUnit/Tests/HerokuappTestsNUnit.cs +++ b/Objectivity.Test.Automation.Tests.NUnit/Tests/HerokuappTestsNUnit.cs @@ -130,7 +130,7 @@ public void ContextMenuTest() { const string H3Value = "Context Menu"; var browser = BaseConfiguration.TestBrowser; - if (browser.Equals(DriverContext.BrowserType.Firefox)) + if (browser.Equals(BrowserType.Firefox)) { var contextMenuPage = new InternetPage(this.DriverContext) .OpenHomePage() diff --git a/Objectivity.Test.Automation.Tests.PageObjects/Objectivity.Test.Automation.Tests.PageObjects.csproj b/Objectivity.Test.Automation.Tests.PageObjects/Objectivity.Test.Automation.Tests.PageObjects.csproj index 72f0fb086..cb3f9dbef 100644 --- a/Objectivity.Test.Automation.Tests.PageObjects/Objectivity.Test.Automation.Tests.PageObjects.csproj +++ b/Objectivity.Test.Automation.Tests.PageObjects/Objectivity.Test.Automation.Tests.PageObjects.csproj @@ -58,12 +58,12 @@ - - ..\packages\Selenium.WebDriver.2.48.2\lib\net40\WebDriver.dll + + ..\packages\Selenium.WebDriver.2.50.1\lib\net40\WebDriver.dll True - - ..\packages\Selenium.Support.2.48.2\lib\net40\WebDriver.Support.dll + + ..\packages\Selenium.Support.2.50.1\lib\net40\WebDriver.Support.dll True @@ -111,13 +111,13 @@ - + chromedriver.exe - Always + PreserveNewest - + IEDriverServer.exe - Always + PreserveNewest diff --git a/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/DisappearingElementsPage.cs b/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/DisappearingElementsPage.cs index 8b637105b..be16d1dbf 100644 --- a/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/DisappearingElementsPage.cs +++ b/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/DisappearingElementsPage.cs @@ -44,18 +44,18 @@ public void RefreshAndWaitLinkNotVisible(string linkText) { this.Driver.Navigate().Refresh(); this.Driver.WaitUntilElementIsNoLongerFound( - this.menuLink.Evaluate(linkText), + this.menuLink.Format(linkText), BaseConfiguration.ShortTimeout); } public string GetLinkTitleTagName(string linkText) { - return this.Driver.GetElement(this.menuLink.Evaluate(linkText), e => e.Displayed == true).TagName; + return this.Driver.GetElement(this.menuLink.Format(linkText), e => e.Displayed == true).TagName; } public bool IsLinkSelected(string linkText) { - return this.Driver.GetElement(this.menuLink.Evaluate(linkText), BaseConfiguration.MediumTimeout, e => e.Displayed == true).Selected; + return this.Driver.GetElement(this.menuLink.Format(linkText), BaseConfiguration.MediumTimeout, e => e.Displayed == true).Selected; } } } diff --git a/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/DownloadPage.cs b/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/DownloadPage.cs index 00b6caddb..40d9c37b6 100644 --- a/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/DownloadPage.cs +++ b/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/DownloadPage.cs @@ -55,10 +55,10 @@ public DownloadPage(DriverContext driverContext) public DownloadPage SaveFile(string fileName, string newName) { - if (BaseConfiguration.TestBrowser == DriverContext.BrowserType.Firefox - || BaseConfiguration.TestBrowser == DriverContext.BrowserType.Chrome) + if (BaseConfiguration.TestBrowser == BrowserType.Firefox + || BaseConfiguration.TestBrowser == BrowserType.Chrome) { - this.Driver.GetElement(this.fileLink.Evaluate(fileName), "Click on file").Click(); + this.Driver.GetElement(this.fileLink.Format(fileName), "Click on file").Click(); FilesHelper.WaitForFileOfGivenName(fileName, this.DriverContext.DownloadFolder); FilesHelper.RenameFile(fileName, newName, this.DriverContext.DownloadFolder, FileType.Csv); } @@ -72,11 +72,11 @@ public DownloadPage SaveFile(string fileName, string newName) public DownloadPage SaveFile(string newName) { - if (BaseConfiguration.TestBrowser == DriverContext.BrowserType.Firefox - || BaseConfiguration.TestBrowser == DriverContext.BrowserType.Chrome) + if (BaseConfiguration.TestBrowser == BrowserType.Firefox + || BaseConfiguration.TestBrowser == BrowserType.Chrome) { var filesNumber = FilesHelper.CountFiles(this.DriverContext.DownloadFolder, FileType.Txt); - this.Driver.GetElement(this.fileLink.Evaluate("some-file.txt")).Click(); + this.Driver.GetElement(this.fileLink.Format("some-file.txt")).Click(); FilesHelper.WaitForFileOfGivenType(FileType.Txt, filesNumber, this.DriverContext.DownloadFolder); FileInfo file = FilesHelper.GetLastFile(this.DriverContext.DownloadFolder, FileType.Txt); FilesHelper.RenameFile(file.Name, newName, this.DriverContext.DownloadFolder, FileType.Txt); @@ -91,11 +91,11 @@ public DownloadPage SaveFile(string newName) public DownloadPage SaveAnyFile() { - if (BaseConfiguration.TestBrowser == DriverContext.BrowserType.Firefox - || BaseConfiguration.TestBrowser == DriverContext.BrowserType.Chrome) + if (BaseConfiguration.TestBrowser == BrowserType.Firefox + || BaseConfiguration.TestBrowser == BrowserType.Chrome) { var filesNumber = FilesHelper.CountFiles(this.DriverContext.DownloadFolder); - this.Driver.GetElement(this.fileLink.Evaluate("some-file.txt")).Click(); + this.Driver.GetElement(this.fileLink.Format("some-file.txt")).Click(); FilesHelper.WaitForFile(filesNumber, this.DriverContext.DownloadFolder); FileInfo file = FilesHelper.GetLastFile(this.DriverContext.DownloadFolder); FilesHelper.RenameFile(BaseConfiguration.ShortTimeout,file.Name, "name_of_file_branch.txt", this.DriverContext.DownloadFolder); diff --git a/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/InternetPage.cs b/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/InternetPage.cs index bfe92a86f..e304b6e08 100644 --- a/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/InternetPage.cs +++ b/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/InternetPage.cs @@ -53,7 +53,7 @@ public InternetPage(DriverContext driverContext) : base(driverContext) ///
public InternetPage OpenHomePage() { - var url = this.GetUrlValue(); + var url = BaseConfiguration.GetUrlValue; this.Driver.NavigateTo(new Uri(url)); Logger.Info(CultureInfo.CurrentCulture, "Opening page {0}", url); return this; @@ -64,7 +64,7 @@ public InternetPage OpenHomePage() /// public InternetPage OpenHomePageAndMeasureTime() { - var url = this.GetUrlValue(); + var url = BaseConfiguration.GetUrlValue; this.Driver.NavigateToAndMeasureTime(new Uri(url), waitForAjax: true); Logger.Info(CultureInfo.CurrentCulture, "Opening page {0}", url); return this; @@ -72,7 +72,7 @@ public InternetPage OpenHomePageAndMeasureTime() public InternetPage OpenHomePageWithUserCredentials() { - var url = this.GetUrlValueWithUserCredentials(); + var url = BaseConfiguration.GetUrlValueWithUserCredentials; this.Driver.NavigateTo(new Uri(url)); Logger.Info(CultureInfo.CurrentCulture, "Opening page {0}", url); return this; @@ -80,116 +80,90 @@ public InternetPage OpenHomePageWithUserCredentials() public JavaScriptAlertsPage GoToJavaScriptAlerts() { - this.Driver.GetElement(this.linkLocator.Evaluate("javascript_alerts")).Click(); + this.Driver.GetElement(this.linkLocator.Format("javascript_alerts")).Click(); return new JavaScriptAlertsPage(this.DriverContext); } public void GoToPage(string page) { - this.Driver.GetElement(this.linkLocator.Evaluate(page)).Click(); + this.Driver.GetElement(this.linkLocator.Format(page)).Click(); } public DownloadPage GoToFileDownloader() { - this.Driver.GetElement(this.linkLocator.Evaluate("download")).Click(); + this.Driver.GetElement(this.linkLocator.Format("download")).Click(); return new DownloadPage(this.DriverContext); } public MultipleWindowsPage GoToMultipleWindowsPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("windows")).Click(); + this.Driver.GetElement(this.linkLocator.Format("windows")).Click(); return new MultipleWindowsPage(this.DriverContext); } public BasicAuthPage GoToBasicAuthPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("basic_auth")).Click(); + this.Driver.GetElement(this.linkLocator.Format("basic_auth")).Click(); return new BasicAuthPage(this.DriverContext); } public NestedFramesPage GoToNestedFramesPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("nested_frames")).Click(); + this.Driver.GetElement(this.linkLocator.Format("nested_frames")).Click(); return new NestedFramesPage(this.DriverContext); } public CheckboxesPage GoToCheckboxesPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("checkboxes")).Click(); + this.Driver.GetElement(this.linkLocator.Format("checkboxes")).Click(); return new CheckboxesPage(this.DriverContext); } public ContextMenuPage GoToContextMenuPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("context_menu")).Click(); + this.Driver.GetElement(this.linkLocator.Format("context_menu")).Click(); return new ContextMenuPage(this.DriverContext); } public FormAuthenticationPage GoToFormAuthenticationPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("login")).Click(); + this.Driver.GetElement(this.linkLocator.Format("login")).Click(); return new FormAuthenticationPage(this.DriverContext); } public SecureFileDownloadPage GoToSecureFileDownloadPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("download_secure")).Click(); + this.Driver.GetElement(this.linkLocator.Format("download_secure")).Click(); return new SecureFileDownloadPage(this.DriverContext); } public ShiftingContentPage GoToShiftingContentPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("shifting_content")).Click(); + this.Driver.GetElement(this.linkLocator.Format("shifting_content")).Click(); return new ShiftingContentPage(this.DriverContext); } public HoversPage GoToHoversPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("hovers")).Click(); + this.Driver.GetElement(this.linkLocator.Format("hovers")).Click(); return new HoversPage(this.DriverContext); } public StatusCodesPage GoToStatusCodesPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("status_codes")).Click(); + this.Driver.GetElement(this.linkLocator.Format("status_codes")).Click(); return new StatusCodesPage(this.DriverContext); } public ForgotPasswordPage GoToForgotPasswordPage() { - this.Driver.GetElement(this.linkLocator.Evaluate("forgot_password")).Click(); + this.Driver.GetElement(this.linkLocator.Format("forgot_password")).Click(); return new ForgotPasswordPage(this.DriverContext); } public FloatingMenuPage GoToFloatingMenu() { - this.Driver.GetElement(this.linkLocator.Evaluate("floating_menu")).Click(); + this.Driver.GetElement(this.linkLocator.Format("floating_menu")).Click(); return new FloatingMenuPage(this.DriverContext); } - - private string GetUrlValue() - { - return string.Format( - CultureInfo.CurrentCulture, - "{0}://{1}{2}", - BaseConfiguration.Protocol, - BaseConfiguration.Host, - BaseConfiguration.Url); - } - - - - private string GetUrlValueWithUserCredentials() - { - return string.Format( - CultureInfo.CurrentCulture, - "{0}://{1}:{2}@{3}{4}", - BaseConfiguration.Protocol, - BaseConfiguration.Username, - BaseConfiguration.Password, - BaseConfiguration.Host, - BaseConfiguration.Url); - } - - } } diff --git a/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/SecureFileDownloadPage.cs b/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/SecureFileDownloadPage.cs index e08801a70..979766312 100644 --- a/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/SecureFileDownloadPage.cs +++ b/Objectivity.Test.Automation.Tests.PageObjects/PageObjects/TheInternet/SecureFileDownloadPage.cs @@ -54,10 +54,10 @@ public SecureFileDownloadPage(DriverContext driverContext) public SecureFileDownloadPage SaveFile(string fileName, string newName) { - if (BaseConfiguration.TestBrowser == DriverContext.BrowserType.Firefox - || BaseConfiguration.TestBrowser == DriverContext.BrowserType.Chrome) + if (BaseConfiguration.TestBrowser == BrowserType.Firefox + || BaseConfiguration.TestBrowser == BrowserType.Chrome) { - this.Driver.GetElement(this.fileLink.Evaluate(fileName)).Click(); + this.Driver.GetElement(this.fileLink.Format(fileName)).Click(); FilesHelper.WaitForFileOfGivenName(5, fileName, this.DriverContext.DownloadFolder); FileInfo file = FilesHelper.GetLastFile(this.DriverContext.DownloadFolder, FileType.Txt); FilesHelper.RenameFile(file.Name, newName, this.DriverContext.DownloadFolder, FileType.Csv); diff --git a/Objectivity.Test.Automation.Tests.PageObjects/packages.config b/Objectivity.Test.Automation.Tests.PageObjects/packages.config index feeed238c..028f2a637 100644 --- a/Objectivity.Test.Automation.Tests.PageObjects/packages.config +++ b/Objectivity.Test.Automation.Tests.PageObjects/packages.config @@ -2,8 +2,8 @@ - - - - + + + + \ No newline at end of file diff --git a/Objectivity.Test.Automation.Tests.Xunit/Objectivity.Test.Automation.Tests.Xunit.csproj b/Objectivity.Test.Automation.Tests.Xunit/Objectivity.Test.Automation.Tests.Xunit.csproj index a1c5aab37..bc540b733 100644 --- a/Objectivity.Test.Automation.Tests.Xunit/Objectivity.Test.Automation.Tests.Xunit.csproj +++ b/Objectivity.Test.Automation.Tests.Xunit/Objectivity.Test.Automation.Tests.Xunit.csproj @@ -19,6 +19,8 @@ UnitTest + ..\ + true true @@ -113,7 +115,9 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + +