├── .dockerignore ├── .github ├── dependabot.yml └── workflows │ └── github-actions.yml ├── .gitignore ├── Dockerfile ├── DockerfileBuild ├── LICENSE ├── Ocaramba.Documentation ├── Content │ └── Welcome.aml ├── ContentLayout.content ├── Ocaramba.Documentation.shfbproj ├── Selenium.shfbproj └── icons │ ├── 676_Framework_Ocaramba-logo-64x64.svg │ ├── Help.png │ └── Ocaramba-logo-64x64.png ├── Ocaramba.Tests.Angular ├── App.config ├── Ocaramba.Tests.Angular.csproj ├── PageObjects │ ├── ProtractorApiPage.cs │ ├── ProtractorHomePage.cs │ ├── TableOfContentsPage.cs │ └── TutorialPage.cs ├── ProjectTestBase.cs ├── Tests │ └── AngularTestNunit.cs ├── appsettings.Linux.json ├── appsettings.json ├── nlog.config └── packages.lock.json ├── Ocaramba.Tests.CloudProviderCrossBrowser ├── .config │ └── dotnet-tools.json ├── App.config ├── Ocaramba.Tests.CloudProviderCrossBrowser.csproj ├── ProjectTestBase.cs ├── Tests │ └── HerokuappTestsNUnit.cs ├── appsettings.Linux.json ├── appsettings.json ├── browserstack.yml ├── nlog.config └── packages.lock.json ├── Ocaramba.Tests.Features ├── App.config ├── Ocaramba.Tests.Features.csproj ├── ProjectTestBase.cs ├── StepDefinition │ └── CommonSteps.cs ├── TestFeatures │ ├── SmokeTests.feature │ └── SmokeTests.feature.cs ├── appsettings.Linux.json ├── appsettings.json ├── nlog.config └── packages.lock.json ├── Ocaramba.Tests.MsTest ├── App.config ├── DDT.csv ├── DDT.xml ├── HerokuappTestsMsTest.cs ├── Ocaramba.Tests.MsTest.csproj ├── ProjectTestBase.cs ├── Runsettings.runsettings ├── appsettings.Linux.json ├── appsettings.json ├── nlog.config └── packages.lock.json ├── Ocaramba.Tests.NUnit ├── App.config ├── DataDriven │ ├── CompareFiles.cs │ ├── DataDriven.xlsx │ ├── DataDriven.xml │ ├── DataDrivenHelper.cs │ ├── TestData.cs │ └── TestDataCsv.csv ├── Ocaramba.Tests.NUnit.csproj ├── ProjectBaseConfiguration.cs ├── ProjectTestBase.cs ├── Properties │ └── launchSettings.json ├── TestOutput │ ├── filetocompare_branch.csv │ ├── filetocompare_branch.txt │ ├── filetocompare_live.csv │ └── filetocompare_live.txt ├── Tests │ ├── CompareFilesDataDrivenTests.cs │ ├── HerokuappTestsDataDrivenNUnit.cs │ ├── HerokuappTestsNUnit.cs │ ├── JavaScriptAlertsTestsNUnit.cs │ ├── PerformanceTests1NUnit.cs │ ├── PerformanceTestsNUnit.cs │ ├── SaveScreenShotsPageSourceTestsNUnit.cs │ ├── SelectWebElementTests.cs │ └── UploadDownloadFilesTestsNUnit.cs ├── appsettings.Linux.json ├── appsettings.json ├── nlog.config └── packages.lock.json ├── Ocaramba.Tests.NUnitExtentReports ├── App.config ├── ExtentLogger │ └── ExtentTestLogger.cs ├── Ocaramba.Tests.NUnitExtentReports.csproj ├── PageObject │ ├── BasicAuthPage.cs │ ├── BrokenImagesPage.cs │ ├── DragAndDropPage.cs │ ├── DropdownPage.cs │ ├── InternetPage.cs │ ├── MultipleWindowsPage.cs │ ├── NestedFramesPage.cs │ ├── NewWindowPage.cs │ └── TablesPage.cs ├── ProjectBaseConfiguration.cs ├── ProjectTestBase.cs ├── Properties │ └── launchSettings.json ├── TestExecutionManager.cs ├── TestOutput │ ├── filetocompare_branch.csv │ ├── filetocompare_branch.txt │ ├── filetocompare_live.csv │ └── filetocompare_live.txt ├── Tests │ ├── HerokuappTestsNUnit.cs │ └── SelectWebElementTests.cs ├── appsettings.Linux.json ├── appsettings.json ├── nlog.config └── packages.lock.json ├── Ocaramba.Tests.PageObjects ├── CustomGrid.cs ├── Ocaramba.Tests.PageObjects.csproj ├── PageObjects │ └── TheInternet │ │ ├── AbTestingPage.cs │ │ ├── BasicAuthPage.cs │ │ ├── BrokenImagesPage.cs │ │ ├── CheckboxesPage.cs │ │ ├── ContextMenuPage.cs │ │ ├── DisappearingElementsPage.cs │ │ ├── DownloadPage.cs │ │ ├── DragAndDropPage.cs │ │ ├── DropdownPage.cs │ │ ├── DynamicControlsPage.cs │ │ ├── DynamicLoadingPage.cs │ │ ├── FloatingMenuPage.cs │ │ ├── ForgotPasswordPage.cs │ │ ├── FormAuthenticationPage.cs │ │ ├── HoversPage.cs │ │ ├── HttpCode200Page.cs │ │ ├── IFramePage.cs │ │ ├── InternetPage.cs │ │ ├── JavaScriptAlertsPage.cs │ │ ├── JavaScriptOnLoadPage.cs │ │ ├── KeyPressesPage.cs │ │ ├── MultipleWindowsPage.cs │ │ ├── NestedFramesPage.cs │ │ ├── NewWindowPage.cs │ │ ├── SecureFileDownloadPage.cs │ │ ├── ShiftingContentPage.cs │ │ ├── SlowResourcesPage.cs │ │ ├── StatusCodesPage.cs │ │ ├── TablesPage.cs │ │ └── UploadPage.cs ├── ProjectPageBase.cs └── packages.lock.json ├── Ocaramba.Tests.Xunit ├── App.config ├── Ocaramba.Tests.Xunit.csproj ├── ProjectTestBase.cs ├── TestFixture.cs ├── Tests │ ├── ExampleTest1.cs │ └── ExampleTest2.cs ├── appsettings.Linux.json ├── appsettings.json ├── nlog.config └── packages.lock.json ├── Ocaramba.UnitTests ├── App.config ├── Ocaramba.UnitTests.csproj ├── ProjectTestBase.cs ├── TestOutput │ └── TextWithinIFrameChromeError.png ├── Tests │ ├── DateHelperTests.cs │ ├── DriversCustomSettingsUnitTests.cs │ ├── FilesHelperTests.cs │ ├── JavaScriptAlertsTestsNUnit.cs │ ├── LocatorExtensionsTests.cs │ ├── NameHelperTests.cs │ ├── TakingScreehShotsOfElementsTests.cs │ └── WaitHelperTests.cs ├── appsettings.Linux.json ├── appsettings.json ├── nlog.config └── packages.lock.json ├── Ocaramba.sln ├── Ocaramba ├── Helpers │ ├── MdxHelper.cs │ └── SqlHelper.cs ├── Ocaramba.csproj ├── fxcop-sonarqube.tests.ruleset └── packages.lock.json ├── OcarambaLite ├── App.config ├── BaseConfiguration.cs ├── BrowserType.cs ├── CustomCodeAnalysisRules.xml ├── DriverContext.cs ├── DriverContextHelper.cs ├── DriverOptionsSetEventArgs.cs ├── DriversCustomSettings.cs ├── Exceptions │ ├── DataDrivenReadException.cs │ └── WaitTimeoutException.cs ├── Extensions │ ├── LocatorExtensions.cs │ ├── SearchContextExtensions.cs │ ├── WebDriverExtensions.cs │ └── WebElementExtensions.cs ├── Helpers │ ├── DateHelper.cs │ ├── FileType.cs │ ├── FilesHelper.cs │ ├── NameHelper.cs │ ├── PerformanceHelper.cs │ ├── PrintPerformanceResultsHelper.cs │ ├── TakeScreenShot.cs │ └── WaitHelper.cs ├── Locator.cs ├── Logger │ ├── MyEventFiringWebDriver.cs │ └── TestLogger.cs ├── OcarambaLite.csproj ├── TestBase.cs ├── Types │ ├── AverageGroupedTimes.cs │ ├── ElementLocator.cs │ ├── ErrorDetail.cs │ └── SavedTimes.cs ├── Verify.cs ├── WebElements │ ├── Checkbox.cs │ ├── JavaScriptAlert.cs │ ├── Select.cs │ └── Table.cs ├── fxcop-sonarqube.tests.ruleset ├── nlog.config └── packages.lock.json ├── README.md ├── azure-pipelines.yml ├── chromedriver.sh ├── docker-compose.yml ├── icon.png └── scripts ├── ExecutingTestsOnDockerGithubActions.ps1 ├── ExecutingTestsOnLinuxAzure.ps1 ├── ExecutingTestsOnLinuxBrowserStackGithubActions.ps1 ├── ExecutingTestsOnWindowsGithubActions1.ps1 ├── ExecutingTestsOnWindowsGithubActions2.ps1 ├── ExecutingTestsOnWindowsGithubActions3.ps1 ├── ExecutingTestsOnWindowsGithubActions4.ps1 ├── ExecutingTestsOnWindowsGithubActions5.ps1 ├── ExecutingTestsOnWindowsGithubActions6.ps1 ├── PublishingApiDocumentationOn_gh-pages.ps1 ├── removeSubprojectFromSolution.ps1 └── set_AppConfig_for_tests.ps1 /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .vs 3 | */bin/*/* 4 | */obj/*/* -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | version: 2 6 | updates: 7 | - package-ecosystem: "nuget" # See documentation for possible values 8 | directory: "/" # Location of package manifests 9 | schedule: 10 | interval: "daily" 11 | 12 | - package-ecosystem: "docker" 13 | directory: "/" 14 | # Check for updates once a week 15 | schedule: 16 | interval: "weekly" 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.vs/Ocaramba/v15 2 | /*.user 3 | /**/*.nupkg 4 | /**/bin/**/*.* 5 | /**/obj/**/*.* 6 | /packages/**/*.* 7 | /.vs/config/applicationhost.config 8 | /Ocaramba.Documentation/Help 9 | /Ocaramba/Ocaramba.xml 10 | /.vs 11 | /Ocaramba.Tests.Angular/TestResults/*.trx 12 | /Ocaramba.Tests.Docker.xml 13 | /nuget.exe 14 | /TestResults 15 | /.sonarqube/ 16 | /UpgradeLog.htm 17 | selenium-manager 18 | *.log 19 | -------------------------------------------------------------------------------- /DockerfileBuild: -------------------------------------------------------------------------------- 1 | FROM ocaramba/selenium 2 | COPY ./ /Ocaramba 3 | WORKDIR /Ocaramba 4 | RUN ls -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Objectivity Bespoke Software Specialists 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Ocaramba.Documentation/Content/Welcome.aml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test Framework was designed in Objectivity to propose common way how people should create Selenium WebDriver tests. 6 | 7 | 8 |
9 | Getting Started 10 | 11 | 12 | To get started visit https://github.com/ObjectivityLtd/Ocaramba/wiki/Getting-started. 13 | 14 | 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /Ocaramba.Documentation/ContentLayout.content: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ocaramba.Documentation/icons/676_Framework_Ocaramba-logo-64x64.svg: -------------------------------------------------------------------------------- 1 | 676_Framework_Ocaramba-logo -------------------------------------------------------------------------------- /Ocaramba.Documentation/icons/Help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Accenture/Ocaramba/9899dd10368b16479399880efc5fee96aea25856/Ocaramba.Documentation/icons/Help.png -------------------------------------------------------------------------------- /Ocaramba.Documentation/icons/Ocaramba-logo-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Accenture/Ocaramba/9899dd10368b16479399880efc5fee96aea25856/Ocaramba.Documentation/icons/Ocaramba-logo-64x64.png -------------------------------------------------------------------------------- /Ocaramba.Tests.Angular/PageObjects/ProtractorApiPage.cs: -------------------------------------------------------------------------------- 1 | using Ocaramba.Extensions; 2 | using Ocaramba.Types; 3 | using Ocaramba.Tests.PageObjects; 4 | using NLog; 5 | 6 | namespace Ocaramba.Tests.Angular.PageObjects 7 | { 8 | public class ProtractorApiPage : ProjectPageBase 9 | { 10 | #if net47 11 | private readonly NLog.Logger logger = LogManager.GetCurrentClassLogger(); 12 | #endif 13 | #if net8_0 14 | private readonly NLog.Logger logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 15 | #endif 16 | 17 | /// 18 | /// Locators for elements 19 | /// 20 | private readonly ElementLocator 21 | ElementToBeSelected = new ElementLocator(Locator.CssSelector, "a[href*='elementToBeSelected']"), 22 | ElementToBeSelectedHeader = new ElementLocator(Locator.XPath, "//h3[@class='api-title ng-binding'][contains(text(),'ExpectedConditions.elementToBeSelected')]"); 23 | 24 | public ProtractorApiPage(DriverContext driverContext) : base(driverContext) 25 | { 26 | } 27 | 28 | public ProtractorApiPage ClickElementToBeSelected() 29 | { 30 | this.Driver.GetElement(this.ElementToBeSelected).Click(); 31 | return new ProtractorApiPage(this.DriverContext); 32 | } 33 | 34 | public bool IsElementToBeSelectedHeaderDisplayed() 35 | { 36 | return this.Driver.GetElement(this.ElementToBeSelectedHeader).Displayed; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Angular/PageObjects/ProtractorHomePage.cs: -------------------------------------------------------------------------------- 1 | using Ocaramba; 2 | using Ocaramba.Extensions; 3 | using Ocaramba.Types; 4 | using Ocaramba.Tests.PageObjects; 5 | 6 | namespace Ocaramba.Tests.Angular.PageObjects 7 | { 8 | using System.Globalization; 9 | using NLog; 10 | using System; 11 | 12 | public class ProtractorHomePage : ProjectPageBase 13 | { 14 | #if net47 15 | private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); 16 | #endif 17 | #if net8_0 18 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 19 | #endif 20 | 21 | /// 22 | /// Locators for elements 23 | /// 24 | private readonly ElementLocator 25 | QuickStart = new ElementLocator(Locator.Id, "drop1"), 26 | Tutorial = new ElementLocator(Locator.CssSelector, "li[class*='open']>ul>li>a[href*='tutorial']"); 27 | 28 | public ProtractorHomePage OpenProtractorHomePage() 29 | { 30 | var url = BaseConfiguration.GetUrlValue; 31 | this.Driver.SynchronizeWithAngular(true); 32 | this.Driver.NavigateTo(new Uri(url)); 33 | Logger.Info(CultureInfo.CurrentCulture, "Opening page {0}", url); 34 | return this; 35 | } 36 | 37 | public ProtractorHomePage(DriverContext driverContext) : base(driverContext) 38 | { 39 | } 40 | 41 | public ProtractorHomePage ClickQuickStart() 42 | { 43 | this.Driver.GetElement(this.QuickStart).JavaScriptClick(); 44 | return this; 45 | } 46 | 47 | public TutorialPage ClickTutorial() 48 | { 49 | this.Driver.GetElement(this.Tutorial).Click(); 50 | return new TutorialPage(this.DriverContext); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Angular/PageObjects/TableOfContentsPage.cs: -------------------------------------------------------------------------------- 1 | using Ocaramba.Tests.PageObjects; 2 | 3 | namespace Ocaramba.Tests.Angular.PageObjects 4 | { 5 | using NLog; 6 | using Ocaramba.Types; 7 | using Ocaramba; 8 | using Ocaramba.Extensions; 9 | 10 | public class TableOfContentsPage : ProjectPageBase 11 | { 12 | #if net47 13 | private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); 14 | #endif 15 | #if net8_0 16 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 17 | #endif 18 | 19 | /// 20 | /// Locators for elements 21 | /// 22 | private readonly ElementLocator 23 | ProtractorApi = new ElementLocator(Locator.CssSelector, "ul[class='ng-scope']>li>a[href='#/api']"); 24 | 25 | public TableOfContentsPage(DriverContext driverContext) : base(driverContext) 26 | { 27 | } 28 | 29 | public ProtractorApiPage ClickProtractorApi() 30 | { 31 | this.Driver.GetElement(this.ProtractorApi).Click(); 32 | return new ProtractorApiPage(this.DriverContext); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Angular/PageObjects/TutorialPage.cs: -------------------------------------------------------------------------------- 1 | using Ocaramba.Tests.PageObjects; 2 | 3 | namespace Ocaramba.Tests.Angular.PageObjects 4 | { 5 | using NLog; 6 | using Ocaramba.Types; 7 | using Ocaramba; 8 | using Ocaramba.Extensions; 9 | 10 | public class TutorialPage : ProjectPageBase 11 | { 12 | #if net47 13 | private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); 14 | #endif 15 | #if net8_0 16 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 17 | #endif 18 | 19 | /// 20 | /// Locators for elements 21 | /// 22 | private readonly ElementLocator 23 | TableOfContents = new ElementLocator(Locator.CssSelector, "a[href*='toc']"); 24 | 25 | public TutorialPage(DriverContext driverContext) : base(driverContext) 26 | { 27 | } 28 | 29 | public TableOfContentsPage ClickTableOfContents() 30 | { 31 | this.Driver.GetElement(this.TableOfContents).Click(); 32 | return new TableOfContentsPage(this.DriverContext); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Angular/Tests/AngularTestNunit.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | using NUnit.Framework; 24 | 25 | namespace Ocaramba.Tests.Angular.Tests 26 | { 27 | using Ocaramba.Tests.Angular.PageObjects; 28 | 29 | [TestFixture] 30 | [Parallelizable(ParallelScope.Fixtures)] 31 | public class AngularTestNunit : ProjectTestBase 32 | { 33 | [Test] 34 | public void AngularPageNavigationTest() 35 | { 36 | var protractorApiPage = new ProtractorHomePage(this.DriverContext) 37 | .OpenProtractorHomePage() 38 | .ClickQuickStart() 39 | .ClickTutorial() 40 | .ClickTableOfContents() 41 | .ClickProtractorApi() 42 | .ClickElementToBeSelected(); 43 | 44 | Assert.That(protractorApiPage.IsElementToBeSelectedHeaderDisplayed(), Is.True, "Header is not displayed."); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Angular/appsettings.Linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "www.protractortest.org", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "false", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "false", 27 | "SeleniumScreenShotEnabled": "false", 28 | "GetPageSourceEnabled": "false", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false", 32 | "DataDrivenFile": "DataDriven/DataDriven.xml", 33 | "DataDrivenFileXlsx": "DataDriven/DataDriven.xlsx" 34 | }, 35 | 36 | "FirefoxPreferences": { 37 | }, 38 | "FirefoxExtensions": { 39 | }, 40 | "FirefoxArguments": { 41 | "-headless": "" 42 | }, 43 | "ChromePreferences": { 44 | }, 45 | "ChromeExtensions": { 46 | }, 47 | "DriverCapabilities": { 48 | }, 49 | "ChromeArguments": { 50 | "headless": "", 51 | "no-sandbox": "" 52 | }, 53 | "InternetExplorerPreferences": { 54 | } 55 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.Angular/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "www.protractortest.org", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "true", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "true", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false" 32 | }, 33 | "FirefoxPreferences": { 34 | }, 35 | "FirefoxExtensions": { 36 | }, 37 | "FirefoxArguments": { 38 | }, 39 | "ChromePreferences": { 40 | }, 41 | "ChromeExtensions": { 42 | }, 43 | "DriverCapabilities": { 44 | }, 45 | "ChromeArguments": { 46 | }, 47 | "InternetExplorerPreferences": { 48 | "EnsureCleanSession": "false", 49 | "EnablePersistentHover": "false", 50 | "IntroduceInstabilityByIgnoringProtectedModeSettings": "true" 51 | } 52 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.Angular/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Ocaramba.Tests.CloudProviderCrossBrowser/.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "browserstack-sdk": { 6 | "version": "1.16.16", 7 | "commands": [ 8 | "browserstack-sdk" 9 | ], 10 | "rollForward": false 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.CloudProviderCrossBrowser/Ocaramba.Tests.CloudProviderCrossBrowser.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | all 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Always 42 | 43 | 44 | Always 45 | 46 | 47 | PreserveNewest 48 | 49 | 50 | Always 51 | 52 | 53 | 54 | 55 | net8_0 56 | 57 | 58 | 59 | 60 | ..\Ocaramba\fxcop-sonarqube.tests.ruleset 61 | 62 | 63 | 64 | true 65 | 66 | 67 | -------------------------------------------------------------------------------- /Ocaramba.Tests.CloudProviderCrossBrowser/Tests/HerokuappTestsNUnit.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | using System; 24 | 25 | namespace Ocaramba.Tests.CloudProviderCrossBrowser.Tests 26 | { 27 | using global::NUnit.Framework; 28 | using Ocaramba; 29 | using Ocaramba.Tests.PageObjects.PageObjects.TheInternet; 30 | 31 | [TestFixture("ChromeWindows")] 32 | [TestFixture("Android")] 33 | [TestFixture("Iphone")] 34 | [TestFixture("FirefoxWindows")] 35 | [TestFixture("SafariMac")] 36 | [TestFixture("EdgeChromiumWindows")] 37 | [TestFixture("IEWindows")] 38 | [Parallelizable(ParallelScope.Fixtures)] 39 | public class HerokuappTestsNUnit : ProjectTestBase 40 | { 41 | public HerokuappTestsNUnit(string environment) 42 | : base(environment) 43 | { 44 | } 45 | 46 | [Test] 47 | public void TablesTest() 48 | { 49 | var tableElements = new InternetPage(this.DriverContext) 50 | .OpenHomePage() 51 | .GoToTablesPage(); 52 | var table = tableElements.GetTableElements(); 53 | 54 | Assert.That(table[0][0], Is.EqualTo("Smith")); 55 | Assert.That(table[3][5].Trim().Replace("\r", String.Empty).Replace(" ", String.Empty).Replace("\n", String.Empty), Is.EqualTo("edit delete")); 56 | } 57 | 58 | [Test] 59 | public void DynamicallyLoadedPageElementsTest() 60 | { 61 | var page = new InternetPage(this.DriverContext) 62 | .OpenHomePage() 63 | .GoToDynamicLoading() 64 | .ClickOnExample2(); 65 | 66 | page.ClickStart(); 67 | Assert.That(page.Text, Is.EqualTo("Hello World!")); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Ocaramba.Tests.CloudProviderCrossBrowser/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "RemoteWebDriver", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "CloudProvider", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "true", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "true", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false", 32 | "DataDrivenFile": "DataDriven\\DataDriven.xml", 33 | "DataDrivenFileXlsx": "DataDriven\\DataDriven.xlsx" 34 | }, 35 | "FirefoxPreferences": { 36 | }, 37 | "FirefoxExtensions": { 38 | }, 39 | "FirefoxArguments": { 40 | }, 41 | "ChromePreferences": { 42 | }, 43 | "ChromeExtensions": { 44 | }, 45 | "DriverCapabilities": { 46 | "projectName": "Ocaramba", 47 | "debug": "true", 48 | "buildName": "Ocaramba.Tests.CloudProviderCrossBrowser", 49 | "networkLogs": "true", 50 | "local": "false" 51 | }, 52 | "ChromeArguments": { 53 | }, 54 | "InternetExplorerPreferences": { 55 | }, 56 | "environments": { 57 | "ChromeWindows": { 58 | "browser": "Chrome", 59 | "os": "Windows", 60 | "osVersion": "11", 61 | "sessionName": "parallel_test" 62 | }, 63 | "SafariMac": { 64 | "os": "OS X", 65 | "osVersion": "Sequoia", 66 | "resolution": "3840x2160", 67 | "sessionName": "parallel_test" 68 | }, 69 | "EdgeChromiumWindows": { 70 | "browser": "Edge", 71 | "os": "Windows", 72 | "osVersion": "11", 73 | "sessionName": "parallel_test" 74 | }, 75 | "IEWindows": { 76 | "browser": "IE", 77 | "os": "Windows", 78 | "osVersion": "10", 79 | "sessionName": "parallel_test" 80 | }, 81 | "Android": { 82 | "browser": "samsung", 83 | "deviceName": "Samsung Galaxy S23 Ultra", 84 | "realMobile": "true", 85 | "sessionName": "parallel_test" 86 | }, 87 | "Iphone": { 88 | "deviceName": "iPhone 15", 89 | "realMobile": "true", 90 | "sessionName": "parallel_test", 91 | "osVersion": 17, 92 | "deviceOrientation": "portrait" 93 | }, 94 | "FirefoxWindows": { 95 | "browser": "firefox", 96 | "os": "Windows", 97 | "osVersion": "10", 98 | "sessionName": "parallel_test" 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /Ocaramba.Tests.CloudProviderCrossBrowser/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Features/appsettings.Linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "/home/appveyor/.nuget/packages/selenium.webdriver.geckodriver/0.25.0/driver/linux64", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "false", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "false", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false" 32 | }, 33 | 34 | "FirefoxPreferences": { 35 | }, 36 | "FirefoxExtensions": { 37 | }, 38 | "FirefoxArguments": { 39 | "-headless": "" 40 | }, 41 | "ChromePreferences": { 42 | }, 43 | "ChromeExtensions": { 44 | }, 45 | "DriverCapabilities": { 46 | }, 47 | "ChromeArguments": { 48 | "headless": "", 49 | "no-sandbox": "" 50 | }, 51 | "InternetExplorerPreferences": { 52 | } 53 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.Features/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "true", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "true", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false" 32 | }, 33 | "FirefoxPreferences": { 34 | }, 35 | "FirefoxExtensions": { 36 | }, 37 | "FirefoxArguments": { 38 | }, 39 | "ChromePreferences": { 40 | }, 41 | "ChromeExtensions": { 42 | }, 43 | "DriverCapabilities": { 44 | }, 45 | "ChromeArguments": { 46 | }, 47 | "InternetExplorerPreferences": { 48 | } 49 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.Features/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Ocaramba.Tests.MsTest/DDT.csv: -------------------------------------------------------------------------------- 1 | user, password, message 2 | tomsmith,SuperSecretPassword!,You logged into a secure area! 3 | wronguser,wrongpassword,Your username is invalid! -------------------------------------------------------------------------------- /Ocaramba.Tests.MsTest/DDT.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 5 | 6 | 7 | tomsmith 8 | SuperSecretPassword! 9 | You logged into a secure area! 10 | 11 | 12 | wronguser 13 | wrongpassword 14 | Your username is invalid! 15 | 16 | -------------------------------------------------------------------------------- /Ocaramba.Tests.MsTest/Runsettings.runsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | .\ 6 | 7 | 8 | 9 | false 10 | False 11 | False 12 | 14 | 15 | -------------------------------------------------------------------------------- /Ocaramba.Tests.MsTest/appsettings.Linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "false", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "false", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false" 32 | }, 33 | 34 | "FirefoxPreferences": { 35 | }, 36 | "FirefoxExtensions": { 37 | }, 38 | "FirefoxArguments": { 39 | "-headless": "" 40 | }, 41 | "ChromePreferences": { 42 | }, 43 | "ChromeExtensions": { 44 | }, 45 | "DriverCapabilities": { 46 | }, 47 | "ChromeArguments": { 48 | "headless": "", 49 | "no-sandbox": "" 50 | }, 51 | "InternetExplorerPreferences": { 52 | } 53 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.MsTest/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "true", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "true", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false" 32 | }, 33 | "FirefoxPreferences": { 34 | }, 35 | "FirefoxExtensions": { 36 | }, 37 | "FirefoxArguments": { 38 | }, 39 | "ChromePreferences": { 40 | }, 41 | "ChromeExtensions": { 42 | }, 43 | "DriverCapabilities": { 44 | }, 45 | "ChromeArguments": { 46 | }, 47 | "InternetExplorerPreferences": { 48 | } 49 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.MsTest/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/DataDriven/DataDriven.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Accenture/Ocaramba/9899dd10368b16479399880efc5fee96aea25856/Ocaramba.Tests.NUnit/DataDriven/DataDriven.xlsx -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/DataDriven/DataDriven.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/DataDriven/TestData.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | using System.IO; 24 | 25 | namespace Ocaramba.Tests.NUnit.DataDriven 26 | { 27 | using System.Collections; 28 | using System.Globalization; 29 | using global::NUnit.Framework; 30 | using Ocaramba.Tests.NUnit.DataDriven; 31 | 32 | /// 33 | /// DataDriven methods for NUnit test framework 34 | /// 35 | public static class TestData 36 | { 37 | public static IEnumerable Credentials 38 | { 39 | get { return DataDrivenHelper.ReadDataDriveFile(ProjectBaseConfiguration.DataDrivenFile, "credential", new[] { "user", "password" }, "credential"); } 40 | } 41 | 42 | public static IEnumerable CredentialsExcel 43 | { 44 | get { return DataDrivenHelper.ReadXlsxDataDriveFile(ProjectBaseConfiguration.DataDrivenFileXlsx, "credential", new[] { "user", "password" }, "credentialExcel"); } 45 | } 46 | 47 | public static IEnumerable LinksSetTestName 48 | { 49 | get { return DataDrivenHelper.ReadDataDriveFile(ProjectBaseConfiguration.DataDrivenFile, "links", new[] { "number" }, "Count_links"); } 50 | } 51 | 52 | public static IEnumerable Links 53 | { 54 | get { return DataDrivenHelper.ReadDataDriveFile(ProjectBaseConfiguration.DataDrivenFile, "links"); } 55 | } 56 | 57 | public static IEnumerable LinksExcel() 58 | { 59 | return DataDrivenHelper.ReadXlsxDataDriveFile(ProjectBaseConfiguration.DataDrivenFileXlsx, "links"); 60 | } 61 | 62 | public static IEnumerable CredentialsCSV() 63 | { 64 | return DataDrivenHelper.ReadDataDriveFileCsv(ProjectBaseConfiguration.DataDrivenFileCSV, new[] { "user", "password" }, "credentialCsv"); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/DataDriven/TestDataCsv.csv: -------------------------------------------------------------------------------- 1 | user;password;message 2 | test111;test222;Your username is invalid! 3 | tomsmith;SuperSecretPassword!;You logged into a secure area! -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Ocaramba.Tests.NUnit": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Linux" 7 | } 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/Tests/PerformanceTests1NUnit.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.NUnit.Tests 24 | { 25 | using global::NUnit.Framework; 26 | using Ocaramba.Tests.PageObjects.PageObjects.TheInternet; 27 | 28 | /// 29 | /// Tests to test framework 30 | /// 31 | [TestFixture] 32 | [Parallelizable(ParallelScope.Fixtures)] 33 | public class PerformanceTests1NUnit : ProjectTestBase 34 | { 35 | [Test] 36 | [Repeat(3)] 37 | public void HerokuappPerfTests1() 38 | { 39 | this.DriverContext.PerformanceMeasures.StartMeasure(); 40 | InternetPage internet = new InternetPage(this.DriverContext); 41 | internet.OpenHomePage(); 42 | this.DriverContext.PerformanceMeasures.StopMeasure(TestContext.CurrentContext.Test.Name + "LoadingMainPage"); 43 | this.DriverContext.PerformanceMeasures.StartMeasure(); 44 | internet.GoToCheckboxesPage(); 45 | this.DriverContext.PerformanceMeasures.StopMeasure(TestContext.CurrentContext.Test.Name + "LoadingCheckboxesPage"); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/Tests/PerformanceTestsNUnit.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.NUnit.Tests 24 | { 25 | using global::NUnit.Framework; 26 | using Ocaramba.Tests.PageObjects.PageObjects.TheInternet; 27 | 28 | /// 29 | /// Tests to test framework 30 | /// 31 | [TestFixture] 32 | [Parallelizable(ParallelScope.Fixtures)] 33 | public class PerformanceTestsNUnit : ProjectTestBase 34 | { 35 | [Test] 36 | [Repeat(3)] 37 | public void HerokuappPerfTests() 38 | { 39 | this.DriverContext.PerformanceMeasures.StartMeasure(); 40 | InternetPage internet = new InternetPage(this.DriverContext); 41 | internet.OpenHomePage(); 42 | this.DriverContext.PerformanceMeasures.StopMeasure(TestContext.CurrentContext.Test.Name + "LoadingMainPage"); 43 | this.DriverContext.PerformanceMeasures.StartMeasure(); 44 | internet.GoToCheckboxesPage(); 45 | this.DriverContext.PerformanceMeasures.StopMeasure(TestContext.CurrentContext.Test.Name + "LoadingCheckboxesPage"); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/Tests/SelectWebElementTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | 5 | namespace Ocaramba.Tests.NUnit.Tests 6 | { 7 | using global::NUnit.Framework; 8 | using Ocaramba.Tests.PageObjects.PageObjects.TheInternet; 9 | 10 | [TestFixture] 11 | [Parallelizable(ParallelScope.Fixtures)] 12 | public class SelectWebElementTests : ProjectTestBase 13 | { 14 | [Test] 15 | public void SelectByIndexTest() 16 | { 17 | var dropdownPage = new InternetPage(this.DriverContext) 18 | .OpenHomePage() 19 | .GoToDropdownPage(); 20 | 21 | dropdownPage.SelectByIndex(1); 22 | 23 | Assert.That(dropdownPage.SelectedOption(), Is.EqualTo("Option 1")); 24 | } 25 | 26 | [Test] 27 | public void NoSuchElementExceptionByTextTest() 28 | { 29 | var dropdownPage = new InternetPage(this.DriverContext) 30 | .OpenHomePage() 31 | .GoToDropdownPage(); 32 | 33 | Assert.That(() => dropdownPage.SelectByText("Qwerty.", 10), Throws.Nothing); 34 | } 35 | 36 | [Test] 37 | public void NoSuchElementExceptionByIndexTest() 38 | { 39 | var dropdownPage = new InternetPage(this.DriverContext) 40 | .OpenHomePage() 41 | .GoToDropdownPage(); 42 | 43 | Assert.That(() => dropdownPage.SelectByIndex(7), Throws.Nothing); 44 | } 45 | 46 | [Test] 47 | public void NoSuchElementExceptionByValueTest() 48 | { 49 | var dropdownPage = new InternetPage(this.DriverContext) 50 | .OpenHomePage() 51 | .GoToDropdownPage(); 52 | 53 | Assert.That(() => dropdownPage.SelectByValue("qwerty"), Throws.Nothing); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/appsettings.Linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "PathToEdgeChromiumDriverDirectory": "", 11 | "ChromeBrowserExecutableLocation": "", 12 | "FireFoxBrowserExecutableLocation": "", 13 | "EnableVerboseLoggingChrome": "false", 14 | "PathToChromeDriverLog": "C:\\Temp\\chromedriver.log", 15 | "FirefoxUseLegacyImplementation": "false", 16 | "PathToFirefoxProfile": "", 17 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 18 | "DriverCapabilities": "Chrome", 19 | "longTimeout": "30", 20 | "mediumTimeout": "10", 21 | "shortTimeout": "3", 22 | "ImplicitlyWaitMilliseconds": "200", 23 | "username": "admin", 24 | "password": "admin", 25 | "UseCurrentDirectory": "true", 26 | "DownloadFolder": "TestOutput", 27 | "ScreenShotFolder": "TestOutput", 28 | "PageSourceFolder": "TestOutput", 29 | "FullDesktopScreenShotEnabled": "false", 30 | "SeleniumScreenShotEnabled": "true", 31 | "GetPageSourceEnabled": "false", 32 | "JavaScriptErrorLogging": "false", 33 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 34 | "EnableEventFiringWebDriver": "false", 35 | "DataDrivenFile": "DataDriven/DataDriven.xml", 36 | "DataDrivenFileCSV": "DataDriven/TestDataCsv.csv", 37 | "DataDrivenFileXlsx": "DataDriven/DataDriven.xlsx" 38 | }, 39 | 40 | "FirefoxPreferences": { 41 | }, 42 | "FirefoxExtensions": { 43 | }, 44 | "FirefoxArguments": { 45 | "-headless": "" 46 | }, 47 | "ChromePreferences": { 48 | }, 49 | "ChromeExtensions": { 50 | }, 51 | "DriverCapabilities": { 52 | }, 53 | "ChromeArguments": { 54 | "headless": "", 55 | "no-sandbox": "", 56 | "disable-dev-shm-usage": "" 57 | }, 58 | "InternetExplorerPreferences": { 59 | }, 60 | "EdgeChromiumPreferences": { 61 | }, 62 | "EdgeChromiumExtensions": { 63 | }, 64 | "EdgeChromiumArguments": { 65 | "headless": "", 66 | "disable-gpu": "" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "PathToEdgeChromiumDriverDirectory": "", 11 | "ChromeBrowserExecutableLocation": "", 12 | "FireFoxBrowserExecutableLocation": "", 13 | "EdgeChromiumBrowserExecutableLocation": "", 14 | "EnableVerboseLoggingChrome": "false", 15 | "PathToChromeDriverLog": "C:\\Temp\\chromedriver.log", 16 | "FirefoxUseLegacyImplementation": "false", 17 | "PathToFirefoxProfile": "", 18 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 19 | "remoteTimeout": "300", 20 | "DriverCapabilities": "Chrome", 21 | "longTimeout": "30", 22 | "mediumTimeout": "10", 23 | "shortTimeout": "3", 24 | "ImplicitlyWaitMilliseconds": "200", 25 | "username": "admin", 26 | "password": "admin", 27 | "UseCurrentDirectory": "true", 28 | "DownloadFolder": "TestOutput", 29 | "ScreenShotFolder": "TestOutput", 30 | "PageSourceFolder": "TestOutput", 31 | "FullDesktopScreenShotEnabled": "true", 32 | "SeleniumScreenShotEnabled": "true", 33 | "GetPageSourceEnabled": "true", 34 | "JavaScriptErrorLogging": "false", 35 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 36 | "EnableEventFiringWebDriver": "false", 37 | "DataDrivenFile": "DataDriven\\DataDriven.xml", 38 | "DataDrivenFileCSV": "DataDriven\\TestDataCsv.csv", 39 | "DataDrivenFileXlsx": "DataDriven\\DataDriven.xlsx" 40 | }, 41 | 42 | "FirefoxPreferences": { 43 | }, 44 | "FirefoxExtensions": { 45 | }, 46 | "FirefoxArguments": { 47 | }, 48 | "ChromePreferences": { 49 | }, 50 | "ChromeExtensions": { 51 | }, 52 | "DriverCapabilities": { 53 | }, 54 | "ChromeArguments": { 55 | }, 56 | "InternetExplorerPreferences": { 57 | }, 58 | "EdgeChromiumPreferences": { 59 | }, 60 | "EdgeChromiumExtensions": { 61 | }, 62 | "EdgeChromiumArguments": { 63 | } 64 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnit/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/ExtentLogger/ExtentTestLogger.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework.Interfaces; 2 | using AventStack.ExtentReports; // Add this using directive 3 | 4 | namespace Ocaramba.Tests.NUnitExtentReports.ExtentLogger 5 | { 6 | /// 7 | /// Class containing methods enabling writing messages to Extent Report HTML file 8 | /// 9 | class ExtentTestLogger : ProjectTestBase 10 | { 11 | /// 12 | /// Log Info entry in HTML file 13 | /// 14 | /// The message 15 | public static void Info(string message) 16 | { 17 | test.Info(message); 18 | } 19 | 20 | /// 21 | /// Log Warning entry in HTML file 22 | /// 23 | /// The message 24 | public static void Warning(string message) 25 | { 26 | test.Warning(message); 27 | } 28 | 29 | /// 30 | /// Log Test Pass status in HTML file 31 | /// 32 | /// The message 33 | public static void Pass(string message) 34 | { 35 | test.Pass(message); 36 | } 37 | 38 | /// 39 | /// Log Test Failed status in HTML file 40 | /// 41 | /// Test status 42 | /// Error message 43 | public static void Fail(TestStatus status, string errorMessage) 44 | { 45 | test.Fail(status + ": " + errorMessage); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/PageObject/BasicAuthPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.NUnitExtentReports.PageObjects 24 | { 25 | using System.Globalization; 26 | using NLog; 27 | using Ocaramba; 28 | using Ocaramba.Extensions; 29 | using Ocaramba.Tests.PageObjects; 30 | using Ocaramba.Types; 31 | 32 | public class BasicAuthPage : ProjectPageBase 33 | { 34 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 35 | 36 | /// 37 | /// Locators for elements 38 | /// 39 | private readonly ElementLocator pageHeader = new ElementLocator(Locator.XPath, "//h3[.='Basic Auth']"), 40 | congratulationsInfo = new ElementLocator(Locator.CssSelector, ".example>p"); 41 | 42 | public BasicAuthPage(DriverContext driverContext) 43 | : base(driverContext) 44 | { 45 | Logger.Info("Waiting for page to open"); 46 | this.Driver.IsElementPresent(this.pageHeader, BaseConfiguration.ShortTimeout); 47 | } 48 | 49 | public string GetCongratulationsInfo 50 | { 51 | get 52 | { 53 | var text = this.Driver.GetElement(this.congratulationsInfo, "Trying to get congratulations Info").Text; 54 | Logger.Info(CultureInfo.CurrentCulture, "Text from page '{0}'", text); 55 | return text; 56 | } 57 | } 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/PageObject/BrokenImagesPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.NUnitExtentReports.PageObjects 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | 29 | public class BrokenImagesPage : InternetPage 30 | { 31 | private readonly ElementLocator 32 | pageHeaderElement = new ElementLocator(Locator.CssSelector, "h3"); 33 | 34 | public BrokenImagesPage(DriverContext driverContext) 35 | : base(driverContext) 36 | { 37 | } 38 | 39 | public bool IsPageHeaderElementEqualsToExpected(string text) 40 | { 41 | return this.Driver.GetElement(this.pageHeaderElement).IsElementTextEqualsToExpected(text); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/PageObject/DragAndDropPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.NUnitExtentReports.PageObjects 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Tests.NUnitExtentReports.ExtentLogger; 28 | using Ocaramba.Tests.PageObjects; 29 | using Ocaramba.Types; 30 | 31 | public class DragAndDropPage : ProjectPageBase 32 | { 33 | private readonly ElementLocator boxA = new ElementLocator(Locator.Id, "column-a"); 34 | private readonly ElementLocator boxB = new ElementLocator(Locator.Id, "column-b"); 35 | private readonly ElementLocator boxBtext = new ElementLocator(Locator.XPath, "//div[@id='column-b']/header"); 36 | private readonly ElementLocator classNameLocator = new ElementLocator(Locator.ClassName, "example"); 37 | 38 | private readonly ElementLocator cssSelectorLocator = new ElementLocator(Locator.CssSelector, "[class='example']"); 39 | 40 | public DragAndDropPage(DriverContext driverContext) 41 | : base(driverContext) 42 | { 43 | } 44 | 45 | public DragAndDropPage MoveElementAtoElementB() 46 | { 47 | ExtentTestLogger.Info("DragAndDropPage: Moving Box A element to Box B"); 48 | this.Driver.DragAndDropJs(this.Driver.GetElement(this.boxA), this.Driver.GetElement(this.boxB)); 49 | return this; 50 | } 51 | 52 | public bool IsElementAMovedToB() 53 | { 54 | return this.Driver.GetElement(this.boxBtext).Text.Equals("A"); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/PageObject/DropdownPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.NUnitExtentReports.PageObjects 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Tests.NUnitExtentReports.ExtentLogger; 28 | using Ocaramba.Tests.PageObjects; 29 | using Ocaramba.Types; 30 | using Ocaramba.WebElements; 31 | 32 | public class DropdownPage : ProjectPageBase 33 | { 34 | private readonly ElementLocator dropDownLocator = new ElementLocator( 35 | Locator.Id, "dropdown"); 36 | 37 | public DropdownPage(DriverContext driverContext) 38 | : base(driverContext) 39 | { 40 | } 41 | 42 | public void SelectByIndex(int index) 43 | { 44 | ExtentTestLogger.Info("DropdownPage: Selecting element on dropdown by index: " + index); 45 | Select select = this.Driver.GetElement(this.dropDownLocator, 300); 53 | select.SelectByValue(value); 54 | } 55 | 56 | public void SelectByText(string text, int timeout) 57 | { 58 | ExtentTestLogger.Info("DropdownPage: Selecting element on dropdown by visible text: " + text); 59 | Select select = this.Driver.GetElement(this.dropDownLocator); 67 | return select.SelectElement().SelectedOption.Text; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/PageObject/MultipleWindowsPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.NUnitExtentReports.PageObjects 24 | { 25 | using System; 26 | using Ocaramba; 27 | using Ocaramba.Extensions; 28 | using Ocaramba.Tests.NUnitExtentReports.ExtentLogger; 29 | using Ocaramba.Tests.PageObjects; 30 | using Ocaramba.Types; 31 | 32 | public class MultipleWindowsPage : ProjectPageBase 33 | { 34 | private readonly ElementLocator 35 | clickHerePageLocator = new ElementLocator(Locator.CssSelector, "a[href='/windows/new']"); 36 | 37 | public MultipleWindowsPage(DriverContext driverContext) 38 | : base(driverContext) 39 | { 40 | } 41 | 42 | public NewWindowPage OpenNewWindowPage() 43 | { 44 | const string UriString = "http://the-internet.herokuapp.com/windows/new"; 45 | 46 | ExtentTestLogger.Info("MultipleWindowsPage: Opening new Uri: " + UriString); 47 | this.Driver.GetElement(this.clickHerePageLocator).Click(); 48 | this.Driver.SwitchToWindowUsingUrl(new Uri(UriString), 5); 49 | return new NewWindowPage(this.DriverContext); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/PageObject/NewWindowPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.NUnitExtentReports.PageObjects 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Tests.PageObjects; 28 | using Ocaramba.Types; 29 | 30 | public class NewWindowPage : ProjectPageBase 31 | { 32 | private readonly ElementLocator 33 | newWindowPageLocator = new ElementLocator(Locator.CssSelector, "h3"); 34 | 35 | public NewWindowPage(DriverContext driverContext) 36 | : base(driverContext) 37 | { 38 | } 39 | 40 | public bool IsNewWindowH3TextVisible(string text) 41 | { 42 | return this.Driver.GetElement(this.newWindowPageLocator).IsElementTextEqualsToExpected(text); 43 | } 44 | 45 | public bool IsPageTile(string title) 46 | { 47 | return this.Driver.IsPageTitle(title, 2); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/PageObject/TablesPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.NUnitExtentReports.PageObjects 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Tests.NUnitExtentReports.ExtentLogger; 28 | using Ocaramba.Tests.PageObjects; 29 | using Ocaramba.Types; 30 | using Ocaramba.WebElements; 31 | 32 | public class TablesPage : ProjectPageBase 33 | { 34 | /// 35 | /// Locators for elements 36 | /// 37 | private readonly ElementLocator 38 | tableLocator = new ElementLocator(Locator.ClassName, "tablesorter"), 39 | column = new ElementLocator(Locator.CssSelector, "tr td"), 40 | row = new ElementLocator(Locator.CssSelector, "tbody tr"), 41 | tagNameLocator = new ElementLocator(Locator.TagName, "th"), 42 | xPathLocator = new ElementLocator(Locator.XPath, "//span"); 43 | 44 | public TablesPage(DriverContext driverContext) 45 | : base(driverContext) 46 | { 47 | } 48 | 49 | public string[][] GetTableElements() 50 | { 51 | ExtentTestLogger.Info("TablesPage: Getting table elements"); 52 | return this.Driver.GetElement(this.tableLocator).GetTable(this.row, this.column); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Ocaramba.Tests.NUnit": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Linux" 7 | } 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/TestExecutionManager.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using AventStack.ExtentReports; 3 | using AventStack.ExtentReports.Reporter; 4 | using AventStack.ExtentReports.Reporter.Config; 5 | using NUnit.Framework; 6 | 7 | namespace Ocaramba.Tests.NUnitExtentReports 8 | { 9 | /// 10 | /// Class containing setup and teardown definitions which are executed only once before and after entire test suite is executed 11 | /// 12 | [SetUpFixture] 13 | class TestExecutionManager : TestBase 14 | { 15 | protected readonly DriverContext driverContext = new DriverContext(); 16 | public static ExtentReports extent; 17 | 18 | protected DriverContext DriverContext 19 | { 20 | get 21 | { 22 | return this.driverContext; 23 | } 24 | } 25 | 26 | /// 27 | /// Method executed once only before all the tests are started 28 | /// 29 | [OneTimeSetUp] 30 | public void BeforeSuite() 31 | { 32 | this.DriverContext.CurrentDirectory = Directory.GetCurrentDirectory(); 33 | extent = new ExtentReports(); 34 | var reporter = new ExtentSparkReporter(this.DriverContext.CurrentDirectory + "\\TestOutput\\index.html"); 35 | reporter.Config.ReportName = "Ocaramba UITests Report - " + BaseConfiguration.TestBrowser; 36 | reporter.Config.Theme = Theme.Standard; 37 | extent.AttachReporter(reporter); 38 | } 39 | 40 | /// 41 | /// Method executed once only after all the tests are finished 42 | /// 43 | [OneTimeTearDown] 44 | public void AfterSuite() 45 | { 46 | extent.Flush(); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/Tests/SelectWebElementTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | 5 | namespace Ocaramba.Tests.NUnitExtentReports.Tests 6 | { 7 | using global::NUnit.Framework; 8 | using Ocaramba.Tests.NUnitExtentReports; 9 | using Ocaramba.Tests.NUnitExtentReports.PageObjects; 10 | 11 | [TestFixture] 12 | [Parallelizable(ParallelScope.Fixtures)] 13 | public class SelectWebElementTests : ProjectTestBase 14 | { 15 | [Test] 16 | public void SelectByIndexTest() 17 | { 18 | const string ExpectedOption = "Option 1"; 19 | 20 | var dropdownPage = new InternetPage(this.DriverContext) 21 | .OpenHomePage() 22 | .GoToDropdownPage(); 23 | 24 | dropdownPage.SelectByIndex(1); 25 | 26 | Assert.That(dropdownPage.SelectedOption(), Is.EqualTo(ExpectedOption)); 27 | test.Info("Verifying selected option, expected: " + ExpectedOption); 28 | } 29 | 30 | [Test] 31 | public void NoSuchElementExceptionByTextTest() 32 | { 33 | const string ElementText = "Qwerty."; 34 | 35 | var dropdownPage = new InternetPage(this.DriverContext) 36 | .OpenHomePage() 37 | .GoToDropdownPage(); 38 | 39 | Assert.That(() => dropdownPage.SelectByText(ElementText, 10), Throws.Nothing); 40 | test.Info("Verifying it's possible to select element on dropdown by text: " + ElementText); 41 | } 42 | 43 | [Test] 44 | public void NoSuchElementExceptionByIndexTest() 45 | { 46 | const int ElementIndex = 7; 47 | 48 | var dropdownPage = new InternetPage(this.DriverContext) 49 | .OpenHomePage() 50 | .GoToDropdownPage(); 51 | 52 | Assert.That(() => dropdownPage.SelectByIndex(ElementIndex), Throws.Nothing); 53 | test.Info("Verifying it's possible to select element on dropdown by element index: " + ElementIndex.ToString()); 54 | } 55 | 56 | [Test] 57 | public void NoSuchElementExceptionByValueTest() 58 | { 59 | const string ElementValue = "qwerty"; 60 | 61 | var dropdownPage = new InternetPage(this.DriverContext) 62 | .OpenHomePage() 63 | .GoToDropdownPage(); 64 | 65 | Assert.That(() => dropdownPage.SelectByValue(ElementValue), Throws.Nothing); 66 | test.Info("Verifying it's possible to select element on dropdown by value: " + ElementValue); 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/appsettings.Linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "PathToEdgeChromiumDriverDirectory": "", 11 | "PathToEdgeDriverDirectory": "", 12 | "ChromeBrowserExecutableLocation": "", 13 | "FireFoxBrowserExecutableLocation": "", 14 | "EnableVerboseLoggingChrome": "false", 15 | "PathToChromeDriverLog": "C:\\Temp\\chromedriver.log", 16 | "FirefoxUseLegacyImplementation": "false", 17 | "PathToFirefoxProfile": "", 18 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 19 | "DriverCapabilities": "Chrome", 20 | "longTimeout": "30", 21 | "mediumTimeout": "10", 22 | "shortTimeout": "3", 23 | "ImplicitlyWaitMilliseconds": "200", 24 | "username": "admin", 25 | "password": "admin", 26 | "UseCurrentDirectory": "true", 27 | "DownloadFolder": "TestOutput", 28 | "ScreenShotFolder": "TestOutput", 29 | "PageSourceFolder": "TestOutput", 30 | "FullDesktopScreenShotEnabled": "false", 31 | "SeleniumScreenShotEnabled": "true", 32 | "GetPageSourceEnabled": "false", 33 | "JavaScriptErrorLogging": "false", 34 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 35 | "EnableEventFiringWebDriver": "false", 36 | "DataDrivenFile": "DataDriven/DataDriven.xml", 37 | "DataDrivenFileCSV": "DataDriven/TestDataCsv.csv", 38 | "DataDrivenFileXlsx": "DataDriven/DataDriven.xlsx" 39 | }, 40 | 41 | "FirefoxPreferences": { 42 | }, 43 | "FirefoxExtensions": { 44 | }, 45 | "FirefoxArguments": { 46 | "-headless": "" 47 | }, 48 | "ChromePreferences": { 49 | }, 50 | "ChromeExtensions": { 51 | }, 52 | "DriverCapabilities": { 53 | }, 54 | "ChromeArguments": { 55 | "headless": "", 56 | "no-sandbox": "" 57 | }, 58 | "InternetExplorerPreferences": { 59 | }, 60 | "EdgeChromiumPreferences": { 61 | }, 62 | "EdgeChromiumExtensions": { 63 | }, 64 | "EdgeChromiumArguments": { 65 | "headless": "", 66 | "disable-gpu": "" 67 | } 68 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "PathToEdgeDriverDirectory": "", 11 | "PathToEdgeChromiumDriverDirectory": "", 12 | "ChromeBrowserExecutableLocation": "", 13 | "FireFoxBrowserExecutableLocation": "", 14 | "EdgeChromiumBrowserExecutableLocation": "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", 15 | "EnableVerboseLoggingChrome": "false", 16 | "PathToChromeDriverLog": "C:\\Temp\\chromedriver.log", 17 | "FirefoxUseLegacyImplementation": "false", 18 | "PathToFirefoxProfile": "", 19 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 20 | "DriverCapabilities": "Chrome", 21 | "longTimeout": "30", 22 | "mediumTimeout": "10", 23 | "shortTimeout": "3", 24 | "ImplicitlyWaitMilliseconds": "200", 25 | "username": "admin", 26 | "password": "admin", 27 | "UseCurrentDirectory": "true", 28 | "DownloadFolder": "TestOutput", 29 | "ScreenShotFolder": "TestOutput", 30 | "PageSourceFolder": "TestOutput", 31 | "FullDesktopScreenShotEnabled": "true", 32 | "SeleniumScreenShotEnabled": "true", 33 | "GetPageSourceEnabled": "true", 34 | "JavaScriptErrorLogging": "false", 35 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 36 | "EnableEventFiringWebDriver": "false", 37 | "DataDrivenFile": "DataDriven\\DataDriven.xml", 38 | "DataDrivenFileCSV": "DataDriven\\TestDataCsv.csv", 39 | "DataDrivenFileXlsx": "DataDriven\\DataDriven.xlsx" 40 | }, 41 | 42 | "FirefoxPreferences": { 43 | }, 44 | "FirefoxExtensions": { 45 | }, 46 | "FirefoxArguments": { 47 | }, 48 | "ChromePreferences": { 49 | }, 50 | "ChromeExtensions": { 51 | }, 52 | "DriverCapabilities": { 53 | }, 54 | "ChromeArguments": { 55 | }, 56 | "InternetExplorerPreferences": { 57 | }, 58 | "EdgeChromiumPreferences": { 59 | }, 60 | "EdgeChromiumExtensions": { 61 | }, 62 | "EdgeChromiumArguments": { 63 | } 64 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.NUnitExtentReports/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/CustomGrid.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects 24 | { 25 | using Ocaramba.Extensions; 26 | using OpenQA.Selenium; 27 | using OpenQA.Selenium.Remote; 28 | 29 | /// 30 | /// Sample class to extends framework with new webElement 31 | /// 32 | public class CustomGrid : WebElement 33 | { 34 | /// 35 | /// The web element 36 | /// 37 | private readonly IWebElement webElement; 38 | 39 | /// 40 | /// Initializes a new instance of the class. 41 | /// 42 | /// The webElement. 43 | public CustomGrid(IWebElement webElement) 44 | : base(webElement.ToDriver() as RemoteWebDriver, null) 45 | { 46 | this.webElement = webElement; 47 | } 48 | 49 | /// 50 | /// Sample method to extends framework with new webElement and actions for it 51 | /// 52 | /// Return true or false 53 | private bool IsGridDisplayed() 54 | { 55 | return this.webElement.Displayed; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/Ocaramba.Tests.PageObjects.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | net472;net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | net8_0 41 | 42 | 43 | 44 | net47 45 | 46 | 47 | 48 | 49 | ..\Ocaramba\fxcop-sonarqube.tests.ruleset 50 | 51 | 52 | 53 | ..\Ocaramba\fxcop-sonarqube.tests.ruleset 54 | 55 | 56 | true 57 | 58 | 59 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/AbTestingPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | 29 | public class AbTestingPage : ProjectPageBase 30 | { 31 | /// 32 | /// Locators for elements 33 | /// 34 | private readonly ElementLocator 35 | contentText = new ElementLocator(Locator.CssSelector, ".example > p"); 36 | 37 | public AbTestingPage(DriverContext driverContext) 38 | : base(driverContext) 39 | { 40 | } 41 | 42 | public string GetDescriptionUsingBy 43 | { 44 | get 45 | { 46 | return this.Driver.FindElement(this.contentText.ToBy()).Text; 47 | } 48 | } 49 | 50 | public string GetDescription 51 | { 52 | get 53 | { 54 | return this.Driver.GetElement(this.contentText).Text; 55 | } 56 | } 57 | 58 | public string GetDescriptionWithCustomTimeout 59 | { 60 | get 61 | { 62 | return this.Driver.GetElement(this.contentText, BaseConfiguration.MediumTimeout, "Getting Description").Text; 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/BrokenImagesPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | 29 | public class BrokenImagesPage : InternetPage 30 | { 31 | private readonly ElementLocator 32 | pageHeaderElement = new ElementLocator(Locator.CssSelector, "h3"); 33 | 34 | public BrokenImagesPage(DriverContext driverContext) 35 | : base(driverContext) 36 | { 37 | } 38 | 39 | public bool IsPageHeaderElementEqualsToExpected(string text) 40 | { 41 | return this.Driver.GetElement(this.pageHeaderElement).IsElementTextEqualsToExpected(text); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/ContextMenuPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | using Ocaramba.WebElements; 29 | using OpenQA.Selenium; 30 | using OpenQA.Selenium.Interactions; 31 | 32 | public class ContextMenuPage : ProjectPageBase 33 | { 34 | private readonly ElementLocator 35 | hotSpot = new ElementLocator(Locator.CssSelector, "#hot-spot"), 36 | h3Element = new ElementLocator(Locator.CssSelector, "h3"); 37 | 38 | public ContextMenuPage(DriverContext driverContext) 39 | : base(driverContext) 40 | { 41 | } 42 | 43 | public string JavaScriptText 44 | { 45 | get { return new JavaScriptAlert(this.Driver).JavaScriptText; } 46 | } 47 | 48 | public ContextMenuPage SelectTheInternetOptionFromContextMenu() 49 | { 50 | new Actions(this.Driver) 51 | .ContextClick(this.Driver.GetElement(this.hotSpot)) 52 | .SendKeys(Keys.ArrowDown) 53 | .SendKeys(Keys.ArrowDown) 54 | .SendKeys(Keys.ArrowDown) 55 | .SendKeys(Keys.ArrowDown) 56 | .SendKeys(Keys.ArrowDown) 57 | .SendKeys(Keys.Enter) 58 | .Perform(); 59 | return this; 60 | } 61 | 62 | public ContextMenuPage ConfirmJavaScript() 63 | { 64 | new JavaScriptAlert(this.Driver).ConfirmJavaScriptAlert(); 65 | return this; 66 | } 67 | 68 | public bool IsH3ElementEqualsToExpected(string text) 69 | { 70 | return this.Driver.GetElement(this.h3Element).IsElementTextEqualsToExpected(text); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/DisappearingElementsPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | 29 | public class DisappearingElementsPage : ProjectPageBase 30 | { 31 | /// 32 | /// Locators for elements 33 | /// 34 | private readonly ElementLocator 35 | menuLink = new ElementLocator(Locator.XPath, "//li/a[text()='{0}']"); 36 | 37 | public DisappearingElementsPage(DriverContext driverContext) 38 | : base(driverContext) 39 | { 40 | } 41 | 42 | public void RefreshAndWaitLinkNotVisible(string linkText) 43 | { 44 | this.Driver.Navigate().Refresh(); 45 | this.Driver.WaitUntilElementIsNoLongerFound( 46 | this.menuLink.Format(linkText), 47 | BaseConfiguration.ShortTimeout); 48 | } 49 | 50 | public string GetLinkTitleTagName(string linkText) 51 | { 52 | return this.Driver.GetElement(this.menuLink.Format(linkText), e => e.Displayed == true).TagName; 53 | } 54 | 55 | public bool IsLinkSelected(string linkText) 56 | { 57 | return this.Driver.GetElement(this.menuLink.Format(linkText), BaseConfiguration.MediumTimeout, e => e.Displayed == true).Selected; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/DragAndDropPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | 29 | public class DragAndDropPage : ProjectPageBase 30 | { 31 | private readonly ElementLocator boxA = new ElementLocator(Locator.Id, "column-a"); 32 | private readonly ElementLocator boxB = new ElementLocator(Locator.Id, "column-b"); 33 | private readonly ElementLocator boxBtext = new ElementLocator(Locator.XPath, "//div[@id='column-b']/header"); 34 | private readonly ElementLocator classNameLocator = new ElementLocator(Locator.ClassName, "example"); 35 | 36 | private readonly ElementLocator cssSelectorLocator = new ElementLocator(Locator.CssSelector, "[class='example']"); 37 | 38 | public DragAndDropPage(DriverContext driverContext) 39 | : base(driverContext) 40 | { 41 | } 42 | 43 | public string GetByIdLocator => this.Driver.GetElement(this.boxA).Text; 44 | 45 | public string GetByClassName => this.Driver.GetElement(this.classNameLocator).Text; 46 | 47 | public string GetByCssSelectorLocator => this.Driver.GetElement(this.cssSelectorLocator).Text; 48 | 49 | public DragAndDropPage MoveElementAtoElementB() 50 | { 51 | this.Driver.DragAndDropJs(this.Driver.GetElement(this.boxA), this.Driver.GetElement(this.boxB)); 52 | return this; 53 | } 54 | 55 | public bool IsElementAMovedToB() 56 | { 57 | return this.Driver.GetElement(this.boxBtext).Text.Equals("A"); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/DynamicControlsPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | 29 | public class DynamicControlsPage : ProjectPageBase 30 | { 31 | private readonly ElementLocator removeButton = new ElementLocator(Locator.Id, "btn"); 32 | 33 | public DynamicControlsPage(DriverContext driverContext) 34 | : base(driverContext) 35 | { 36 | } 37 | 38 | public void ClickRemove() 39 | { 40 | this.Driver.GetElement(this.removeButton).Click(); 41 | } 42 | 43 | public void WaitForIt() 44 | { 45 | this.Driver.WaitForAjax(BaseConfiguration.LongTimeout); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/DynamicLoadingPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using NLog; 26 | using Ocaramba; 27 | using Ocaramba.Extensions; 28 | using Ocaramba.Types; 29 | 30 | public class DynamicLoadingPage : ProjectPageBase 31 | { 32 | #if net47 33 | private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); 34 | #endif 35 | #if net8_0 36 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 37 | #endif 38 | 39 | private readonly ElementLocator exampleLink1 = new ElementLocator(Locator.CssSelector, "a[href='/dynamic_loading/2'"), 40 | startButton = new ElementLocator(Locator.XPath, "//button[.='Start']"), 41 | text = new ElementLocator(Locator.XPath, "//div[@id='finish']/h4"); 42 | 43 | public DynamicLoadingPage(DriverContext driverContext) 44 | : base(driverContext) 45 | { 46 | } 47 | 48 | public string Text 49 | { 50 | get 51 | { 52 | var returnText = this.Driver.GetElement(this.text).Text; 53 | Logger.Debug(returnText); 54 | return returnText; 55 | } 56 | } 57 | 58 | public void ShortTimeoutText() 59 | { 60 | var returnText = this.Driver.GetElement(this.text, BaseConfiguration.ShortTimeout).Text; 61 | Logger.Debug(returnText); 62 | } 63 | 64 | public DynamicLoadingPage ClickOnExample2() 65 | { 66 | this.Driver.GetElement(this.exampleLink1).Click(); 67 | return this; 68 | } 69 | 70 | public DynamicLoadingPage ClickStart() 71 | { 72 | this.Driver.GetElement(this.startButton).Click(); 73 | return this; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/FloatingMenuPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using System; 26 | using NLog; 27 | using Ocaramba; 28 | using Ocaramba.Extensions; 29 | using Ocaramba.Types; 30 | 31 | public class FloatingMenuPage : ProjectPageBase 32 | { 33 | #if net47 34 | private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); 35 | #endif 36 | #if net8_0 37 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 38 | #endif 39 | 40 | private readonly ElementLocator floatingMenuPageText = new ElementLocator( 41 | Locator.CssSelector, 42 | "div.scroll"); 43 | 44 | private readonly ElementLocator floatingHomeButton = new ElementLocator( 45 | Locator.CssSelector, 46 | "a[href='#home']"); 47 | 48 | public FloatingMenuPage(DriverContext driverContext) 49 | : base(driverContext) 50 | { 51 | Logger.Info("Waiting for File Download page to open"); 52 | //// this.Driver.IsElementPresent(this.floatingMenuPageText, BaseConfiguration.ShortTimeout); 53 | } 54 | 55 | public FloatingMenuPage ClickFloatingMenuButton() 56 | { 57 | this.Driver.ScrollIntoMiddle(this.floatingMenuPageText); 58 | this.Driver.GetElement(this.floatingHomeButton).Click(); 59 | 60 | return this; 61 | } 62 | 63 | public bool IsUrlEndsWith(string text) 64 | { 65 | return this.DriverContext.Driver.Url.ToString().EndsWith(text, StringComparison.CurrentCulture); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/HoversPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using OpenQA.Selenium; 28 | 29 | public class HoversPage : ProjectPageBase 30 | { 31 | public HoversPage(DriverContext driverContext) 32 | : base(driverContext) 33 | { 34 | } 35 | 36 | public void MouseHoverAt(int nr) 37 | { 38 | this.Driver.Actions().MoveToElement(this.Driver.FindElement(By.XPath("(.//*[@id='content']/div/div)[" + nr + "]/img"))).Build().Perform(); 39 | } 40 | 41 | public string GetHoverText(int nr) 42 | { 43 | var webElement = this.Driver.FindElement(By.XPath(".//*[@id='content']/div/div[" + nr + "]/div/h5")); 44 | return webElement.Text; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/HttpCode200Page.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | 29 | public class HttpCode200Page : ProjectPageBase 30 | { 31 | private readonly ElementLocator 32 | httpCode200Header = new ElementLocator(Locator.XPath, "//*[contains(text(),'This page returned a 200 status code.')]"); 33 | 34 | public HttpCode200Page(DriverContext driverContext) 35 | : base(driverContext) 36 | { 37 | } 38 | 39 | public bool IsHTTPCode200PageIsDisplayed() 40 | { 41 | return this.Driver.IsElementPresent(this.httpCode200Header, BaseConfiguration.MediumTimeout); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/IFramePage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using System.Globalization; 26 | using NLog; 27 | using Ocaramba; 28 | using Ocaramba.Extensions; 29 | using Ocaramba.Helpers; 30 | using Ocaramba.Types; 31 | 32 | public class IFramePage : ProjectPageBase 33 | { 34 | #if net47 35 | private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); 36 | #endif 37 | #if net8_0 38 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 39 | #endif 40 | 41 | private readonly ElementLocator 42 | menu = new ElementLocator(Locator.CssSelector, "div[role=menubar]"), 43 | iframe = new ElementLocator(Locator.Id, "mce_0_ifr"), 44 | elelemtInIFrame = new ElementLocator(Locator.Id, "tinymce"); 45 | 46 | public IFramePage(DriverContext driverContext) 47 | : base(driverContext) 48 | { 49 | } 50 | 51 | public string TakeScreenShotsOfTextInIFrame(string folder, string name) 52 | { 53 | Logger.Info(CultureInfo.CurrentCulture, "Take Screen Shots"); 54 | var iFrame = this.Driver.GetElement(this.iframe); 55 | int x = iFrame.Location.X; 56 | int y = iFrame.Location.Y; 57 | this.Driver.SwitchTo().Frame(0); 58 | var el = this.Driver.GetElement(this.elelemtInIFrame); 59 | return TakeScreenShot.TakeScreenShotOfElement(x, y, el, folder, name); 60 | } 61 | 62 | public string TakeScreenShotsOfMenu(string folder, string name) 63 | { 64 | Logger.Info(CultureInfo.CurrentCulture, "Take Screen Shots"); 65 | var el = this.Driver.GetElement(this.menu); 66 | return TakeScreenShot.TakeScreenShotOfElement(el, folder, name); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/JavaScriptOnLoadPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | 27 | public class JavaScriptOnLoadPage : ProjectPageBase 28 | { 29 | public JavaScriptOnLoadPage(DriverContext driverContext) 30 | : base(driverContext) 31 | { 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/MultipleWindowsPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using System; 26 | using Ocaramba; 27 | using Ocaramba.Extensions; 28 | using Ocaramba.Types; 29 | 30 | public class MultipleWindowsPage : ProjectPageBase 31 | { 32 | private readonly ElementLocator 33 | clickHerePageLocator = new ElementLocator(Locator.CssSelector, "a[href='/windows/new']"); 34 | 35 | public MultipleWindowsPage(DriverContext driverContext) 36 | : base(driverContext) 37 | { 38 | } 39 | 40 | public NewWindowPage OpenNewWindowPage() 41 | { 42 | this.Driver.GetElement(this.clickHerePageLocator).Click(); 43 | this.Driver.SwitchToWindowUsingUrl(new Uri("https://the-internet.herokuapp.com/windows/new"), 5); 44 | return new NewWindowPage(this.DriverContext); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/NestedFramesPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | 29 | public class NestedFramesPage : ProjectPageBase 30 | { 31 | private readonly ElementLocator 32 | leftBody = new ElementLocator(Locator.CssSelector, "body"), 33 | middleBody = new ElementLocator(Locator.CssSelector, "div#content"), 34 | rightBody = new ElementLocator(Locator.CssSelector, "body"), 35 | bottomBody = new ElementLocator(Locator.CssSelector, "body"); 36 | 37 | public NestedFramesPage(DriverContext driverContext) 38 | : base(driverContext) 39 | { 40 | } 41 | 42 | public string LeftBody 43 | { 44 | get { return this.Driver.GetElement(this.leftBody).Text; } 45 | } 46 | 47 | public string MiddleBody 48 | { 49 | get { return this.Driver.GetElement(this.middleBody).Text; } 50 | } 51 | 52 | public string RightBody 53 | { 54 | get { return this.Driver.GetElement(this.rightBody).Text; } 55 | } 56 | 57 | public string BottomBody 58 | { 59 | get { return this.Driver.GetElement(this.bottomBody).Text; } 60 | } 61 | 62 | public NestedFramesPage SwitchToFrame(string frame) 63 | { 64 | this.Driver.SwitchTo().Frame(frame); 65 | return this; 66 | } 67 | 68 | public NestedFramesPage SwitchToParentFrame() 69 | { 70 | this.Driver.SwitchTo().ParentFrame(); 71 | return this; 72 | } 73 | 74 | public NestedFramesPage ReturnToDefaultContent() 75 | { 76 | this.Driver.SwitchTo().DefaultContent(); 77 | return this; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/NewWindowPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | 29 | public class NewWindowPage : ProjectPageBase 30 | { 31 | private readonly ElementLocator 32 | newWindowPageLocator = new ElementLocator(Locator.CssSelector, "h3"); 33 | 34 | public NewWindowPage(DriverContext driverContext) 35 | : base(driverContext) 36 | { 37 | } 38 | 39 | public bool IsNewWindowH3TextVisible(string text) 40 | { 41 | return this.Driver.GetElement(this.newWindowPageLocator).IsElementTextEqualsToExpected(text); 42 | } 43 | 44 | public bool IsPageTile(string title) 45 | { 46 | return this.Driver.IsPageTitle(title, 2); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/ShiftingContentPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using System.Globalization; 26 | using NLog; 27 | using Ocaramba; 28 | using Ocaramba.Extensions; 29 | using Ocaramba.Types; 30 | 31 | public class ShiftingContentPage : ProjectPageBase 32 | { 33 | #if net47 34 | private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); 35 | #endif 36 | #if net8_0 37 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 38 | #endif 39 | 40 | /// 41 | /// Locators for elements 42 | /// 43 | private readonly ElementLocator pageHeader = new ElementLocator(Locator.XPath, "//h3[.='Shifting Content']"), 44 | links = new ElementLocator(Locator.CssSelector, ".example>a"); 45 | 46 | public ShiftingContentPage(DriverContext driverContext) 47 | : base(driverContext) 48 | { 49 | Logger.Info("Waiting for page to open"); 50 | this.Driver.IsElementPresent(this.pageHeader, BaseConfiguration.ShortTimeout); 51 | } 52 | 53 | public string CountLinks() 54 | { 55 | var count = this.Driver.GetElements(this.links, BaseConfiguration.ShortTimeout, e => e.Displayed && e.Enabled, 1).Count; 56 | Logger.Info(CultureInfo.CurrentCulture, "Number of links on page '{0}'", count); 57 | return count.ToString(CultureInfo.CurrentCulture); 58 | } 59 | 60 | public string CountLinksGetElementsBasic() 61 | { 62 | var count = this.Driver.GetElements(this.links, 3).Count; 63 | Logger.Info(CultureInfo.CurrentCulture, "Number of links on page '{0}'", count); 64 | return count.ToString(CultureInfo.CurrentCulture); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/SlowResourcesPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | 28 | public class SlowResourcesPage : ProjectPageBase 29 | { 30 | public SlowResourcesPage(DriverContext driverContext) 31 | : base(driverContext) 32 | { 33 | } 34 | 35 | public void WaitForIt(int timeout) 36 | { 37 | this.Driver.WaitForAjax(timeout); 38 | 39 | // resouces load 30 sec. on page 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/StatusCodesPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using NLog; 26 | using Ocaramba; 27 | using Ocaramba.Extensions; 28 | using Ocaramba.Types; 29 | 30 | /// 31 | /// The status codes page object. 32 | /// 33 | public class StatusCodesPage : ProjectPageBase 34 | { 35 | #if net47 36 | private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); 37 | #endif 38 | #if net8_0 39 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 40 | #endif 41 | 42 | private readonly ElementLocator 43 | statusCodeHeader = new ElementLocator(Locator.XPath, "//h3[text()='Status Codes']"), 44 | code200 = new ElementLocator(Locator.CssSelector, "a[href='status_codes/200']"); 45 | 46 | public StatusCodesPage(DriverContext driverContext) 47 | : base(driverContext) 48 | { 49 | } 50 | 51 | public bool IsStatusCodesPageDisplayed() 52 | { 53 | Logger.Info("Check if Status Codes page is displayed."); 54 | return this.Driver.IsElementPresent(this.statusCodeHeader, BaseConfiguration.MediumTimeout); 55 | } 56 | 57 | public bool IsTextExistedInPageSource(string text) 58 | { 59 | return this.Driver.PageSourceContainsCase(text, BaseConfiguration.MediumTimeout, false); 60 | } 61 | 62 | public HttpCode200Page Click200() 63 | { 64 | this.Driver.GetElement(this.code200).JavaScriptClick(); 65 | return new HttpCode200Page(this.DriverContext); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/PageObjects/TheInternet/TablesPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet 24 | { 25 | using Ocaramba; 26 | using Ocaramba.Extensions; 27 | using Ocaramba.Types; 28 | using Ocaramba.WebElements; 29 | 30 | public class TablesPage : ProjectPageBase 31 | { 32 | /// 33 | /// Locators for elements 34 | /// 35 | private readonly ElementLocator 36 | tableLocator = new ElementLocator(Locator.ClassName, "tablesorter"), 37 | column = new ElementLocator(Locator.CssSelector, "tr td"), 38 | row = new ElementLocator(Locator.CssSelector, "tbody tr"), 39 | tagNameLocator = new ElementLocator(Locator.TagName, "th"), 40 | xPathLocator = new ElementLocator(Locator.XPath, "//span"); 41 | 42 | public TablesPage(DriverContext driverContext) 43 | : base(driverContext) 44 | { 45 | } 46 | 47 | public string GetByTagNameLocator => this.Driver.GetElement(this.tagNameLocator).Text; 48 | 49 | public string GetByXpathLocator => this.Driver.GetElement(this.xPathLocator).Text; 50 | 51 | public string[][] GetTableElements() 52 | { 53 | return this.Driver.GetElement
(this.tableLocator).GetTable(this.row, this.column); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Ocaramba.Tests.PageObjects/ProjectPageBase.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.PageObjects 24 | { 25 | using Ocaramba; 26 | using OpenQA.Selenium; 27 | 28 | public partial class ProjectPageBase 29 | { 30 | public ProjectPageBase(DriverContext driverContext) 31 | { 32 | this.DriverContext = driverContext; 33 | this.Driver = driverContext.Driver; 34 | } 35 | 36 | protected IWebDriver Driver { get; set; } 37 | 38 | protected DriverContext DriverContext { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Xunit/TestFixture.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.Xunit 24 | { 25 | using System; 26 | using Ocaramba; 27 | 28 | /// 29 | /// The test fixture class for all tests 30 | /// run once per test suite 31 | /// 32 | // ReSharper disable once ClassNeverInstantiated.Global 33 | public class TestFixture : TestBase, IDisposable 34 | { 35 | private bool disposed; 36 | 37 | /// 38 | /// Initializes a new instance of the class. 39 | /// 40 | public TestFixture() 41 | { 42 | } 43 | 44 | public bool Disposed 45 | { 46 | get 47 | { 48 | if (!this.disposed) 49 | { 50 | return this.disposed; 51 | } 52 | 53 | throw new ObjectDisposedException("CanBeDisposed"); 54 | } 55 | } 56 | 57 | /// 58 | /// After the class. 59 | /// 60 | public void Dispose() 61 | { 62 | this.Dispose(true); 63 | GC.SuppressFinalize(this); 64 | } 65 | 66 | protected virtual void Dispose(bool disposing) 67 | { 68 | if (!this.disposed) 69 | { 70 | if (disposing) 71 | { 72 | } 73 | 74 | this.disposed = true; 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Xunit/Tests/ExampleTest1.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.Xunit.Tests 24 | { 25 | using global::Xunit; 26 | using Ocaramba; 27 | using Ocaramba.Tests.PageObjects.PageObjects.TheInternet; 28 | 29 | public class ExampleTest1 : ProjectTestBase 30 | { 31 | [Fact] 32 | public void TestMethod1() 33 | { 34 | const string PageTitle = "New Window"; 35 | 36 | var newWindowPage = new InternetPage(this.DriverContext) 37 | .OpenHomePage() 38 | .GoToMultipleWindowsPage() 39 | .OpenNewWindowPage(); 40 | 41 | Assert.True(newWindowPage.IsPageTile(PageTitle)); 42 | Assert.True(newWindowPage.IsNewWindowH3TextVisible(PageTitle)); 43 | } 44 | 45 | [Fact] 46 | public void ContextMenuTest() 47 | { 48 | const string H3Value = "Context Menu"; 49 | var browser = BaseConfiguration.TestBrowser; 50 | if (browser.Equals(BrowserType.Firefox)) 51 | { 52 | var contextMenuPage = new InternetPage(this.DriverContext) 53 | .OpenHomePage() 54 | .GoToContextMenuPage() 55 | .SelectTheInternetOptionFromContextMenu(); 56 | 57 | Assert.Equal("You selected a context menu", contextMenuPage.JavaScriptText); 58 | Assert.True(contextMenuPage 59 | .ConfirmJavaScript() 60 | .IsH3ElementEqualsToExpected(H3Value)); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Xunit/Tests/ExampleTest2.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Tests.Xunit.Tests 24 | { 25 | using global::Xunit; 26 | using Ocaramba.Tests.PageObjects.PageObjects.TheInternet; 27 | 28 | public class ExampleTest2 : ProjectTestBase 29 | { 30 | [Fact] 31 | public void NestedFramesTest() 32 | { 33 | var nestedFramesPage = new InternetPage(this.DriverContext) 34 | .OpenHomePage() 35 | .GoToNestedFramesPage() 36 | .SwitchToFrame("frame-top"); 37 | 38 | nestedFramesPage.SwitchToFrame("frame-left"); 39 | Assert.Equal("LEFT", nestedFramesPage.LeftBody); 40 | 41 | nestedFramesPage.SwitchToParentFrame().SwitchToFrame("frame-middle"); 42 | Assert.Equal("MIDDLE", nestedFramesPage.MiddleBody); 43 | 44 | nestedFramesPage.SwitchToParentFrame().SwitchToFrame("frame-right"); 45 | Assert.Equal("RIGHT", nestedFramesPage.RightBody); 46 | 47 | nestedFramesPage.ReturnToDefaultContent().SwitchToFrame("frame-bottom"); 48 | Assert.Equal("BOTTOM", nestedFramesPage.BottomBody); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Ocaramba.Tests.Xunit/appsettings.Linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "false", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "false", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false" 32 | }, 33 | 34 | "FirefoxPreferences": { 35 | }, 36 | "FirefoxExtensions": { 37 | }, 38 | "FirefoxArguments": { 39 | "-headless": "" 40 | }, 41 | "ChromePreferences": { 42 | }, 43 | "ChromeExtensions": { 44 | }, 45 | "DriverCapabilities": { 46 | }, 47 | "ChromeArguments": { 48 | "headless": "", 49 | "no-sandbox": "" 50 | }, 51 | "InternetExplorerPreferences": { 52 | } 53 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.Xunit/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "true", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "true", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false" 32 | }, 33 | "FirefoxPreferences": { 34 | }, 35 | "FirefoxExtensions": { 36 | }, 37 | "FirefoxArguments": { 38 | }, 39 | "ChromePreferences": { 40 | }, 41 | "ChromeExtensions": { 42 | }, 43 | "DriverCapabilities": { 44 | }, 45 | "ChromeArguments": { 46 | }, 47 | "InternetExplorerPreferences": { 48 | } 49 | } -------------------------------------------------------------------------------- /Ocaramba.Tests.Xunit/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Ocaramba.UnitTests/TestOutput/TextWithinIFrameChromeError.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Accenture/Ocaramba/9899dd10368b16479399880efc5fee96aea25856/Ocaramba.UnitTests/TestOutput/TextWithinIFrameChromeError.png -------------------------------------------------------------------------------- /Ocaramba.UnitTests/Tests/DateHelperTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using NUnit.Framework; 4 | using Ocaramba.Helpers; 5 | 6 | namespace Ocaramba.UnitTests.Tests 7 | { 8 | [TestFixture()] 9 | [TestFixture, Parallelizable(ParallelScope.Self)] 10 | public class DateHelperTests 11 | { 12 | [Test()] 13 | public void TomorrowDateTest() 14 | { 15 | Assert.That(DateHelper.TomorrowDate, Is.EqualTo(DateTime.Now.AddDays(1).ToString("ddMMyyyy", CultureInfo.CurrentCulture))); 16 | } 17 | 18 | [Test()] 19 | public void CurrentDateTest() 20 | { 21 | Assert.That(DateHelper.CurrentDate, Is.EqualTo(DateTime.Now.ToString("dd-MM-yyyy", CultureInfo.CurrentCulture))); 22 | } 23 | 24 | [Test()] 25 | public void CurrentTimeStampTest() 26 | { 27 | var expectedDateTime = DateTime.ParseExact(DateHelper.CurrentTimeStamp, "ddMMyyyyHHmmss", null); 28 | var actualDateTime = DateTime.Now; 29 | Assert.That(actualDateTime.ToString("ddMMyyyyHHmmss"), Is.EqualTo(expectedDateTime.ToString("ddMMyyyyHHmmss"))); 30 | } 31 | 32 | [Test()] 33 | public void GetFutureDateTest() 34 | { 35 | Assert.That(DateHelper.GetFutureDate(3), Is.EqualTo(DateTime.Now.AddDays(3).ToString("ddMMyyyy", CultureInfo.CurrentCulture))); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Ocaramba.UnitTests/Tests/DriversCustomSettingsUnitTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | using System.IO; 24 | using NUnit.Framework; 25 | using Ocaramba.Extensions; 26 | 27 | namespace Ocaramba.UnitTests.Tests 28 | { 29 | [TestFixture, Parallelizable(ParallelScope.Fixtures)] 30 | public class DriversCustomSettingsUnitTests 31 | { 32 | [Test] 33 | public void CheckSynchronizationWithAngularFuctionality() 34 | { 35 | #if net8_0 36 | string folder = Directory.GetCurrentDirectory(); 37 | #endif 38 | 39 | #if net47 40 | string folder = TestContext.CurrentContext.TestDirectory; 41 | #endif 42 | var driverContext = new Ocaramba.DriverContext {CurrentDirectory = folder }; 43 | driverContext.Start(); 44 | var Default_false = DriversCustomSettings.IsDriverSynchronizationWithAngular(driverContext.Driver); 45 | driverContext.Driver.SynchronizeWithAngular(true); 46 | var TurnOn_true = DriversCustomSettings.IsDriverSynchronizationWithAngular(driverContext.Driver); 47 | driverContext.Driver.SynchronizeWithAngular(false); 48 | var TurnOn_false = DriversCustomSettings.IsDriverSynchronizationWithAngular(driverContext.Driver); 49 | driverContext.Stop(); 50 | Assert.That(false, Is.EqualTo(Default_false)); 51 | Assert.That(true, Is.EqualTo(TurnOn_true)); 52 | Assert.That(false, Is.EqualTo(TurnOn_false)); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Ocaramba.UnitTests/Tests/FilesHelperTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using NUnit.Framework; 4 | using Ocaramba.Exceptions; 5 | using Ocaramba.Helpers; 6 | 7 | namespace Ocaramba.UnitTests.Tests 8 | { 9 | [TestFixture()] 10 | [TestFixture, Parallelizable(ParallelScope.Self)] 11 | public class FilesHelperTests 12 | { 13 | #if net8_0 14 | string folder = Directory.GetCurrentDirectory(); 15 | #endif 16 | 17 | #if net47 18 | string folder = TestContext.CurrentContext.TestDirectory; 19 | #endif 20 | [Test()] 21 | public void GetFilesOfGivenTypeFromAllSubFolderTest() 22 | { 23 | var files = FilesHelper.GetFilesOfGivenTypeFromAllSubFolders(folder, 24 | FileType.Xlsx); 25 | Assert.That(files.Count, Is.GreaterThan(0)); 26 | } 27 | 28 | [Test()] 29 | public void GetFilesOfGivenTypeFromAllSubFoldersTest() 30 | { 31 | var files = FilesHelper.GetFilesOfGivenTypeFromAllSubFolders(folder, 32 | FileType.Xml, "Driven"); 33 | Assert.That(files.Count, Is.GreaterThan(0)); 34 | } 35 | 36 | [Test()] 37 | public void GetAllFilesFromAllSubFoldersTest() 38 | { 39 | var files = FilesHelper.GetAllFilesFromAllSubFolders(folder); 40 | Assert.That(files.Count, Is.GreaterThan(0)); 41 | } 42 | 43 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] 44 | [Test()] 45 | public void GetAllFilesFromAllSubFoldersPrefixTest() 46 | { 47 | var files = FilesHelper.GetAllFilesFromAllSubFolders(folder, 48 | "*.dll"); 49 | Assert.That(files.Count, Is.GreaterThan(0)); 50 | File.Create(folder + FilesHelper.Separator + "testfile.txt"); 51 | 52 | } 53 | 54 | [Test()] 55 | public void RenameDeleteFileTest() 56 | { 57 | string path = Path.Combine(folder, "testfile1.txt"); 58 | File.Create(path).Close(); 59 | path = Path.Combine(folder, "testfile2.txt"); 60 | File.Create(path).Close(); 61 | FilesHelper.RenameFile(BaseConfiguration.ShortTimeout, "testfile1.txt", "testfile2.txt", 62 | folder); 63 | } 64 | 65 | [Test()] 66 | public void CopyDeleteFileTest() 67 | { 68 | string path = Path.Combine(folder, "testfile3.txt"); 69 | File.Create(path).Close(); 70 | path = Path.Combine(folder, "testfile4.txt"); 71 | File.Create(path).Close(); 72 | FilesHelper.CopyFile(BaseConfiguration.ShortTimeout, "testfile3.txt", "testfile4.txt", 73 | folder); 74 | } 75 | 76 | [Test()] 77 | public void WaitForFileOfGivenNameExceptionTest() 78 | { 79 | var start = DateTime.Now; 80 | Assert.Throws(() => FilesHelper.WaitForFileOfGivenName("nofile.txt", folder)); 81 | var stop = DateTime.Now; 82 | Assert.That(stop - start, Is.LessThanOrEqualTo(TimeSpan.FromSeconds(BaseConfiguration.LongTimeout + 2))); 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Ocaramba.UnitTests/Tests/JavaScriptAlertsTestsNUnit.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | using NUnit.Framework; 24 | using Ocaramba.Tests.PageObjects.PageObjects.TheInternet; 25 | 26 | namespace Ocaramba.UnitTests.Tests 27 | { 28 | [TestFixture] 29 | [Parallelizable(ParallelScope.Fixtures)] 30 | [Category("JavaScriptError")] 31 | [Ignore("Ignore a fixture due to https://github.com/SeleniumHQ/selenium/issues/7900")] 32 | public class JavaScriptAlertsTestsNUnit : ProjectTestBase 33 | { 34 | [Test] 35 | public void LogJavaScriptErrorTest() 36 | { 37 | var internetPage = new InternetPage(this.DriverContext).OpenHomePage(); 38 | internetPage.GoToJavaScriptOnLoad(); 39 | 40 | if (!this.DriverContext.LogJavaScriptErrors() && BaseConfiguration.TestBrowser == BrowserType.Chrome) 41 | { 42 | Assert.Fail("JavaScript errors were not found."); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Ocaramba.UnitTests/Tests/NameHelperTests.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NLog; 3 | using NUnit.Framework; 4 | using Ocaramba.Helpers; 5 | 6 | namespace Ocaramba.UnitTests.Tests 7 | { 8 | [TestFixture()] 9 | [TestFixture, Parallelizable(ParallelScope.Self)] 10 | public class NameHelperTests 11 | { 12 | #if net8_0 13 | string folder = Directory.GetCurrentDirectory(); 14 | #endif 15 | 16 | #if net47 17 | string folder = TestContext.CurrentContext.TestDirectory; 18 | #endif 19 | #if net47 20 | private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); 21 | #endif 22 | #if net8_0 23 | private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); 24 | #endif 25 | [Test()] 26 | public void ShortenFileNameTest() 27 | { 28 | var name = "verylongfilename3 4 5 6 7 8 9 0 1 2 3 4 1 2 31 2 3 4 5 6 7 8 9 0 1 2 3 4 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0.txt"; 29 | Logger.Debug("name:{0}",name); 30 | Assert.That((folder + name).Length, Is.GreaterThan(255)); 31 | var text = NameHelper.ShortenFileName(folder, name, " ", 255); 32 | Logger.Debug("text:{0}", text); 33 | Assert.That((folder + text).Length, Is.EqualTo(255)); 34 | } 35 | 36 | [Test()] 37 | public void RemoveSpecialCharactersTest() 38 | { 39 | var name = "name$%//4324 name ^//"; 40 | name = NameHelper.RemoveSpecialCharacters(name); 41 | Assert.That(name, Is.EqualTo("name4324name")); 42 | } 43 | 44 | } 45 | } -------------------------------------------------------------------------------- /Ocaramba.UnitTests/Tests/WaitHelperTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using Ocaramba.Exceptions; 4 | using Ocaramba.Helpers; 5 | 6 | namespace Ocaramba.UnitTests.Tests 7 | { 8 | [TestFixture()] 9 | [TestFixture, Parallelizable(ParallelScope.Self)] 10 | public class WaitHelperTests 11 | { 12 | [Test()] 13 | public void WaitTimeoutExceptionTest() 14 | { 15 | var start = DateTime.Now; 16 | int wait = 3; 17 | Assert.Throws(() => WaitHelper.Wait(() => SumNumber(1,1) > 3, TimeSpan.FromSeconds(wait), TimeSpan.FromSeconds(1), "Timeout")); 18 | var stop = DateTime.Now; 19 | Assert.That(stop - start, Is.GreaterThanOrEqualTo(TimeSpan.FromSeconds(wait))); 20 | Assert.That(stop - start, Is.Not.LessThan(TimeSpan.FromSeconds(wait))); 21 | } 22 | 23 | [Test()] 24 | public void WaitReturnFalseTest() 25 | { 26 | bool result = WaitHelper.Wait(() => SumNumber(1, 1) > 3, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(1)); 27 | Assert.That(result, Is.False); 28 | } 29 | 30 | [Test()] 31 | public void WaitReturnTrueTest() 32 | { 33 | bool result = WaitHelper.Wait(() => SumNumber(1, 1) > 1, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(1)); 34 | Assert.That(result, Is.True); 35 | } 36 | 37 | int SumNumber(int a, int b) 38 | { 39 | return a + b; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Ocaramba.UnitTests/appsettings.Linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "false", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "false", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false", 32 | "DataDrivenFile": "/DataDriven/DataDriven.xml", 33 | "DataDrivenFileCSV": "/DataDriven/TestDataCsv.csv", 34 | "DataDrivenFileXlsx": "/DataDriven/DataDriven.xlsx" 35 | }, 36 | 37 | "FirefoxPreferences": { 38 | }, 39 | "FirefoxExtensions": { 40 | }, 41 | "FirefoxArguments": { 42 | "-headless": "" 43 | }, 44 | "ChromePreferences": { 45 | }, 46 | "ChromeExtensions": { 47 | }, 48 | "DriverCapabilities": { 49 | }, 50 | "ChromeArguments": { 51 | "headless": "", 52 | "no-sandbox": "" 53 | }, 54 | "InternetExplorerPreferences": { 55 | } 56 | } -------------------------------------------------------------------------------- /Ocaramba.UnitTests/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "appSettings": { 3 | "protocol": "http", 4 | "host": "the-internet.herokuapp.com", 5 | "browser": "Chrome", 6 | "url": "", 7 | "PathToChromeDriverDirectory": "", 8 | "PathToFirefoxDriverDirectory": "", 9 | "PathToInternetExplorerDriverDirectory": "", 10 | "ChromeBrowserExecutableLocation": "", 11 | "FireFoxBrowserExecutableLocation": "", 12 | "FirefoxUseLegacyImplementation": "false", 13 | "PathToFirefoxProfile": "", 14 | "RemoteWebDriverHub": "http://localhost:4444/wd/hub", 15 | "DriverCapabilities": "Chrome", 16 | "longTimeout": "30", 17 | "mediumTimeout": "10", 18 | "shortTimeout": "3", 19 | "ImplicitlyWaitMilliseconds": "200", 20 | "username": "admin", 21 | "password": "admin", 22 | "UseCurrentDirectory": "true", 23 | "DownloadFolder": "TestOutput", 24 | "ScreenShotFolder": "TestOutput", 25 | "PageSourceFolder": "TestOutput", 26 | "FullDesktopScreenShotEnabled": "true", 27 | "SeleniumScreenShotEnabled": "true", 28 | "GetPageSourceEnabled": "true", 29 | "JavaScriptErrorLogging": "false", 30 | "JavaScriptErrorTypes": "SyntaxError,EvalError,ReferenceError,RangeError,TypeError,URIError,Refused to display,Internal Server Error,Cannot read property", 31 | "EnableEventFiringWebDriver": "false", 32 | "DataDrivenFile": "DataDriven\\DataDriven.xml", 33 | "DataDrivenFileXlsx": "DataDriven\\DataDriven.xlsx" 34 | }, 35 | 36 | "FirefoxPreferences": { 37 | }, 38 | "FirefoxExtensions": { 39 | }, 40 | "FirefoxArguments": { 41 | }, 42 | "ChromePreferences": { 43 | }, 44 | "ChromeExtensions": { 45 | }, 46 | "DriverCapabilities": { 47 | }, 48 | "ChromeArguments": { 49 | }, 50 | "InternetExplorerPreferences": { 51 | } 52 | } -------------------------------------------------------------------------------- /Ocaramba.UnitTests/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /OcarambaLite/BrowserType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba 24 | { 25 | /// 26 | /// Supported browsers. 27 | /// 28 | public enum BrowserType 29 | { 30 | /// 31 | /// Firefox browser 32 | /// 33 | Firefox, 34 | 35 | /// 36 | /// InternetExplorer browser 37 | /// 38 | InternetExplorer, 39 | 40 | /// 41 | /// InternetExplorer browser 42 | /// 43 | IE, 44 | 45 | /// 46 | /// Chrome browser 47 | /// 48 | Chrome, 49 | 50 | /// 51 | /// Safari browser 52 | /// 53 | Safari, 54 | 55 | /// 56 | /// Remote Web driver 57 | /// 58 | RemoteWebDriver, 59 | 60 | /// 61 | /// Edge driver 62 | /// 63 | Edge, 64 | 65 | /// 66 | /// Edge Chromium driver 67 | /// 68 | EdgeChromium, 69 | 70 | /// 71 | /// CloudProvider parallel cross browsers testing 72 | /// 73 | CloudProvider, 74 | 75 | /// 76 | /// Browser type to run test on Android with CloudProviders 77 | /// 78 | Android, 79 | 80 | /// 81 | /// Browser type to run test on Iphone with CloudProviders 82 | /// 83 | Iphone, 84 | 85 | /// 86 | /// Not supported browser 87 | /// 88 | None, 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /OcarambaLite/CustomCodeAnalysisRules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | teamcity 5 | publishArtifacts 6 | Moroni 7 | png 8 | fullscreen 9 | png 10 | EventFiringWebDriver 11 | Ocaramba 12 | Chromium 13 | 14 | 15 | -------------------------------------------------------------------------------- /OcarambaLite/DriverOptionsSetEventArgs.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba 24 | { 25 | using System; 26 | using OpenQA.Selenium; 27 | 28 | /// 29 | /// Before Capabilities Set Handler. More details on wiki. 30 | /// 31 | public class DriverOptionsSetEventArgs : EventArgs 32 | { 33 | /// 34 | /// Initializes a new instance of the class. 35 | /// 36 | /// The options. 37 | public DriverOptionsSetEventArgs(DriverOptions options) 38 | { 39 | this.DriverOptions = options; 40 | } 41 | 42 | /// 43 | /// Gets the current capabilities. 44 | /// 45 | public DriverOptions DriverOptions { get; } 46 | } 47 | } -------------------------------------------------------------------------------- /OcarambaLite/Helpers/DateHelper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Helpers 24 | { 25 | using System; 26 | using System.Globalization; 27 | 28 | /// 29 | /// Contains useful actions connected with dates. 30 | /// 31 | public static class DateHelper 32 | { 33 | /// 34 | /// Gets the tomorrow date. 35 | /// 36 | /// 37 | /// The tomorrow date. 38 | /// 39 | public static string TomorrowDate 40 | { 41 | get 42 | { 43 | return DateTime.Now.AddDays(1).ToString("ddMMyyyy", CultureInfo.CurrentCulture); 44 | } 45 | } 46 | 47 | /// 48 | /// Gets the current time stamp. 49 | /// 50 | /// 51 | /// The current time stamp. 52 | /// 53 | public static string CurrentTimeStamp 54 | { 55 | get 56 | { 57 | return DateTime.Now.ToString("ddMMyyyyHHmmss", CultureInfo.CurrentCulture); 58 | } 59 | } 60 | 61 | /// 62 | /// Gets the current date. 63 | /// 64 | /// 65 | /// The current date. 66 | /// 67 | public static string CurrentDate 68 | { 69 | get 70 | { 71 | return DateTime.Now.ToString("dd-MM-yyyy", CultureInfo.CurrentCulture); 72 | } 73 | } 74 | 75 | /// 76 | /// Gets the future date. 77 | /// 78 | /// The number days to add from current date. 79 | /// Date in future depends on parameter: numberDaysToAddToNow. 80 | public static string GetFutureDate(int numberDaysToAddToNow) 81 | { 82 | return DateTime.Now.AddDays(numberDaysToAddToNow).ToString("ddMMyyyy", CultureInfo.CurrentCulture); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /OcarambaLite/Locator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba 24 | { 25 | /// 26 | /// The page element locator type. Needs to be translated to automation framework specific locators. 27 | /// 28 | public enum Locator 29 | { 30 | /// 31 | /// The Id selector 32 | /// 33 | Id, 34 | 35 | /// 36 | /// The class name selector 37 | /// 38 | ClassName, 39 | 40 | /// 41 | /// The CSS selector 42 | /// 43 | CssSelector, 44 | 45 | /// 46 | /// The link text selector 47 | /// 48 | LinkText, 49 | 50 | /// 51 | /// The name selector 52 | /// 53 | Name, 54 | 55 | /// 56 | /// The partial link text selector 57 | /// 58 | PartialLinkText, 59 | 60 | /// 61 | /// The tag name selector 62 | /// 63 | TagName, 64 | 65 | /// 66 | /// The XPath selector 67 | /// 68 | XPath, 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /OcarambaLite/Types/AverageGroupedTimes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Types 24 | { 25 | /// 26 | /// AverageGroupedTimes class. 27 | /// 28 | public class AverageGroupedTimes 29 | { 30 | /// 31 | /// Gets or sets the name of the scenario. 32 | /// 33 | /// 34 | /// The name of the scenario. 35 | /// 36 | public string StepName { get; set; } 37 | 38 | /// 39 | /// Gets or sets the Driver. 40 | /// 41 | /// 42 | /// The Driver. 43 | /// 44 | public string Browser { get; set; } 45 | 46 | /// 47 | /// Gets or sets the average duration. 48 | /// 49 | /// 50 | /// The average duration. 51 | /// 52 | public double AverageDuration { get; set; } 53 | 54 | /// 55 | /// Gets or sets the average duration. 56 | /// 57 | /// 58 | /// The average duration. 59 | /// 60 | public long Percentile90 { get; set; } 61 | } 62 | } -------------------------------------------------------------------------------- /OcarambaLite/Types/ErrorDetail.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.Types 24 | { 25 | using System; 26 | 27 | using OpenQA.Selenium; 28 | 29 | /// 30 | /// Class that helps to define Kind and value for html elements. 31 | /// 32 | public class ErrorDetail 33 | { 34 | /// 35 | /// Initializes a new instance of the class. 36 | /// 37 | /// The screenshot. 38 | /// The date time. 39 | /// The exception. 40 | public ErrorDetail(Screenshot screenshot, DateTime dateTime, Exception exception) 41 | { 42 | this.Screenshot = screenshot; 43 | this.DateTime = dateTime; 44 | this.Exception = exception; 45 | } 46 | 47 | /// 48 | /// Gets or sets the screenshot. 49 | /// 50 | /// 51 | /// The screenshot. 52 | /// 53 | public Screenshot Screenshot { get; set; } 54 | 55 | /// 56 | /// Gets or sets the date time. 57 | /// 58 | /// 59 | /// The date time. 60 | /// 61 | public DateTime DateTime { get; set; } 62 | 63 | /// 64 | /// Gets or sets the exception. 65 | /// 66 | /// 67 | /// The exception. 68 | /// 69 | public Exception Exception { get; set; } 70 | } 71 | } -------------------------------------------------------------------------------- /OcarambaLite/WebElements/Checkbox.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.WebElements 24 | { 25 | using Ocaramba.Extensions; 26 | 27 | using OpenQA.Selenium; 28 | using OpenQA.Selenium.Remote; 29 | 30 | /// 31 | /// Contains methods for checkbox. 32 | /// 33 | public class Checkbox : WebElement 34 | { 35 | /// 36 | /// The web element. 37 | /// 38 | private readonly IWebElement webElement; 39 | 40 | /// 41 | /// Initializes a new instance of the class. 42 | /// 43 | /// The webElement. 44 | public Checkbox(IWebElement webElement) 45 | : base(webElement.ToDriver() as RemoteWebDriver, null) 46 | { 47 | this.webElement = webElement; 48 | } 49 | 50 | /// 51 | /// Set check box. 52 | /// 53 | public void TickCheckbox() 54 | { 55 | if (!this.webElement.Selected) 56 | { 57 | this.webElement.Click(); 58 | } 59 | } 60 | 61 | /// 62 | /// Clear the check box. 63 | /// 64 | public void UntickCheckbox() 65 | { 66 | if (this.webElement.Selected) 67 | { 68 | this.webElement.Click(); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /OcarambaLite/WebElements/JavaScriptAlert.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved. 3 | // 4 | // 5 | // The MIT License (MIT) 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | 23 | namespace Ocaramba.WebElements 24 | { 25 | using OpenQA.Selenium; 26 | 27 | /// 28 | /// Implementation for JavaScript Alert interface. 29 | /// 30 | public class JavaScriptAlert 31 | { 32 | /// 33 | /// The web driver. 34 | /// 35 | private readonly IWebDriver webDriver; 36 | 37 | /// 38 | /// Initializes a new instance of the class. 39 | /// 40 | /// The web driver. 41 | public JavaScriptAlert(IWebDriver webDriver) 42 | { 43 | this.webDriver = webDriver; 44 | } 45 | 46 | /// 47 | /// Gets java script popup text. 48 | /// 49 | public string JavaScriptText 50 | { 51 | get { return this.webDriver.SwitchTo().Alert().Text; } 52 | } 53 | 54 | /// 55 | /// Confirms the java script alert popup. 56 | /// 57 | public void ConfirmJavaScriptAlert() 58 | { 59 | this.webDriver.SwitchTo().Alert().Accept(); 60 | this.webDriver.SwitchTo().DefaultContent(); 61 | } 62 | 63 | /// 64 | /// Dismisses the java script alert popup. 65 | /// 66 | public void DismissJavaScriptAlert() 67 | { 68 | this.webDriver.SwitchTo().Alert().Dismiss(); 69 | this.webDriver.SwitchTo().DefaultContent(); 70 | } 71 | 72 | /// 73 | /// Method sends text to Java Script Alert. 74 | /// 75 | /// Text to be sent. 76 | public void SendTextToJavaScript(string text) 77 | { 78 | this.webDriver.SwitchTo().Alert().SendKeys(text); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /OcarambaLite/nlog.config: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | ocaramba_selenium_container: 4 | image: ocaramba/selenium 5 | build: 6 | context: . 7 | dockerfile: DockerfileBuild 8 | container_name: ocaramba_selenium 9 | stdin_open: true 10 | tty: true 11 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Accenture/Ocaramba/9899dd10368b16479399880efc5fee96aea25856/icon.png -------------------------------------------------------------------------------- /scripts/ExecutingTestsOnDockerGithubActions.ps1: -------------------------------------------------------------------------------- 1 | docker info 2 | 3 | docker ps -a 4 | docker exec -u root ocaramba_selenium bash -c "chmod -R 777 /Ocaramba" 5 | docker exec -u ocaramba ocaramba_selenium bash -c "ls ; sed -i '/Documentation/,+5 d' ./Ocaramba.sln ; sed -i '/CloudProviderCrossBrowser/,+5 d' ./Ocaramba.sln; dotnet build ./Ocaramba.sln" 6 | docker exec -u ocaramba ocaramba_selenium bash -c 'pwsh ./scripts/set_AppConfig_for_tests.ps1 "./Ocaramba.Tests.NUnit/bin/Debug/net8.0" "appsettings.Linux.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|/usr/local/bin/" -logValues -json' 7 | docker exec -u ocaramba ocaramba_selenium bash -c 'dotnet vstest ./Ocaramba.Tests.NUnit/bin/Debug/net8.0/Ocaramba.Tests.NUnit.dll /TestCaseFilter:"(TestCategory!=NotImplementedInCoreOrUploadDownload)" /Parallel --logger:trx;LogFileName=Ocaramba.Tests.Docker.trx' 8 | docker exec -u ocaramba ocaramba_selenium bash -c "ls /Ocaramba/TestResults/ ; cp /Ocaramba/TestResults/*.trx /tmp/Ocaramba.Tests.Docker.trx" 9 | docker cp ocaramba_selenium:/tmp/Ocaramba.Tests.Docker.trx . 10 | docker rm ocaramba_selenium --force 11 | 12 | if($lastexitcode -ne 0) 13 | { 14 | echo 'lastexitcode' $lastexitcode 15 | } 16 | 17 | exit 0 18 | -------------------------------------------------------------------------------- /scripts/ExecutingTestsOnLinuxAzure.ps1: -------------------------------------------------------------------------------- 1 | echo '********************************************Executing tests********************************************' 2 | 3 | echo '********************************************net8.0 tests********************************************' 4 | 5 | $Env:ASPNETCORE_ENVIRONMENT="Linux" 6 | 7 | echo $Env:ASPNETCORE_ENVIRONMENT 8 | 9 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnit\bin\Release\net8.0" "appsettings.Linux.json" "appSettings" "browser" "Chrome" -logValues -json 10 | 11 | dotnet vstest ./Ocaramba.Tests.NUnit/bin/Release/net8.0/Ocaramba.Tests.NUnit.dll /TestCaseFilter:"(TestCategory!=NotImplementedInCoreOrUploadDownload)" /Parallel --logger:"trx;LogFileName=Ocaramba.Tests.netcoreapp.xml" 12 | 13 | if($lastexitcode -ne 0) 14 | { 15 | echo 'lastexitcode' $lastexitcode 16 | } 17 | 18 | exit 0 19 | -------------------------------------------------------------------------------- /scripts/ExecutingTestsOnLinuxBrowserStackGithubActions.ps1: -------------------------------------------------------------------------------- 1 | echo '********************************************CloudProviderCrossBrowser tests********************************************' 2 | 3 | echo '********************************************BrowserStack tests********************************************' 4 | $Env:ASPNETCORE_ENVIRONMENT="Linux" 5 | 6 | echo $Env:ASPNETCORE_ENVIRONMENT 7 | 8 | $filePath = ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\browserstack.yml" 9 | 10 | $fileContent = Get-Content -Path $filePath 11 | 12 | $fileContent = $fileContent -replace "BROWSERSTACKUSER", "`$($env:MAPPED_ENV_BROWSERSTACKUSER)" 13 | $fileContent = $fileContent -replace "BROWSERSTACKKEY", "`$($env:MAPPED_ENV_BROWSERSTACKKEY)" 14 | 15 | # Write the updated content back to the file 16 | Set-Content -Path $filePath -Value $fileContent 17 | 18 | 19 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.Linux.json" "appSettings" "browser" "Chrome" -logValues -json 20 | 21 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.Linux.json" "appSettings" "RemoteWebDriverHub" "https://$($env:MAPPED_ENV_BROWSERSTACKUSER):$($env:MAPPED_ENV_BROWSERSTACKKEY)@hub-cloud.browserstack.com/wd/hub/" -logValues -json 22 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "appSettings" "RemoteWebDriverHub" "https://$($env:MAPPED_ENV_BROWSERSTACKUSER):$($env:MAPPED_ENV_BROWSERSTACKKEY)@hub-cloud.browserstack.com/wd/hub/" -logValues -json 23 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.Linux.json" "DriverCapabilities" "buildName" "Ocaramba.Tests.BrowserStackCrossBrowser$($env:BuildVersion)" -logValues -json 24 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "DriverCapabilities" "buildName" "Ocaramba.Tests.BrowserStackCrossBrowser$($env:BuildVersion)" -logValues -json 25 | dotnet vstest ./Ocaramba.Tests.CloudProviderCrossBrowser/bin/Release/net8.0/Ocaramba.Tests.CloudProviderCrossBrowser.dll /Logger:"trx;LogFileName=Ocaramba.Tests.BrowserStacknetcoreapp.xml" 26 | 27 | if($lastexitcode -ne 0) 28 | { 29 | echo 'lastexitcode' $lastexitcode 30 | } 31 | exit 0 32 | -------------------------------------------------------------------------------- /scripts/ExecutingTestsOnWindowsGithubActions1.ps1: -------------------------------------------------------------------------------- 1 | echo '********************************************Executing tests********************************************' 2 | 3 | echo '********************************************net8.0 tests********************************************' 4 | 5 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnit\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json 6 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.Angular\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json 7 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnitExtentReports\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json 8 | 9 | dotnet vstest .\Ocaramba.Tests.Angular\bin\Release\net8.0\Ocaramba.Tests.Angular.dll .\Ocaramba.Tests.NUnit\bin\Release\net8.0\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"(TestCategory!=TakingScreehShots)" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.netcoreapp.trx" 10 | 11 | echo '********************************************net472 tests********************************************' 12 | 13 | #.\scripts\set_AppConfig_for_tests.ps1 "D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Features\bin\Release\net472" "Ocaramba.Tests.Features.dll.config" "appsettings.json" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues 14 | 15 | #vstest.console.exe D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.Features\bin\Release\net472\Ocaramba.Tests.Features.dll /Logger:"trx;LogFileName=Ocaramba.Tests.Features.trx" 16 | if($lastexitcode -ne 0) 17 | { 18 | echo 'lastexitcode' $lastexitcode 19 | } 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /scripts/ExecutingTestsOnWindowsGithubActions2.ps1: -------------------------------------------------------------------------------- 1 | echo '********************************************Executing tests********************************************' 2 | 3 | echo '********************************************net8.0 tests********************************************' 4 | 5 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.Features\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json 6 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.Xunit\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json 7 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.MsTest\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json 8 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.UnitTests\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues -json 9 | 10 | dotnet vstest .\Ocaramba.Tests.Features\bin\Release\net8.0\Ocaramba.Tests.Features.dll .\Ocaramba.Tests.Xunit\bin\Release\net8.0\Ocaramba.Tests.Xunit.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.MsTest\bin\Release\net8.0\Ocaramba.Tests.MsTest.dll D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.UnitTests\bin\Release\net8.0\Ocaramba.UnitTests.dll /TestCaseFilter:"(TestCategory!=TakingScreehShots)" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.netcoreapp.xml" 11 | 12 | 13 | echo '********************************************EdgeChrominum tests********************************************' 14 | 15 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnit\bin\Release\net8.0" "appsettings.json" "appSettings" "browser|PathToEdgeChromiumDriverDirectory" "EdgeChromium|C:\SeleniumWebDrivers\EdgeDriver" -logValues -json 16 | 17 | 18 | dotnet vstest .\Ocaramba.Tests.NUnit\bin\Release\net8.0\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"(TestCategory=Grid)" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.EdgeChrominum.xml" 19 | 20 | if($lastexitcode -ne 0) 21 | { 22 | echo 'lastexitcode' $lastexitcode 23 | } 24 | 25 | exit 0 -------------------------------------------------------------------------------- /scripts/ExecutingTestsOnWindowsGithubActions3.ps1: -------------------------------------------------------------------------------- 1 | echo '********************************************Executing tests********************************************' 2 | 3 | echo '********************************************net472 tests*********************************************' 4 | 5 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.Angular\bin\Release\net472" "Ocaramba.Tests.Angular.dll.config" "//appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues 6 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnit\bin\Release\net472" "Ocaramba.Tests.NUnit.dll.config" "//appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues 7 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.UnitTests\bin\Release\net472" "Ocaramba.UnitTests.dll.config" "//appSettings" "browser|PathToChromeDriverDirectory" "Chrome|C:\SeleniumWebDrivers\ChromeDriver" -logValues 8 | 9 | 10 | dotnet vstest .\Ocaramba.Tests.Angular\bin\Release\net472\Ocaramba.Tests.Angular.dll .\Ocaramba.Tests.NUnit\bin\Release\net472\Ocaramba.Tests.NUnit.dll .\Ocaramba.UnitTests\bin\Release\net472\Ocaramba.UnitTests.dll /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.net4.xml" 11 | 12 | 13 | if($lastexitcode -ne 0) 14 | { 15 | echo 'lastexitcode' $lastexitcode 16 | } 17 | 18 | exit 0 19 | -------------------------------------------------------------------------------- /scripts/ExecutingTestsOnWindowsGithubActions4.ps1: -------------------------------------------------------------------------------- 1 | echo '********************************************CloudProviderCrossBrowser tests********************************************' 2 | 3 | echo '********************************************BrowserStack tests********************************************' 4 | $filePath = ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\browserstack.yml" 5 | 6 | $fileContent = Get-Content -Path $filePath 7 | 8 | $fileContent = $fileContent -replace "BROWSERSTACKUSER", "`$($env:MAPPED_ENV_BROWSERSTACKUSER)" 9 | $fileContent = $fileContent -replace "BROWSERSTACKKEY", "`$($env:MAPPED_ENV_BROWSERSTACKKEY)" 10 | 11 | # Write the updated content back to the file 12 | Set-Content -Path $filePath -Value $fileContent 13 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "appSettings" "RemoteWebDriverHub" "https://$($env:MAPPED_ENV_BROWSERSTACKUSER):$($env:MAPPED_ENV_BROWSERSTACKKEY)@hub-cloud.browserstack.com/wd/hub" -json 14 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "DriverCapabilities" "buildName" "Ocaramba.Tests.BrowserStackCrossBrowser$($env:BuildVersion)" -logValues -json 15 | 16 | dotnet vstest .\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\Ocaramba.Tests.CloudProviderCrossBrowser.dll /Logger:"trx;LogFileName=Ocaramba.Tests.BrowserStack.xml" 17 | 18 | if($lastexitcode -ne 0) 19 | { 20 | echo 'lastexitcode' $lastexitcode 21 | } 22 | 23 | exit 0 24 | -------------------------------------------------------------------------------- /scripts/ExecutingTestsOnWindowsGithubActions5.ps1: -------------------------------------------------------------------------------- 1 | echo '********************************************Downloading Selenium Grid********************************************' 2 | 3 | docker network create grid 4 | 5 | docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:latest 6 | docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub --shm-size="2g" -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 selenium/node-chrome:latest 7 | 8 | $Env:ASPNETCORE_ENVIRONMENT="Linux" 9 | 10 | echo $Env:ASPNETCORE_ENVIRONMENT 11 | 12 | echo '********************************************Run tests with Selenium Grid ****************************************' 13 | 14 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.NUnit\bin\Release\net8.0\" "appsettings.Linux.json" "appSettings" "browser|RemoteWebDriverHub" "RemoteWebDriver|http://localhost:4444/wd/hub" -json -logValues 15 | 16 | dotnet vstest .\Ocaramba.Tests.NUnit\bin\Release\net8.0\Ocaramba.Tests.NUnit.dll /TestCaseFilter:"TestCategory=Grid" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.NUnitGrid.xml" 17 | 18 | echo '*****************************Run CloudProviderCrossBrowser tests with Selenium Grid****************************' 19 | 20 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.Linux.json" "appSettings" "RemoteWebDriverHub" "http://localhost:4444/wd/hub" -json -logValues 21 | 22 | dotnet vstest .\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\Ocaramba.Tests.CloudProviderCrossBrowser.dll /TestCaseFilter:"FullyQualifiedName~Chrome" /Parallel /Logger:"trx;LogFileName=Ocaramba.Tests.CloudProviderCrossBrowserGrid.xml" 23 | 24 | if($lastexitcode -ne 0) 25 | { 26 | echo 'lastexitcode' $lastexitcode 27 | } 28 | 29 | exit 0 30 | -------------------------------------------------------------------------------- /scripts/ExecutingTestsOnWindowsGithubActions6.ps1: -------------------------------------------------------------------------------- 1 | echo '********************************************CloudProviderCrossBrowser tests********************************************' 2 | 3 | echo '********************************************saucelabs tests********************************************' 4 | 5 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "appSettings" "RemoteWebDriverHub" "https://$($env:MAPPED_ENV_SAUCELABSUSERNAME):$($env:MAPPED_ENV_SAUCELABSACCESSKEY)@ondemand.us-west-1.saucelabs.com:443/wd/hub" -json 6 | 7 | .\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0" "appsettings.json" "DriverCapabilities" "buildName" "Ocaramba.Tests.SauceLabsCrossBrowser$($env:BuildVersion)" -logValues -json 8 | 9 | dotnet vstest .\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net8.0\Ocaramba.Tests.CloudProviderCrossBrowser.dll /TestCaseFilter:"(FullyQualifiedName!~Iphone)&(FullyQualifiedName!~Android)&(FullyQualifiedName!~Samsung)" /Logger:"trx;LogFileName=Ocaramba.Tests.saucelabsnet8.xml" 10 | 11 | if($lastexitcode -ne 0) 12 | { 13 | echo 'lastexitcode' $lastexitcode 14 | } 15 | 16 | exit 0 17 | -------------------------------------------------------------------------------- /scripts/PublishingApiDocumentationOn_gh-pages.ps1: -------------------------------------------------------------------------------- 1 | echo '********************************************Copying files for gh-pages********************************************' 2 | 3 | Copy-Item -Path .\README.md -Destination .\Ocaramba.Documentation\Help\ -recurse -force -verbose 4 | 5 | New-Item .\Ocaramba.Documentation\Help\Ocaramba.Documentation\icons\ -Type Directory 6 | 7 | Copy-Item -Path .\Ocaramba.Documentation\icons\Objectivity_logo_avatar.png -Destination .\Ocaramba.Documentation\Help\Ocaramba.Documentation\icons\ -recurse -force -verbose 8 | 9 | Copy-Item -Path .\Ocaramba.Documentation\icons\Help.png -Destination .\Ocaramba.Documentation\Help\Ocaramba.Documentation\icons\ -recurse -force -verbose 10 | 11 | if ($env:APPVEYOR_REPO_TAG -eq "true") 12 | { 13 | echo '********************************************Cloning gh-pages branch********************************************' 14 | 15 | Invoke-Expression "git config --global credential.helper store" 16 | 17 | Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:GithubAuthToken):x-oauth-basic@github.com`n" 18 | 19 | Invoke-Expression "git config --global core.autocrlf true" 20 | 21 | Invoke-Expression "git config --global user.email 'TestAutomationGroup@objectivity.co.uk'" 22 | 23 | Invoke-Expression "git config --global user.name 'TestAutomationGroup'" 24 | 25 | Invoke-Expression "git clone https://github.com/ObjectivityLtd/Test.Automation.git --branch gh-pages .\Help" 26 | 27 | Remove-Item -recurse .\Help\* -exclude .git 28 | 29 | } else 30 | { 31 | 32 | New-Item -ItemType Directory -Force -Path .\Help 33 | 34 | } 35 | 36 | Copy-Item -Path .\Ocaramba.Documentation\Help\** -Destination .\Help\ -recurse -force 37 | 38 | if ($env:APPVEYOR_REPO_TAG -eq "true") 39 | { 40 | echo '********************************************Publishing new version of gh-pages********************************************' 41 | 42 | cd .\\Help 43 | 44 | Invoke-Expression "git add --all" 45 | 46 | Invoke-Expression "git commit -m 'Publishing to gh-pages $env:appveyor_build_version'" 47 | 48 | Invoke-Expression "git push origin gh-pages --porcelain" 49 | 50 | cd .. 51 | 52 | Remove-Item .\\Help\\.git -Force -Recurse -ErrorAction SilentlyContinue 53 | 54 | } 55 | 56 | 7z a gh-pages_$env:appveyor_build_version.zip .\\Help\\** 57 | 58 | appveyor PushArtifact gh-pages_$env:appveyor_build_version.zip -------------------------------------------------------------------------------- /scripts/removeSubprojectFromSolution.ps1: -------------------------------------------------------------------------------- 1 | echo "removing Documentation subprojects from .\Ocaramba.sln" 2 | echo $isWindows 3 | #if (-Not $isWindows) { 4 | echo "removing Documentation subprojects from .\Ocaramba.sln" 5 | (Get-Content '.\Ocaramba.sln' -raw) -replace [regex]('.*?' + 'Documentation' + ('.*?\n' * (5 + 1))) | set-content '.\Ocaramba.sln' 6 | # } 7 | --------------------------------------------------------------------------------