From af4005d7b54d1f312b85fb57e0dff4ffa7f87968 Mon Sep 17 00:00:00 2001 From: Sergey Ruzin Date: Fri, 3 Jun 2022 14:36:10 +0300 Subject: [PATCH 1/6] Separated selenium and playwright versions of the frameowrk. Added basic folders and browser launch methods to the playwright one --- .../Behavioral.Automation.Playwright.sln | 16 ++ .../Behavioral.Automation.Playwright.csproj | 24 +++ .../Services/BrowserRunner.cs | 17 ++ .../Services/ComplexBindingBuilder.cs | 148 ++++++++++++++++++ .../Services/IComplexBindingBuilder.cs | 18 +++ .../Services/IStepParametersProcessor.cs | 13 ++ .../Services/StringExtensions.cs | 114 ++++++++++++++ .../CHANGELOG.md | 4 +- Behavioral.Automation.Playwright/README.md | 1 + .../AutomationConfig.json | 0 .../Behavioral.Automation.DemoBindings.csproj | 2 +- .../Bindings/ElementTransformations.cs | 0 .../Bootstrapper.cs | 0 .../DemoTestServicesBuilder.cs | 0 .../Elements/WebElementWrapper.cs | 0 .../Services/UserInterfaceBuilder.cs | 0 ...Behavioral.Automation.DemoScenarios.csproj | 8 +- .../Features/ExampleBinding.feature | 0 .../Features/LabelBinding.feature | 0 .../Properties/AssemblyInfo.cs | 0 .../specflow.json | 0 .../.template.config/template.json | 0 .../AutomationConfig.json | 0 ...vioral.Automation.Template.Bindings.csproj | 0 .../ElementStorage/UserInterfaceBuilder.cs | 0 .../ElementWrappers/TextElementWrapper.cs | 0 .../ElementWrappers/WebElementWrapper.cs | 0 .../Hooks/Bootstrapper.cs | 0 .../Services/DemoTestServicesBuilder.cs | 0 .../ElementTransformations.cs | 0 ...ioral.Automation.Template.Scenarios.csproj | 0 .../Features/Examples.feature | 0 .../Properties/AssemblyInfo.cs | 0 .../specflow.json | 0 .../Behavioral.Automation.Template.sln | 0 .../Behavioral.Automation.nuspec | 0 .../Behavioral.Automation.Template}/readme.md | 0 .../AssertionBuilderTests.cs | 0 .../Behavioral.Automation.UnitTests.csproj | 0 .../Behavioral.Automation.sln | 6 +- .../Behavioral.Automation/.nuspec | 0 .../Abstractions/ITestRunnerWrapper.cs | 0 .../Behavioral.Automation.csproj | 0 .../Bindings/AttributeBinding.cs | 0 .../Authorization/BasicAuthBindings.cs | 0 .../Bindings/ClickBinding.cs | 0 .../Bindings/ControlScopeSelectionBinding.cs | 0 .../Bindings/DebugBinding.cs | 10 +- .../Bindings/DownloadsBinding.cs | 20 +-- .../Bindings/DropdownBinding.cs | 0 .../Bindings/ElementTransformations.cs | 8 +- .../Bindings/InputBinding.cs | 0 .../Bindings/LabelBinding.cs | 0 .../Bindings/ListBinding.cs | 0 .../Bindings/NavigationBInding.cs | 0 .../Bindings/PresenceBinding.cs | 8 +- .../Bindings/RedirectionBinding.cs | 16 +- .../Bindings/TableBinding.cs | 0 .../Elements/ElementExtensions.cs | 0 .../Elements/IDropdownWrapper.cs | 0 .../Elements/IElementCollectionWrapper.cs | 0 .../Elements/IGroupedDropdownWrapper.cs | 0 .../Elements/IListWrapper.cs | 0 .../Elements/IMultiSelectDropdownWrapper.cs | 0 .../Elements/ITableRowWrapper.cs | 0 .../Elements/ITableWrapper.cs | 0 .../Elements/ITextElementWrapper.cs | 0 .../Elements/ITooltipElementWrapper.cs | 0 .../Elements/IWebElementWrapper.cs | 0 .../Elements/StringRow.cs | 0 .../Abstractions/IAssertionAccessor.cs | 0 .../Abstractions/IAssertionBuilder.cs | 0 .../IAssertionBuilderWithBehaviour.cs | 0 .../IAssertionBuilderWithInversion.cs | 0 .../Abstractions/IAssertionContext.cs | 0 .../FluentAssertions/Assert.cs | 0 .../FluentAssertions/AssertionBuilder.cs | 0 .../FluentAssertions/AssertionObject.cs | 0 .../FluentAssertions/Assertions.cs | 0 ...IAssertionBuilderWithValidatedAssertion.cs | 0 .../BeforeStep/PageScopeObserverBinding.cs | 0 .../Model/AssertionBehavior.cs | 0 .../Model/AssertionType.cs | 0 .../Services/AutomationIDProvider.cs | 12 +- .../Services/BasicAuthConfig.cs | 0 .../Services/BrowserRunner.cs | 0 .../Services/ComplexBindingBuilder.cs | 0 .../Services/ConfigServiceBase.cs | 4 +- .../Services/DriverService.cs | 0 .../Services/ElementSelectionService.cs | 4 +- .../Services/FileService.cs | 12 +- .../Services/IAutomationIdProvider.cs | 12 +- .../Services/IBasicAuthConfig.cs | 0 .../Services/IComplexBindingBuilder.cs | 0 .../Services/IDriverService.cs | 0 .../Services/IElementSelectionService.cs | 8 +- .../Services/IStepParametersProcessor.cs | 0 .../Services/IUserInterfaceBuilder.cs | 4 +- .../IVirtualizedElementsSelectionService.cs | 0 .../Services/ListServices.cs | 0 .../LoadElementsFromCurrentViewCallback.cs | 0 .../Mapping/Contract/IControlScopeContext.cs | 0 .../Mapping/Contract/IScopeContext.cs | 0 .../Mapping/Contract/IScopeContextManager.cs | 0 .../Mapping/Contract/IScopeMappingPipe.cs | 0 .../Mapping/Contract/IScopeMarkupMapper.cs | 0 .../Contract/IScopeMarkupStorageContainer.cs | 0 .../Contract/IVirtualizedScopeContext.cs | 0 .../Services/Mapping/ControlDescription.cs | 16 +- .../Services/Mapping/ControlLocation.cs | 0 .../Services/Mapping/ControlMap.cs | 12 +- .../Services/Mapping/ControlReference.cs | 0 .../Services/Mapping/ControlScopeContext.cs | 0 .../Services/Mapping/ControlScopeId.cs | 0 .../Services/Mapping/ControlScopeOptions.cs | 0 .../Services/Mapping/ControlScopeSelector.cs | 0 .../Services/Mapping/HtmlTagMapper.cs | 0 .../Services/Mapping/IControlMap.cs | 0 .../Services/Mapping/IHtmlTagMapper.cs | 0 .../Services/Mapping/IMarkupStorage.cs | 0 .../Mapping/IMarkupStorageInitializer.cs | 0 .../Services/Mapping/IScopeContextRuntime.cs | 0 .../Services/Mapping/IUriToPageScopeMapper.cs | 0 .../Services/Mapping/MarkupStorage.cs | 0 .../Mapping/MultiMarkupStorageProxy.cs | 0 .../Mapping/PageMapping/PageScopeId.cs | 0 .../Services/Mapping/PageScopeContext.cs | 0 .../Services/Mapping/ScopeContextManager.cs | 0 .../Services/Mapping/ScopeContextRuntime.cs | 0 .../Services/Mapping/ScopeMappingPipe.cs | 0 .../Services/Mapping/ScopeMarkupMapper.cs | 22 +-- .../Mapping/ScopeMarkupStorageContainer.cs | 0 .../Services/Mapping/UriToPageScopeMapper.cs | 0 .../Mapping/VirtualizedControlScopeContext.cs | 0 .../Services/PrintValuesHelper.cs | 0 .../Services/RunnerService.cs | 0 .../Services/StepParametersProcessor.cs | 0 .../Services/StringExtensions.cs | 42 ++--- .../Services/UserInterfaceBuilderBase.cs | 4 +- .../VirtualizedElementsSelectionService.cs | 0 .../TestRunnerWrapper.cs | 0 .../TestServicesBuilder.cs | 4 +- Behavioral.Automation.Selenium/CHANGELOG.md | 9 ++ .../README.md | 0 144 files changed, 479 insertions(+), 119 deletions(-) create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.sln create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IComplexBindingBuilder.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IStepParametersProcessor.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/StringExtensions.cs rename CHANGELOG.md => Behavioral.Automation.Playwright/CHANGELOG.md (72%) create mode 100644 Behavioral.Automation.Playwright/README.md rename {Behavioral.Automation.DemoBindings => Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings}/AutomationConfig.json (100%) rename {Behavioral.Automation.DemoBindings => Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings}/Behavioral.Automation.DemoBindings.csproj (89%) rename {Behavioral.Automation.DemoBindings => Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings}/Bindings/ElementTransformations.cs (100%) rename {Behavioral.Automation.DemoBindings => Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings}/Bootstrapper.cs (100%) rename {Behavioral.Automation.DemoBindings => Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings}/DemoTestServicesBuilder.cs (100%) rename {Behavioral.Automation.DemoBindings => Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings}/Elements/WebElementWrapper.cs (100%) rename {Behavioral.Automation.DemoBindings => Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings}/Services/UserInterfaceBuilder.cs (100%) rename {Behavioral.Automation.DemoScenarios => Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios}/Behavioral.Automation.DemoScenarios.csproj (100%) rename {Behavioral.Automation.DemoScenarios => Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios}/Features/ExampleBinding.feature (100%) rename {Behavioral.Automation.DemoScenarios => Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios}/Features/LabelBinding.feature (100%) rename {Behavioral.Automation.DemoScenarios => Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios}/Properties/AssemblyInfo.cs (100%) rename {Behavioral.Automation.DemoScenarios => Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios}/specflow.json (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/.template.config/template.json (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Bindings/AutomationConfig.json (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Bindings/Behavioral.Automation.Template.Bindings.csproj (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Bindings/ElementStorage/UserInterfaceBuilder.cs (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Bindings/ElementWrappers/TextElementWrapper.cs (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Bindings/ElementWrappers/WebElementWrapper.cs (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Bindings/Hooks/Bootstrapper.cs (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Bindings/Services/DemoTestServicesBuilder.cs (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Bindings/StepArgumentTransformations/ElementTransformations.cs (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Scenarios/Behavioral.Automation.Template.Scenarios.csproj (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Scenarios/Features/Examples.feature (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Scenarios/Properties/AssemblyInfo.cs (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.Scenarios/specflow.json (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.Template.sln (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/Behavioral.Automation.nuspec (100%) rename {Behavioral.Automation.Template => Behavioral.Automation.Selenium/Behavioral.Automation.Template}/readme.md (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation.UnitTests/AssertionBuilderTests.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation.UnitTests/Behavioral.Automation.UnitTests.csproj (100%) rename Behavioral.Automation.sln => Behavioral.Automation.Selenium/Behavioral.Automation.sln (88%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/.nuspec (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Abstractions/ITestRunnerWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Behavioral.Automation.csproj (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/AttributeBinding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/Authorization/BasicAuthBindings.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/ClickBinding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/ControlScopeSelectionBinding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/DebugBinding.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/DownloadsBinding.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/DropdownBinding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/ElementTransformations.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/InputBinding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/LabelBinding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/ListBinding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/NavigationBInding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/PresenceBinding.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/RedirectionBinding.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Bindings/TableBinding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/ElementExtensions.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/IDropdownWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/IElementCollectionWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/IGroupedDropdownWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/IListWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/IMultiSelectDropdownWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/ITableRowWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/ITableWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/ITextElementWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/ITooltipElementWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/IWebElementWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Elements/StringRow.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionAccessor.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilder.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithBehaviour.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithInversion.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionContext.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/Assert.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/AssertionBuilder.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/AssertionObject.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/Assertions.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/FluentAssertions/IAssertionBuilderWithValidatedAssertion.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Hooks/BeforeStep/PageScopeObserverBinding.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Model/AssertionBehavior.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Model/AssertionType.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/AutomationIDProvider.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/BasicAuthConfig.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/BrowserRunner.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/ComplexBindingBuilder.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/ConfigServiceBase.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/DriverService.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/ElementSelectionService.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/FileService.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/IAutomationIdProvider.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/IBasicAuthConfig.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/IComplexBindingBuilder.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/IDriverService.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/IElementSelectionService.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/IStepParametersProcessor.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/IUserInterfaceBuilder.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/IVirtualizedElementsSelectionService.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/ListServices.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/LoadElementsFromCurrentViewCallback.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/Contract/IControlScopeContext.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/Contract/IScopeContext.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/Contract/IScopeContextManager.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/Contract/IScopeMappingPipe.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupMapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupStorageContainer.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/Contract/IVirtualizedScopeContext.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ControlDescription.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ControlLocation.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ControlMap.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ControlReference.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ControlScopeContext.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ControlScopeId.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ControlScopeOptions.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ControlScopeSelector.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/HtmlTagMapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/IControlMap.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/IHtmlTagMapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/IMarkupStorage.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/IMarkupStorageInitializer.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/IScopeContextRuntime.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/IUriToPageScopeMapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/MarkupStorage.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/MultiMarkupStorageProxy.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/PageMapping/PageScopeId.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/PageScopeContext.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ScopeContextManager.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ScopeContextRuntime.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ScopeMappingPipe.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ScopeMarkupMapper.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/ScopeMarkupStorageContainer.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/UriToPageScopeMapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/Mapping/VirtualizedControlScopeContext.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/PrintValuesHelper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/RunnerService.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/StepParametersProcessor.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/StringExtensions.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/UserInterfaceBuilderBase.cs (99%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/Services/VirtualizedElementsSelectionService.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/TestRunnerWrapper.cs (100%) rename {src => Behavioral.Automation.Selenium}/Behavioral.Automation/TestServicesBuilder.cs (99%) create mode 100644 Behavioral.Automation.Selenium/CHANGELOG.md rename README.md => Behavioral.Automation.Selenium/README.md (100%) diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.sln b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.sln new file mode 100644 index 00000000..bb8f4286 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Behavioral.Automation.Playwright", "Behavioral.Automation.Playwright\Behavioral.Automation.Playwright.csproj", "{99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj new file mode 100644 index 00000000..022c2fc3 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj @@ -0,0 +1,24 @@ + + + + net6.0 + enable + + false + + + + + + + + + + + + + + + + + diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs new file mode 100644 index 00000000..d1c20841 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs @@ -0,0 +1,17 @@ +using System.Threading.Tasks; +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.Services; + +public class BrowserRunner +{ + public async Task LaunchBrowser() + { + using var playwright = await Microsoft.Playwright.Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync(); + var page = await browser.NewPageAsync(); + await page.GotoAsync("https://playwright.dev/dotnet"); + + return page; + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder.cs new file mode 100644 index 00000000..f2f2cf2c --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder.cs @@ -0,0 +1,148 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using NUnit.Framework; +using TechTalk.SpecFlow; +using TechTalk.SpecFlow.Bindings; + +namespace Behavioral.Automation.Playwright.Services +{ + /// + /// Contains BuildAction methods which should be used to call other bindings inside the code (multiple clicks, value selections, etc.) + /// This way actions in called bindings will appear in test logs + /// + public class ComplexBindingBuilder : IComplexBindingBuilder + { + private readonly ITestRunner _runner; + private readonly IStepParametersProcessor _stepParametersProcessor; + private readonly ScenarioContext _scenarioContext; + + private readonly int _indentationSize = 4; + private int _indendationLevel = 1; + + public ComplexBindingBuilder( + ITestRunner runner, + IStepParametersProcessor stepParametersProcessor, + ScenarioContext scenarioContext) + { + _runner = runner; + _stepParametersProcessor = stepParametersProcessor; + _scenarioContext = scenarioContext; + } + + public void Indent() + { + _indendationLevel++; + } + + public void ReduceIndentation() + { + _indendationLevel--; + } + + public void BuildAction(Action method) + { + var attributes = method.GetMethodInfo().GetCustomAttributes(true); + BuildAction(Array.Empty(), attributes, method.GetMethodInfo().Name); + } + + public void BuildAction(Action method, params object[] pars) + { + var attributes = method.GetMethodInfo().GetCustomAttributes(true); + BuildAction(pars, attributes, method.GetMethodInfo().Name); + } + + public void BuildAction(Action method, params object[] pars) + { + var attributes = method.GetMethodInfo().GetCustomAttributes(true); + BuildAction(pars, attributes, method.GetMethodInfo().Name); + } + + public void BuildAction(Action method, params object[] pars) + { + var attributes = method.GetMethodInfo().GetCustomAttributes(true); + BuildAction(pars, attributes, method.GetMethodInfo().Name); + } + + public void BuildAction(Action method, params object[] pars) + { + var attributes = method.GetMethodInfo().GetCustomAttributes(true); + BuildAction(pars, attributes, method.GetMethodInfo().Name); + } + + private void BuildAction(object[] pars, IEnumerable attributes, string methodName) + { + var definitionType = GetStepDefinitionType().ToString(); + var attributeForCurrentStep = attributes.FirstOrDefault(a => a.GetType().Name.StartsWith(definitionType, StringComparison.OrdinalIgnoreCase)); + if (attributeForCurrentStep == null) + { + Assert.Inconclusive($"{definitionType} attribute is not provided for {methodName} binding method"); + } + + string stepExpression; + var table = pars.FirstOrDefault(d => d.GetType() == typeof(Table)); + if (table != null) + { + var parsList = pars.ToList(); + parsList.Remove(table); + stepExpression = _stepParametersProcessor.CreateStepExpression(attributeForCurrentStep.Regex, parsList.ToArray()); + RunAction(stepExpression, (Table)table); + } + else + { + stepExpression = _stepParametersProcessor.CreateStepExpression(attributeForCurrentStep.Regex, pars); + RunAction(stepExpression); + } + TestContext.WriteLine($"{new String(' ', _indendationLevel * _indentationSize)}{stepExpression}"); + } + + private void RunAction(string stepExpression) + { + switch (GetStepDefinitionType()) + { + case StepDefinitionType.Given: + _runner.Given(stepExpression); + break; + + case StepDefinitionType.When: + _runner.When(stepExpression); + break; + + case StepDefinitionType.Then: + _runner.Then(stepExpression); + break; + } + } + + private StepDefinitionType GetStepDefinitionType() + { + try + { + return _scenarioContext.StepContext.StepInfo.StepDefinitionType; + } + catch (NullReferenceException) + { + return StepDefinitionType.Given; + } + } + + private void RunAction(string stepExpression, Table table) + { + switch (_scenarioContext.StepContext.StepInfo.StepDefinitionType) + { + case StepDefinitionType.Given: + _runner.Given(stepExpression, null, table); + break; + + case StepDefinitionType.When: + _runner.When(stepExpression, null, table); + break; + + case StepDefinitionType.Then: + _runner.Then(stepExpression, null, table); + break; + } + } + } +} diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IComplexBindingBuilder.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IComplexBindingBuilder.cs new file mode 100644 index 00000000..5c6fcec9 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IComplexBindingBuilder.cs @@ -0,0 +1,18 @@ +using System; + +namespace Behavioral.Automation.Playwright.Services +{ + /// + /// This interface contain methods which are used to call other bindings inside test methods, so their actions appear in the logs + /// + public interface IComplexBindingBuilder + { + void BuildAction(Action method); + void BuildAction(Action method, params object[] pars); + void BuildAction(Action method, params object[] pars); + void BuildAction(Action method, params object[] pars); + void BuildAction(Action method, params object[] pars); + void Indent(); + void ReduceIndentation(); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IStepParametersProcessor.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IStepParametersProcessor.cs new file mode 100644 index 00000000..94536203 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IStepParametersProcessor.cs @@ -0,0 +1,13 @@ +using System.Text.RegularExpressions; + +namespace Behavioral.Automation.Playwright.Services +{ + /// + /// This interface contains methods which convert objects passed to ComplexBindingBuilder into step expression to use in Runner + /// + public interface IStepParametersProcessor + { + string CreateStepExpression(string pattern, params object[] arguments); + public bool TryParseStepExpressionArguments(Regex regex, string stepExpression, out string[] arguments); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/StringExtensions.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/StringExtensions.cs new file mode 100644 index 00000000..d3fd52be --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/StringExtensions.cs @@ -0,0 +1,114 @@ +using System; +using System.Text.RegularExpressions; + +namespace Behavioral.Automation.Playwright.Services +{ + /// + /// Perform various operations with strings + /// + public static class StringExtensions + { + /// + /// Parse values from the string in the given format + /// + /// String to parse + /// Parsing format + /// Parsed values + public static string[] ParseExact( + this string data, + string format) + { + return ParseExact(data, format, false); + } + + /// + /// Parse values from the string in the given format with option to ignore case + /// + /// String to parse + /// Parsing format + /// Ignore case option + /// Parsed values + public static string[] ParseExact( + this string data, + string format, + bool ignoreCase) + { + string[] values; + + if (TryParseExact(data, format, out values, ignoreCase)) + return values; + else + throw new ArgumentException("Format not compatible with value."); + } + + /// + /// Try to parse values from string + /// + /// String to be parsed + /// Parsing format + /// Values to store parsed data + /// True if parsing was successful or false otherwise + public static bool TryExtract( + this string data, + string format, + out string[] values) + { + return TryParseExact(data, format, out values, false); + } + + /// + /// Try to parse values from string with option to ignore case + /// + /// String to be parsed + /// Parsing format + /// Values to store parsed data + /// Ignore case option + /// True if parsing was successful or false otherwise + public static bool TryParseExact( + this string data, + string format, + out string[] values, + bool ignoreCase) + { + int tokenCount = 0; + format = Regex.Escape(format).Replace("\\{", "{"); + + for (tokenCount = 0; ; tokenCount++) + { + string token = string.Format("{{{0}}}", tokenCount); + if (!format.Contains(token)) break; + format = format.Replace(token, + string.Format("(?'group{0}'.*)", tokenCount)); + } + + RegexOptions options = + ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None; + + Match match = new Regex(format, options).Match(data); + + if (tokenCount != (match.Groups.Count - 1)) + { + values = new string[] { }; + return false; + } + else + { + values = new string[tokenCount]; + for (int index = 0; index < tokenCount; index++) + values[index] = + match.Groups[string.Format("group{0}", index)].Value; + return true; + } + } + + /// + /// Convert string into int + /// + /// String to get number from + /// int converted from string + public static int ParseNumberFromString(string s) + { + return int.Parse(Regex.Match(s, @"\d+").Value); + } + } +} diff --git a/CHANGELOG.md b/Behavioral.Automation.Playwright/CHANGELOG.md similarity index 72% rename from CHANGELOG.md rename to Behavioral.Automation.Playwright/CHANGELOG.md index 1cf9a0df..5a832889 100644 --- a/CHANGELOG.md +++ b/Behavioral.Automation.Playwright/CHANGELOG.md @@ -4,6 +4,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -[1.11.0] - 2022-05-20 +[0.1] - 2022-06-03 ### Added -- Added Assert.ShouldBecome() with ability to pass error message as a function \ No newline at end of file +- Added basic folder structure and browser launch methods for Playwright framework \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/README.md b/Behavioral.Automation.Playwright/README.md new file mode 100644 index 00000000..2fd9f957 --- /dev/null +++ b/Behavioral.Automation.Playwright/README.md @@ -0,0 +1 @@ +TBD \ No newline at end of file diff --git a/Behavioral.Automation.DemoBindings/AutomationConfig.json b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/AutomationConfig.json similarity index 100% rename from Behavioral.Automation.DemoBindings/AutomationConfig.json rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/AutomationConfig.json diff --git a/Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj similarity index 89% rename from Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj index ed66ce1d..b51bddcf 100644 --- a/Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj +++ b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj @@ -15,7 +15,7 @@ - + diff --git a/Behavioral.Automation.DemoBindings/Bindings/ElementTransformations.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Bindings/ElementTransformations.cs similarity index 100% rename from Behavioral.Automation.DemoBindings/Bindings/ElementTransformations.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Bindings/ElementTransformations.cs diff --git a/Behavioral.Automation.DemoBindings/Bootstrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Bootstrapper.cs similarity index 100% rename from Behavioral.Automation.DemoBindings/Bootstrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Bootstrapper.cs diff --git a/Behavioral.Automation.DemoBindings/DemoTestServicesBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/DemoTestServicesBuilder.cs similarity index 100% rename from Behavioral.Automation.DemoBindings/DemoTestServicesBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/DemoTestServicesBuilder.cs diff --git a/Behavioral.Automation.DemoBindings/Elements/WebElementWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Elements/WebElementWrapper.cs similarity index 100% rename from Behavioral.Automation.DemoBindings/Elements/WebElementWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Elements/WebElementWrapper.cs diff --git a/Behavioral.Automation.DemoBindings/Services/UserInterfaceBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Services/UserInterfaceBuilder.cs similarity index 100% rename from Behavioral.Automation.DemoBindings/Services/UserInterfaceBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Services/UserInterfaceBuilder.cs diff --git a/Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj similarity index 100% rename from Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj index b22fa4eb..788d9982 100644 --- a/Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj +++ b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj @@ -17,10 +17,6 @@ - - - - Always @@ -32,4 +28,8 @@ + + + + \ No newline at end of file diff --git a/Behavioral.Automation.DemoScenarios/Features/ExampleBinding.feature b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Features/ExampleBinding.feature similarity index 100% rename from Behavioral.Automation.DemoScenarios/Features/ExampleBinding.feature rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Features/ExampleBinding.feature diff --git a/Behavioral.Automation.DemoScenarios/Features/LabelBinding.feature b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Features/LabelBinding.feature similarity index 100% rename from Behavioral.Automation.DemoScenarios/Features/LabelBinding.feature rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Features/LabelBinding.feature diff --git a/Behavioral.Automation.DemoScenarios/Properties/AssemblyInfo.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Properties/AssemblyInfo.cs similarity index 100% rename from Behavioral.Automation.DemoScenarios/Properties/AssemblyInfo.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Properties/AssemblyInfo.cs diff --git a/Behavioral.Automation.DemoScenarios/specflow.json b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/specflow.json similarity index 100% rename from Behavioral.Automation.DemoScenarios/specflow.json rename to Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/specflow.json diff --git a/Behavioral.Automation.Template/.template.config/template.json b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/.template.config/template.json similarity index 100% rename from Behavioral.Automation.Template/.template.config/template.json rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/.template.config/template.json diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/AutomationConfig.json b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/AutomationConfig.json similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/AutomationConfig.json rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/AutomationConfig.json diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Behavioral.Automation.Template.Bindings.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Behavioral.Automation.Template.Bindings.csproj similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Behavioral.Automation.Template.Bindings.csproj rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Behavioral.Automation.Template.Bindings.csproj diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementStorage/UserInterfaceBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementStorage/UserInterfaceBuilder.cs similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementStorage/UserInterfaceBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementStorage/UserInterfaceBuilder.cs diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementWrappers/TextElementWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementWrappers/TextElementWrapper.cs similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementWrappers/TextElementWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementWrappers/TextElementWrapper.cs diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementWrappers/WebElementWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementWrappers/WebElementWrapper.cs similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementWrappers/WebElementWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/ElementWrappers/WebElementWrapper.cs diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Hooks/Bootstrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Hooks/Bootstrapper.cs similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Hooks/Bootstrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Hooks/Bootstrapper.cs diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Services/DemoTestServicesBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Services/DemoTestServicesBuilder.cs similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Services/DemoTestServicesBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/Services/DemoTestServicesBuilder.cs diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/StepArgumentTransformations/ElementTransformations.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/StepArgumentTransformations/ElementTransformations.cs similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/StepArgumentTransformations/ElementTransformations.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Bindings/StepArgumentTransformations/ElementTransformations.cs diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Behavioral.Automation.Template.Scenarios.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Behavioral.Automation.Template.Scenarios.csproj similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Behavioral.Automation.Template.Scenarios.csproj rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Behavioral.Automation.Template.Scenarios.csproj diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Features/Examples.feature b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Features/Examples.feature similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Features/Examples.feature rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Features/Examples.feature diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Properties/AssemblyInfo.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Properties/AssemblyInfo.cs similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Properties/AssemblyInfo.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/Properties/AssemblyInfo.cs diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/specflow.json b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/specflow.json similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/specflow.json rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.Scenarios/specflow.json diff --git a/Behavioral.Automation.Template/Behavioral.Automation.Template.sln b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.sln similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.Template.sln rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.Template.sln diff --git a/Behavioral.Automation.Template/Behavioral.Automation.nuspec b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.nuspec similarity index 100% rename from Behavioral.Automation.Template/Behavioral.Automation.nuspec rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/Behavioral.Automation.nuspec diff --git a/Behavioral.Automation.Template/readme.md b/Behavioral.Automation.Selenium/Behavioral.Automation.Template/readme.md similarity index 100% rename from Behavioral.Automation.Template/readme.md rename to Behavioral.Automation.Selenium/Behavioral.Automation.Template/readme.md diff --git a/src/Behavioral.Automation.UnitTests/AssertionBuilderTests.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.UnitTests/AssertionBuilderTests.cs similarity index 100% rename from src/Behavioral.Automation.UnitTests/AssertionBuilderTests.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation.UnitTests/AssertionBuilderTests.cs diff --git a/src/Behavioral.Automation.UnitTests/Behavioral.Automation.UnitTests.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation.UnitTests/Behavioral.Automation.UnitTests.csproj similarity index 100% rename from src/Behavioral.Automation.UnitTests/Behavioral.Automation.UnitTests.csproj rename to Behavioral.Automation.Selenium/Behavioral.Automation.UnitTests/Behavioral.Automation.UnitTests.csproj diff --git a/Behavioral.Automation.sln b/Behavioral.Automation.Selenium/Behavioral.Automation.sln similarity index 88% rename from Behavioral.Automation.sln rename to Behavioral.Automation.Selenium/Behavioral.Automation.sln index 5b8fa910..3716a07e 100644 --- a/Behavioral.Automation.sln +++ b/Behavioral.Automation.Selenium/Behavioral.Automation.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29728.190 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation", "src\Behavioral.Automation\Behavioral.Automation.csproj", "{F618BBEA-613A-4A67-A76E-3BEDD43B7175}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation", "Behavioral.Automation\Behavioral.Automation.csproj", "{F618BBEA-613A-4A67-A76E-3BEDD43B7175}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation.UnitTests", "src\Behavioral.Automation.UnitTests\Behavioral.Automation.UnitTests.csproj", "{054B7FBC-190D-43FA-B6D6-13A2BA7CB92D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation.UnitTests", "Behavioral.Automation.UnitTests\Behavioral.Automation.UnitTests.csproj", "{054B7FBC-190D-43FA-B6D6-13A2BA7CB92D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{BB7AC02C-03FD-4F17-B4A9-CDECC1A63DA5}" EndProject @@ -12,7 +12,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation.DemoS EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation.DemoBindings", "Behavioral.Automation.DemoBindings\Behavioral.Automation.DemoBindings.csproj", "{4DD5E62E-E447-419D-82BF-C918F08091BD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp", "src\BlazorApp\BlazorApp.csproj", "{E9DD80F4-5499-4BEA-A385-D77F162AC5C5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorApp", "..\src\BlazorApp\BlazorApp.csproj", "{E9DD80F4-5499-4BEA-A385-D77F162AC5C5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Behavioral.Automation/.nuspec b/Behavioral.Automation.Selenium/Behavioral.Automation/.nuspec similarity index 100% rename from src/Behavioral.Automation/.nuspec rename to Behavioral.Automation.Selenium/Behavioral.Automation/.nuspec diff --git a/src/Behavioral.Automation/Abstractions/ITestRunnerWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Abstractions/ITestRunnerWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Abstractions/ITestRunnerWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Abstractions/ITestRunnerWrapper.cs diff --git a/src/Behavioral.Automation/Behavioral.Automation.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj similarity index 100% rename from src/Behavioral.Automation/Behavioral.Automation.csproj rename to Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj diff --git a/src/Behavioral.Automation/Bindings/AttributeBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/AttributeBinding.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/AttributeBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/AttributeBinding.cs diff --git a/src/Behavioral.Automation/Bindings/Authorization/BasicAuthBindings.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/Authorization/BasicAuthBindings.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/Authorization/BasicAuthBindings.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/Authorization/BasicAuthBindings.cs diff --git a/src/Behavioral.Automation/Bindings/ClickBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/ClickBinding.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/ClickBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/ClickBinding.cs diff --git a/src/Behavioral.Automation/Bindings/ControlScopeSelectionBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/ControlScopeSelectionBinding.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/ControlScopeSelectionBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/ControlScopeSelectionBinding.cs diff --git a/src/Behavioral.Automation/Bindings/DebugBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/DebugBinding.cs similarity index 99% rename from src/Behavioral.Automation/Bindings/DebugBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/DebugBinding.cs index aeae8697..4f7009a2 100644 --- a/src/Behavioral.Automation/Bindings/DebugBinding.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/DebugBinding.cs @@ -6,8 +6,8 @@ namespace Behavioral.Automation.Bindings { - /// - /// Bindings for debug + /// + /// Bindings for debug /// [Binding] public sealed class DebugBinding @@ -31,9 +31,9 @@ public void Wait() Thread.Sleep(5000); } - /// - /// Stop test execution for given amount of seconds - /// + /// + /// Stop test execution for given amount of seconds + /// /// Number of seconds /// Then wait 5 sec [Given("wait (.*) sec")] diff --git a/src/Behavioral.Automation/Bindings/DownloadsBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/DownloadsBinding.cs similarity index 99% rename from src/Behavioral.Automation/Bindings/DownloadsBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/DownloadsBinding.cs index f62151a8..c2c47974 100644 --- a/src/Behavioral.Automation/Bindings/DownloadsBinding.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/DownloadsBinding.cs @@ -8,15 +8,15 @@ namespace Behavioral.Automation.Bindings { - /// - /// Bindings for testing of the downloaded files + /// + /// Bindings for testing of the downloaded files /// [Binding] public sealed class DownloadsBinding { - /// - /// Check that file was downloaded - /// + /// + /// Check that file was downloaded + /// /// Name of the tested file /// Then "Test.pdf" file should be downloaded [Then("\"(.*?)\" file should be downloaded")] @@ -30,11 +30,11 @@ public void CheckFileDownloaded(string filename) } - /// - /// Check Excel file data - /// - /// Name of the tested file - /// Assertion behavior (instant or continuous) + /// + /// Check Excel file data + /// + /// Name of the tested file + /// Assertion behavior (instant or continuous) /// Specflow table which stores excel table rows /// /// Then "Test.xsls" file should contain the following data: diff --git a/src/Behavioral.Automation/Bindings/DropdownBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/DropdownBinding.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/DropdownBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/DropdownBinding.cs diff --git a/src/Behavioral.Automation/Bindings/ElementTransformations.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/ElementTransformations.cs similarity index 99% rename from src/Behavioral.Automation/Bindings/ElementTransformations.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/ElementTransformations.cs index 5cb25da5..9c568939 100644 --- a/src/Behavioral.Automation/Bindings/ElementTransformations.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/ElementTransformations.cs @@ -7,8 +7,8 @@ namespace Behavioral.Automation.Bindings { - /// - /// Methods to transform steps' arguments + /// + /// Methods to transform steps' arguments /// [Binding] public class ElementTransformations @@ -26,8 +26,8 @@ public ElementTransformations( /// /// Convert strings "be/is/have/become/be not/is not/ not have/become not" into AssertionBehavior object - /// - /// String with the verb which is received from Specflow steps + /// + /// String with the verb which is received from Specflow steps /// [StepArgumentTransformation, NotNull] public AssertionBehavior ParseBehavior(string verb) diff --git a/src/Behavioral.Automation/Bindings/InputBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/InputBinding.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/InputBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/InputBinding.cs diff --git a/src/Behavioral.Automation/Bindings/LabelBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/LabelBinding.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/LabelBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/LabelBinding.cs diff --git a/src/Behavioral.Automation/Bindings/ListBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/ListBinding.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/ListBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/ListBinding.cs diff --git a/src/Behavioral.Automation/Bindings/NavigationBInding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/NavigationBInding.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/NavigationBInding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/NavigationBInding.cs diff --git a/src/Behavioral.Automation/Bindings/PresenceBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/PresenceBinding.cs similarity index 99% rename from src/Behavioral.Automation/Bindings/PresenceBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/PresenceBinding.cs index 081eabd2..748baeac 100644 --- a/src/Behavioral.Automation/Bindings/PresenceBinding.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/PresenceBinding.cs @@ -61,10 +61,10 @@ private void CheckControlTypeCollectionVisibility( } - /// - /// Check that single web element is displayed - /// - /// Tested web element wrapper + /// + /// Check that single web element is displayed + /// + /// Tested web element wrapper /// Assertion behavior (instant or continuous) /// Then "Test" input should become visible [Given("(.*?) (is|is not|become|become not) visible")] diff --git a/src/Behavioral.Automation/Bindings/RedirectionBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/RedirectionBinding.cs similarity index 99% rename from src/Behavioral.Automation/Bindings/RedirectionBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/RedirectionBinding.cs index 63bf3e2d..4f64ecd1 100644 --- a/src/Behavioral.Automation/Bindings/RedirectionBinding.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/RedirectionBinding.cs @@ -8,8 +8,8 @@ namespace Behavioral.Automation.Bindings { - /// - /// Bindings for scopes and windows interaction + /// + /// Bindings for scopes and windows interaction /// [Binding] public sealed class RedirectionBinding @@ -29,9 +29,9 @@ public RedirectionBinding([NotNull] IScopeContextManager scopeContextManager, _WindowsHandleSwitched = false; } - /// - /// Switch elements' scope manually - /// + /// + /// Switch elements' scope manually + /// /// [Given("user is redirected to (.*) page")] [Then("user should be redirected to (.*) page")] @@ -47,9 +47,9 @@ public void CheckRedirect([NotNull] string pageName) _scopeContextManager.SwitchPage(pageName); } - /// - /// Switch scope to another page - /// + /// + /// Switch scope to another page + /// /// Name of the page to switch scope /// When user sees opened window Test page [Given("user sees opened window (.*) page")] diff --git a/src/Behavioral.Automation/Bindings/TableBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/TableBinding.cs similarity index 100% rename from src/Behavioral.Automation/Bindings/TableBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Bindings/TableBinding.cs diff --git a/src/Behavioral.Automation/Elements/ElementExtensions.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ElementExtensions.cs similarity index 100% rename from src/Behavioral.Automation/Elements/ElementExtensions.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ElementExtensions.cs diff --git a/src/Behavioral.Automation/Elements/IDropdownWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IDropdownWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/IDropdownWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IDropdownWrapper.cs diff --git a/src/Behavioral.Automation/Elements/IElementCollectionWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IElementCollectionWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/IElementCollectionWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IElementCollectionWrapper.cs diff --git a/src/Behavioral.Automation/Elements/IGroupedDropdownWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IGroupedDropdownWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/IGroupedDropdownWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IGroupedDropdownWrapper.cs diff --git a/src/Behavioral.Automation/Elements/IListWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IListWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/IListWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IListWrapper.cs diff --git a/src/Behavioral.Automation/Elements/IMultiSelectDropdownWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IMultiSelectDropdownWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/IMultiSelectDropdownWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IMultiSelectDropdownWrapper.cs diff --git a/src/Behavioral.Automation/Elements/ITableRowWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ITableRowWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/ITableRowWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ITableRowWrapper.cs diff --git a/src/Behavioral.Automation/Elements/ITableWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ITableWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/ITableWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ITableWrapper.cs diff --git a/src/Behavioral.Automation/Elements/ITextElementWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ITextElementWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/ITextElementWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ITextElementWrapper.cs diff --git a/src/Behavioral.Automation/Elements/ITooltipElementWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ITooltipElementWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/ITooltipElementWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/ITooltipElementWrapper.cs diff --git a/src/Behavioral.Automation/Elements/IWebElementWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IWebElementWrapper.cs similarity index 100% rename from src/Behavioral.Automation/Elements/IWebElementWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/IWebElementWrapper.cs diff --git a/src/Behavioral.Automation/Elements/StringRow.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Elements/StringRow.cs similarity index 100% rename from src/Behavioral.Automation/Elements/StringRow.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Elements/StringRow.cs diff --git a/src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionAccessor.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionAccessor.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionAccessor.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionAccessor.cs diff --git a/src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilder.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilder.cs diff --git a/src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithBehaviour.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithBehaviour.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithBehaviour.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithBehaviour.cs diff --git a/src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithInversion.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithInversion.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithInversion.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionBuilderWithInversion.cs diff --git a/src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionContext.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionContext.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionContext.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Abstractions/IAssertionContext.cs diff --git a/src/Behavioral.Automation/FluentAssertions/Assert.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Assert.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/Assert.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Assert.cs diff --git a/src/Behavioral.Automation/FluentAssertions/AssertionBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/AssertionBuilder.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/AssertionBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/AssertionBuilder.cs diff --git a/src/Behavioral.Automation/FluentAssertions/AssertionObject.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/AssertionObject.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/AssertionObject.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/AssertionObject.cs diff --git a/src/Behavioral.Automation/FluentAssertions/Assertions.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Assertions.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/Assertions.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/Assertions.cs diff --git a/src/Behavioral.Automation/FluentAssertions/IAssertionBuilderWithValidatedAssertion.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/IAssertionBuilderWithValidatedAssertion.cs similarity index 100% rename from src/Behavioral.Automation/FluentAssertions/IAssertionBuilderWithValidatedAssertion.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/FluentAssertions/IAssertionBuilderWithValidatedAssertion.cs diff --git a/src/Behavioral.Automation/Hooks/BeforeStep/PageScopeObserverBinding.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Hooks/BeforeStep/PageScopeObserverBinding.cs similarity index 100% rename from src/Behavioral.Automation/Hooks/BeforeStep/PageScopeObserverBinding.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Hooks/BeforeStep/PageScopeObserverBinding.cs diff --git a/src/Behavioral.Automation/Model/AssertionBehavior.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Model/AssertionBehavior.cs similarity index 100% rename from src/Behavioral.Automation/Model/AssertionBehavior.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Model/AssertionBehavior.cs diff --git a/src/Behavioral.Automation/Model/AssertionType.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Model/AssertionType.cs similarity index 100% rename from src/Behavioral.Automation/Model/AssertionType.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Model/AssertionType.cs diff --git a/src/Behavioral.Automation/Services/AutomationIDProvider.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/AutomationIDProvider.cs similarity index 99% rename from src/Behavioral.Automation/Services/AutomationIDProvider.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/AutomationIDProvider.cs index f3a7b75c..23cbd74a 100644 --- a/src/Behavioral.Automation/Services/AutomationIDProvider.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/AutomationIDProvider.cs @@ -3,8 +3,8 @@ namespace Behavioral.Automation.Services { - /// - /// Contains method used to get control description + /// + /// Contains method used to get control description /// [UsedImplicitly] public sealed class AutomationIdProvider : IAutomationIdProvider @@ -17,10 +17,10 @@ public AutomationIdProvider([NotNull] IScopeContextRuntime scopeContextRuntime) } - /// - /// Get control description by element caption - /// - /// Caption of the tested element + /// + /// Get control description by element caption + /// + /// Caption of the tested element /// Element control description containing its name, type, id and subpath public ControlDescription Get(string caption) { diff --git a/src/Behavioral.Automation/Services/BasicAuthConfig.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/BasicAuthConfig.cs similarity index 100% rename from src/Behavioral.Automation/Services/BasicAuthConfig.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/BasicAuthConfig.cs diff --git a/src/Behavioral.Automation/Services/BrowserRunner.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/BrowserRunner.cs similarity index 100% rename from src/Behavioral.Automation/Services/BrowserRunner.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/BrowserRunner.cs diff --git a/src/Behavioral.Automation/Services/ComplexBindingBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/ComplexBindingBuilder.cs similarity index 100% rename from src/Behavioral.Automation/Services/ComplexBindingBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/ComplexBindingBuilder.cs diff --git a/src/Behavioral.Automation/Services/ConfigServiceBase.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/ConfigServiceBase.cs similarity index 99% rename from src/Behavioral.Automation/Services/ConfigServiceBase.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/ConfigServiceBase.cs index 5c835973..f7a05202 100644 --- a/src/Behavioral.Automation/Services/ConfigServiceBase.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/ConfigServiceBase.cs @@ -4,8 +4,8 @@ namespace Behavioral.Automation.Services { - /// - /// Access config properties + /// + /// Access config properties /// [UsedImplicitly] public static class ConfigServiceBase diff --git a/src/Behavioral.Automation/Services/DriverService.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/DriverService.cs similarity index 100% rename from src/Behavioral.Automation/Services/DriverService.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/DriverService.cs diff --git a/src/Behavioral.Automation/Services/ElementSelectionService.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/ElementSelectionService.cs similarity index 99% rename from src/Behavioral.Automation/Services/ElementSelectionService.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/ElementSelectionService.cs index dc365095..88587acb 100644 --- a/src/Behavioral.Automation/Services/ElementSelectionService.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/ElementSelectionService.cs @@ -5,8 +5,8 @@ namespace Behavioral.Automation.Services { - /// - /// Method for caption to element conversion + /// + /// Method for caption to element conversion /// [UsedImplicitly] public sealed class ElementSelectionService : IElementSelectionService diff --git a/src/Behavioral.Automation/Services/FileService.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/FileService.cs similarity index 99% rename from src/Behavioral.Automation/Services/FileService.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/FileService.cs index 1486e4dc..b1ca0d6c 100644 --- a/src/Behavioral.Automation/Services/FileService.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/FileService.cs @@ -5,15 +5,15 @@ namespace Behavioral.Automation.Services { - /// - /// Methods to interact with downloaded files + /// + /// Methods to interact with downloaded files /// public static class FileService { - /// - /// Convert Excel file into DataSet object - /// - /// Path to Excel file + /// + /// Convert Excel file into DataSet object + /// + /// Path to Excel file /// DataSet object public static DataSet GetExcelFileAsDataSet(string filePath) { diff --git a/src/Behavioral.Automation/Services/IAutomationIdProvider.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IAutomationIdProvider.cs similarity index 99% rename from src/Behavioral.Automation/Services/IAutomationIdProvider.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/IAutomationIdProvider.cs index eec15413..3cabcf30 100644 --- a/src/Behavioral.Automation/Services/IAutomationIdProvider.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IAutomationIdProvider.cs @@ -3,15 +3,15 @@ namespace Behavioral.Automation.Services { - /// - /// Interface for AutomationIdProvider class + /// + /// Interface for AutomationIdProvider class /// public interface IAutomationIdProvider { - /// - /// Get control description by element caption - /// - /// Element caption + /// + /// Get control description by element caption + /// + /// Element caption /// [NotNull] ControlDescription Get([NotNull] string caption); diff --git a/src/Behavioral.Automation/Services/IBasicAuthConfig.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IBasicAuthConfig.cs similarity index 100% rename from src/Behavioral.Automation/Services/IBasicAuthConfig.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/IBasicAuthConfig.cs diff --git a/src/Behavioral.Automation/Services/IComplexBindingBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IComplexBindingBuilder.cs similarity index 100% rename from src/Behavioral.Automation/Services/IComplexBindingBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/IComplexBindingBuilder.cs diff --git a/src/Behavioral.Automation/Services/IDriverService.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IDriverService.cs similarity index 100% rename from src/Behavioral.Automation/Services/IDriverService.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/IDriverService.cs diff --git a/src/Behavioral.Automation/Services/IElementSelectionService.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IElementSelectionService.cs similarity index 99% rename from src/Behavioral.Automation/Services/IElementSelectionService.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/IElementSelectionService.cs index d886fb19..d53a8578 100644 --- a/src/Behavioral.Automation/Services/IElementSelectionService.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IElementSelectionService.cs @@ -6,10 +6,10 @@ namespace Behavioral.Automation.Services { public interface IElementSelectionService { - /// - /// Find web element by caption - /// - /// + /// + /// Find web element by caption + /// + /// /// [CanBeNull] IWebElement Find([NotNull] string caption); diff --git a/src/Behavioral.Automation/Services/IStepParametersProcessor.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IStepParametersProcessor.cs similarity index 100% rename from src/Behavioral.Automation/Services/IStepParametersProcessor.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/IStepParametersProcessor.cs diff --git a/src/Behavioral.Automation/Services/IUserInterfaceBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IUserInterfaceBuilder.cs similarity index 99% rename from src/Behavioral.Automation/Services/IUserInterfaceBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/IUserInterfaceBuilder.cs index 3d3f1786..62ebbdc6 100644 --- a/src/Behavioral.Automation/Services/IUserInterfaceBuilder.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IUserInterfaceBuilder.cs @@ -1,7 +1,7 @@ namespace Behavioral.Automation.Services { - /// - /// Interface for UserInterfaceBuilder classes + /// + /// Interface for UserInterfaceBuilder classes /// public interface IUserInterfaceBuilder { diff --git a/src/Behavioral.Automation/Services/IVirtualizedElementsSelectionService.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/IVirtualizedElementsSelectionService.cs similarity index 100% rename from src/Behavioral.Automation/Services/IVirtualizedElementsSelectionService.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/IVirtualizedElementsSelectionService.cs diff --git a/src/Behavioral.Automation/Services/ListServices.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/ListServices.cs similarity index 100% rename from src/Behavioral.Automation/Services/ListServices.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/ListServices.cs diff --git a/src/Behavioral.Automation/Services/LoadElementsFromCurrentViewCallback.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/LoadElementsFromCurrentViewCallback.cs similarity index 100% rename from src/Behavioral.Automation/Services/LoadElementsFromCurrentViewCallback.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/LoadElementsFromCurrentViewCallback.cs diff --git a/src/Behavioral.Automation/Services/Mapping/Contract/IControlScopeContext.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IControlScopeContext.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/Contract/IControlScopeContext.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IControlScopeContext.cs diff --git a/src/Behavioral.Automation/Services/Mapping/Contract/IScopeContext.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeContext.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/Contract/IScopeContext.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeContext.cs diff --git a/src/Behavioral.Automation/Services/Mapping/Contract/IScopeContextManager.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeContextManager.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/Contract/IScopeContextManager.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeContextManager.cs diff --git a/src/Behavioral.Automation/Services/Mapping/Contract/IScopeMappingPipe.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeMappingPipe.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/Contract/IScopeMappingPipe.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeMappingPipe.cs diff --git a/src/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupMapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupMapper.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupMapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupMapper.cs diff --git a/src/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupStorageContainer.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupStorageContainer.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupStorageContainer.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IScopeMarkupStorageContainer.cs diff --git a/src/Behavioral.Automation/Services/Mapping/Contract/IVirtualizedScopeContext.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IVirtualizedScopeContext.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/Contract/IVirtualizedScopeContext.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/Contract/IVirtualizedScopeContext.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ControlDescription.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlDescription.cs similarity index 99% rename from src/Behavioral.Automation/Services/Mapping/ControlDescription.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlDescription.cs index 03515dcc..d815bf83 100644 --- a/src/Behavioral.Automation/Services/Mapping/ControlDescription.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlDescription.cs @@ -2,8 +2,8 @@ namespace Behavioral.Automation.Services.Mapping { - /// - /// This class contains fields for control description + /// + /// This class contains fields for control description /// public sealed class ControlDescription { @@ -17,18 +17,18 @@ public ControlDescription( Subpath = subpath; } - /// - /// Control search attribute value + /// + /// Control search attribute value /// public string Id { get; } - /// - /// Control caption to be used in step + /// + /// Control caption to be used in step /// public string Caption { get; } - /// - /// Control xpath (optional) + /// + /// Control xpath (optional) /// public string Subpath { get; } } diff --git a/src/Behavioral.Automation/Services/Mapping/ControlLocation.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlLocation.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ControlLocation.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlLocation.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ControlMap.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlMap.cs similarity index 99% rename from src/Behavioral.Automation/Services/Mapping/ControlMap.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlMap.cs index 7c3fb21e..56da9592 100644 --- a/src/Behavioral.Automation/Services/Mapping/ControlMap.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlMap.cs @@ -1,7 +1,7 @@ namespace Behavioral.Automation.Services.Mapping { - /// - /// This class is used to map control to control storage + /// + /// This class is used to map control to control storage /// public class ControlMap : IControlMap { @@ -25,10 +25,10 @@ public ControlMap( _subpath = subpath; } - /// - /// Add control to the storage - /// - /// Control caption + /// + /// Add control to the storage + /// + /// Control caption /// public IHtmlTagMapper As(string caption) { diff --git a/src/Behavioral.Automation/Services/Mapping/ControlReference.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlReference.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ControlReference.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlReference.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ControlScopeContext.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlScopeContext.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ControlScopeContext.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlScopeContext.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ControlScopeId.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlScopeId.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ControlScopeId.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlScopeId.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ControlScopeOptions.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlScopeOptions.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ControlScopeOptions.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlScopeOptions.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ControlScopeSelector.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlScopeSelector.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ControlScopeSelector.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ControlScopeSelector.cs diff --git a/src/Behavioral.Automation/Services/Mapping/HtmlTagMapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/HtmlTagMapper.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/HtmlTagMapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/HtmlTagMapper.cs diff --git a/src/Behavioral.Automation/Services/Mapping/IControlMap.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IControlMap.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/IControlMap.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IControlMap.cs diff --git a/src/Behavioral.Automation/Services/Mapping/IHtmlTagMapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IHtmlTagMapper.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/IHtmlTagMapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IHtmlTagMapper.cs diff --git a/src/Behavioral.Automation/Services/Mapping/IMarkupStorage.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IMarkupStorage.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/IMarkupStorage.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IMarkupStorage.cs diff --git a/src/Behavioral.Automation/Services/Mapping/IMarkupStorageInitializer.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IMarkupStorageInitializer.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/IMarkupStorageInitializer.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IMarkupStorageInitializer.cs diff --git a/src/Behavioral.Automation/Services/Mapping/IScopeContextRuntime.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IScopeContextRuntime.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/IScopeContextRuntime.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IScopeContextRuntime.cs diff --git a/src/Behavioral.Automation/Services/Mapping/IUriToPageScopeMapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IUriToPageScopeMapper.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/IUriToPageScopeMapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/IUriToPageScopeMapper.cs diff --git a/src/Behavioral.Automation/Services/Mapping/MarkupStorage.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/MarkupStorage.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/MarkupStorage.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/MarkupStorage.cs diff --git a/src/Behavioral.Automation/Services/Mapping/MultiMarkupStorageProxy.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/MultiMarkupStorageProxy.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/MultiMarkupStorageProxy.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/MultiMarkupStorageProxy.cs diff --git a/src/Behavioral.Automation/Services/Mapping/PageMapping/PageScopeId.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/PageMapping/PageScopeId.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/PageMapping/PageScopeId.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/PageMapping/PageScopeId.cs diff --git a/src/Behavioral.Automation/Services/Mapping/PageScopeContext.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/PageScopeContext.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/PageScopeContext.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/PageScopeContext.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ScopeContextManager.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeContextManager.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ScopeContextManager.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeContextManager.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ScopeContextRuntime.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeContextRuntime.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ScopeContextRuntime.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeContextRuntime.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ScopeMappingPipe.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeMappingPipe.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ScopeMappingPipe.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeMappingPipe.cs diff --git a/src/Behavioral.Automation/Services/Mapping/ScopeMarkupMapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeMarkupMapper.cs similarity index 99% rename from src/Behavioral.Automation/Services/Mapping/ScopeMarkupMapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeMarkupMapper.cs index 42763242..131e8009 100644 --- a/src/Behavioral.Automation/Services/Mapping/ScopeMarkupMapper.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeMarkupMapper.cs @@ -3,8 +3,8 @@ namespace Behavioral.Automation.Services.Mapping { - /// - /// Creates pipes that are responsible for controls' definitions in specific scopes + /// + /// Creates pipes that are responsible for controls' definitions in specific scopes /// public class ScopeMarkupMapper : IScopeMarkupMapper { @@ -15,10 +15,10 @@ public ScopeMarkupMapper(IScopeMarkupStorageContainer container) _container = container; } - /// - /// Get existing or create new mapping pipe for page scope - /// - /// Page scope ID + /// + /// Get existing or create new mapping pipe for page scope + /// + /// Page scope ID /// Page scope mapping pipe public IScopeMappingPipe GetOrCreateMappingPipe(PageScopeId scopeId) { @@ -26,9 +26,9 @@ public IScopeMappingPipe GetOrCreateMappingPipe(PageScopeId scopeId) return new ScopeMappingPipe(markupStorage); } - /// - /// Gets global scope mapping pipe (controls, defined in global scope are visible on all pages) - /// + /// + /// Gets global scope mapping pipe (controls, defined in global scope are visible on all pages) + /// /// Global scope mapping pipe public IScopeMappingPipe GetGlobalMappingPipe() { @@ -38,8 +38,8 @@ public IScopeMappingPipe GetGlobalMappingPipe() /// /// Get existing or create new mapping pipe for multiple pages (controls that are visible on multiple pages, but not on every one) - /// - /// Page scopes IDs array + /// + /// Page scopes IDs array /// Page scope mapping pipe public IScopeMappingPipe GetOrCreateMappingPipe(params PageScopeId[] scopeIds) { diff --git a/src/Behavioral.Automation/Services/Mapping/ScopeMarkupStorageContainer.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeMarkupStorageContainer.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/ScopeMarkupStorageContainer.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/ScopeMarkupStorageContainer.cs diff --git a/src/Behavioral.Automation/Services/Mapping/UriToPageScopeMapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/UriToPageScopeMapper.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/UriToPageScopeMapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/UriToPageScopeMapper.cs diff --git a/src/Behavioral.Automation/Services/Mapping/VirtualizedControlScopeContext.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/VirtualizedControlScopeContext.cs similarity index 100% rename from src/Behavioral.Automation/Services/Mapping/VirtualizedControlScopeContext.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/Mapping/VirtualizedControlScopeContext.cs diff --git a/src/Behavioral.Automation/Services/PrintValuesHelper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/PrintValuesHelper.cs similarity index 100% rename from src/Behavioral.Automation/Services/PrintValuesHelper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/PrintValuesHelper.cs diff --git a/src/Behavioral.Automation/Services/RunnerService.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/RunnerService.cs similarity index 100% rename from src/Behavioral.Automation/Services/RunnerService.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/RunnerService.cs diff --git a/src/Behavioral.Automation/Services/StepParametersProcessor.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/StepParametersProcessor.cs similarity index 100% rename from src/Behavioral.Automation/Services/StepParametersProcessor.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/StepParametersProcessor.cs diff --git a/src/Behavioral.Automation/Services/StringExtensions.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/StringExtensions.cs similarity index 99% rename from src/Behavioral.Automation/Services/StringExtensions.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/StringExtensions.cs index 15ea2046..e2370ceb 100644 --- a/src/Behavioral.Automation/Services/StringExtensions.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/StringExtensions.cs @@ -4,16 +4,16 @@ namespace Behavioral.Automation.Services { - /// - /// Perform various operations with strings + /// + /// Perform various operations with strings /// public static class StringExtensions { - /// - /// Parse values from the string in the given format - /// - /// String to parse - /// Parsing format + /// + /// Parse values from the string in the given format + /// + /// String to parse + /// Parsing format /// Parsed values public static string[] ParseExact( this string data, @@ -22,12 +22,12 @@ public static string[] ParseExact( return ParseExact(data, format, false); } - /// - /// Parse values from the string in the given format with option to ignore case - /// - /// String to parse - /// Parsing format - /// Ignore case option + /// + /// Parse values from the string in the given format with option to ignore case + /// + /// String to parse + /// Parsing format + /// Ignore case option /// Parsed values public static string[] ParseExact( this string data, @@ -102,20 +102,20 @@ public static bool TryParseExact( } } - /// - /// Convert string into int - /// - /// String to get number from + /// + /// Convert string into int + /// + /// String to get number from /// int converted from string public static int ParseNumberFromString(string s) { return int.Parse(Regex.Match(s, @"\d+").Value); } - /// - /// Get text or value of the web element - /// - /// Tested element + /// + /// Get text or value of the web element + /// + /// Tested element /// String with element's text or value public static string GetElementTextOrValue(IWebElementWrapper element) { diff --git a/src/Behavioral.Automation/Services/UserInterfaceBuilderBase.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/UserInterfaceBuilderBase.cs similarity index 99% rename from src/Behavioral.Automation/Services/UserInterfaceBuilderBase.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/UserInterfaceBuilderBase.cs index ac7770ff..91242bc9 100644 --- a/src/Behavioral.Automation/Services/UserInterfaceBuilderBase.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/UserInterfaceBuilderBase.cs @@ -3,8 +3,8 @@ namespace Behavioral.Automation.Services { - /// - /// Elements' captions and locators are stored here + /// + /// Elements' captions and locators are stored here /// [UsedImplicitly] public abstract class UserInterfaceBuilderBase : IUserInterfaceBuilder diff --git a/src/Behavioral.Automation/Services/VirtualizedElementsSelectionService.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/Services/VirtualizedElementsSelectionService.cs similarity index 100% rename from src/Behavioral.Automation/Services/VirtualizedElementsSelectionService.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/Services/VirtualizedElementsSelectionService.cs diff --git a/src/Behavioral.Automation/TestRunnerWrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/TestRunnerWrapper.cs similarity index 100% rename from src/Behavioral.Automation/TestRunnerWrapper.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/TestRunnerWrapper.cs diff --git a/src/Behavioral.Automation/TestServicesBuilder.cs b/Behavioral.Automation.Selenium/Behavioral.Automation/TestServicesBuilder.cs similarity index 99% rename from src/Behavioral.Automation/TestServicesBuilder.cs rename to Behavioral.Automation.Selenium/Behavioral.Automation/TestServicesBuilder.cs index 7383c482..bd365095 100644 --- a/src/Behavioral.Automation/TestServicesBuilder.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/TestServicesBuilder.cs @@ -5,8 +5,8 @@ namespace Behavioral.Automation { - /// - /// Initialise all necessary objects before test execution + /// + /// Initialise all necessary objects before test execution /// public sealed class TestServicesBuilder { diff --git a/Behavioral.Automation.Selenium/CHANGELOG.md b/Behavioral.Automation.Selenium/CHANGELOG.md new file mode 100644 index 00000000..42748bd9 --- /dev/null +++ b/Behavioral.Automation.Selenium/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +[1.12.0] - 2022-06-03 +### Added +- Changed folder structure to separate Selenium and Playwright versions of the framework \ No newline at end of file diff --git a/README.md b/Behavioral.Automation.Selenium/README.md similarity index 100% rename from README.md rename to Behavioral.Automation.Selenium/README.md From d653ee00a6504df88d6767f39d3f8ba57373f2ce Mon Sep 17 00:00:00 2001 From: Sergey Ruzin Date: Mon, 6 Jun 2022 17:08:15 +0300 Subject: [PATCH 2/6] Changed pipeline paths. Removed playwright solution. Changed target framework to net 6.0 --- .github/workflows/Autotests.yaml | 4 +- .github/workflows/main.yaml | 6 +- .../Behavioral.Automation.Playwright.csproj | 0 .../Behavioral.Automation.Playwright.sln | 16 ----- .../Services/BrowserRunner.cs | 17 ------ .../Services/BrowserRunner.cs | 17 ++++++ .../Services/ComplexBindingBuilder.cs | 0 .../Services/IComplexBindingBuilder.cs | 0 .../Services/IStepParametersProcessor.cs | 0 .../Services/StringExtensions.cs | 0 .../Behavioral.Automation.DemoBindings.csproj | 3 +- .../Behavioral.Automation.UnitTests.csproj | 2 +- .../Behavioral.Automation.csproj | 2 +- Behavioral.Automation.sln | 59 +++++++++++++++++++ 14 files changed, 85 insertions(+), 41 deletions(-) rename Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/{Behavioral.Automation.Playwright => }/Behavioral.Automation.Playwright.csproj (100%) delete mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.sln delete mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs rename Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/{Behavioral.Automation.Playwright => }/Services/ComplexBindingBuilder.cs (100%) rename Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/{Behavioral.Automation.Playwright => }/Services/IComplexBindingBuilder.cs (100%) rename Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/{Behavioral.Automation.Playwright => }/Services/IStepParametersProcessor.cs (100%) rename Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/{Behavioral.Automation.Playwright => }/Services/StringExtensions.cs (100%) create mode 100644 Behavioral.Automation.sln diff --git a/.github/workflows/Autotests.yaml b/.github/workflows/Autotests.yaml index c3144f75..d3c47225 100644 --- a/.github/workflows/Autotests.yaml +++ b/.github/workflows/Autotests.yaml @@ -22,8 +22,8 @@ jobs: - name: Restore dependencies run: dotnet restore - name: Build - working-directory: ./Behavioral.Automation.DemoScenarios + working-directory: ./Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios run: dotnet build -c Release --no-restore - name: Test - working-directory: ./Behavioral.Automation.DemoScenarios + working-directory: ./Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios run: dotnet test -c Release --no-build --verbosity normal diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3603f55d..da21b6d0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -28,12 +28,12 @@ jobs: run: dotnet build -c Release --no-restore - name: Get version run: | - export VER=$(grep -oP '\d+\.\d+\.\d+(?=)' src/Behavioral.Automation/Behavioral.Automation.csproj) + export VER=$(grep -oP '\d+\.\d+\.\d+(?=)' /Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj) echo "VER=$VER" >> $GITHUB_ENV echo $VER - name: Package app run: | - dotnet pack ./src/Behavioral.Automation/Behavioral.Automation.csproj \ + dotnet pack ./Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj \ --configuration Release /p:Platform=\"AnyCPU\" \ /p:PackageVersion=${{ env.VER }} --output ./ - name: Create Release @@ -41,7 +41,7 @@ jobs: with: tag: ${{ env.VER }} artifacts: "Behavioral.Automation.${{ env.VER }}.nupkg" - bodyFile: "CHANGELOG.md" + bodyFile: "Behavioral.Automation.Selenium/CHANGELOG.md" token: ${{ secrets.GITHUB_TOKEN }} - name: Publish app into nuget.org env: diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj similarity index 100% rename from Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj rename to Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.sln b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.sln deleted file mode 100644 index bb8f4286..00000000 --- a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.sln +++ /dev/null @@ -1,16 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Behavioral.Automation.Playwright", "Behavioral.Automation.Playwright\Behavioral.Automation.Playwright.csproj", "{99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {99F7423D-E6FB-48D7-9C7F-D8402D7DD4E1}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs deleted file mode 100644 index d1c20841..00000000 --- a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.Playwright; - -namespace Behavioral.Automation.Playwright.Services; - -public class BrowserRunner -{ - public async Task LaunchBrowser() - { - using var playwright = await Microsoft.Playwright.Playwright.CreateAsync(); - await using var browser = await playwright.Chromium.LaunchAsync(); - var page = await browser.NewPageAsync(); - await page.GotoAsync("https://playwright.dev/dotnet"); - - return page; - } -} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs new file mode 100644 index 00000000..39076d2b --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/BrowserRunner.cs @@ -0,0 +1,17 @@ +using System.Threading.Tasks; +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.Services; + +public class BrowserRunner + { + public async Task LaunchBrowser() + { + using var playwright = await Microsoft.Playwright.Playwright.CreateAsync(); + await using var browser = await playwright.Chromium.LaunchAsync(); + var page = await browser.NewPageAsync(); + await page.GotoAsync("https://playwright.dev/dotnet"); + + return page; + } + } \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder.cs similarity index 100% rename from Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder.cs rename to Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder.cs diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IComplexBindingBuilder.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IComplexBindingBuilder.cs similarity index 100% rename from Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IComplexBindingBuilder.cs rename to Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IComplexBindingBuilder.cs diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IStepParametersProcessor.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IStepParametersProcessor.cs similarity index 100% rename from Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IStepParametersProcessor.cs rename to Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/IStepParametersProcessor.cs diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/StringExtensions.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/StringExtensions.cs similarity index 100% rename from Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/StringExtensions.cs rename to Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/StringExtensions.cs diff --git a/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj index b51bddcf..17797381 100644 --- a/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj +++ b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Behavioral.Automation.DemoBindings.csproj @@ -1,11 +1,12 @@  - netcoreapp3.1 + net6.0 false Quantori Inc. Demo project that can be used as example of test configuration. https://github.com/quantori/Behavioral.Automation + 10 diff --git a/Behavioral.Automation.Selenium/Behavioral.Automation.UnitTests/Behavioral.Automation.UnitTests.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation.UnitTests/Behavioral.Automation.UnitTests.csproj index 45f4de01..08eaf2db 100644 --- a/Behavioral.Automation.Selenium/Behavioral.Automation.UnitTests/Behavioral.Automation.UnitTests.csproj +++ b/Behavioral.Automation.Selenium/Behavioral.Automation.UnitTests/Behavioral.Automation.UnitTests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net6.0 false diff --git a/Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj index 54843412..f2053ec9 100644 --- a/Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net5.0;net6.0 + net6.0 true Quantori Inc. Platform design is based on strong and well-defined borderline between procedural test cases structure and object-oriented code-behind. diff --git a/Behavioral.Automation.sln b/Behavioral.Automation.sln new file mode 100644 index 00000000..7cc01611 --- /dev/null +++ b/Behavioral.Automation.sln @@ -0,0 +1,59 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29728.190 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation", "Behavioral.Automation.Selenium\Behavioral.Automation\Behavioral.Automation.csproj", "{F618BBEA-613A-4A67-A76E-3BEDD43B7175}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation.UnitTests", "Behavioral.Automation.Selenium\Behavioral.Automation.UnitTests\Behavioral.Automation.UnitTests.csproj", "{054B7FBC-190D-43FA-B6D6-13A2BA7CB92D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Behavioral.Automation.Selenium\Tests", "{BB7AC02C-03FD-4F17-B4A9-CDECC1A63DA5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation.DemoScenarios", "Behavioral.Automation.Selenium\Behavioral.Automation.DemoScenarios\Behavioral.Automation.DemoScenarios.csproj", "{C7AF5750-75A5-4E8D-80FA-FB54914B0B17}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Behavioral.Automation.DemoBindings", "Behavioral.Automation.Selenium\Behavioral.Automation.DemoBindings\Behavioral.Automation.DemoBindings.csproj", "{4DD5E62E-E447-419D-82BF-C918F08091BD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp", "src\BlazorApp\BlazorApp.csproj", "{EF0AD0D5-3DAC-4C4E-8ED7-0E443C79E168}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Behavioral.Automation.Playwright", "Behavioral.Automation.Playwright\Behavioral.Automation.Playwright\Behavioral.Automation.Playwright.csproj", "{F1B23009-3334-4B1B-8198-2C618346062D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F618BBEA-613A-4A67-A76E-3BEDD43B7175}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F618BBEA-613A-4A67-A76E-3BEDD43B7175}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F618BBEA-613A-4A67-A76E-3BEDD43B7175}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F618BBEA-613A-4A67-A76E-3BEDD43B7175}.Release|Any CPU.Build.0 = Release|Any CPU + {054B7FBC-190D-43FA-B6D6-13A2BA7CB92D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {054B7FBC-190D-43FA-B6D6-13A2BA7CB92D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {054B7FBC-190D-43FA-B6D6-13A2BA7CB92D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {054B7FBC-190D-43FA-B6D6-13A2BA7CB92D}.Release|Any CPU.Build.0 = Release|Any CPU + {C7AF5750-75A5-4E8D-80FA-FB54914B0B17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7AF5750-75A5-4E8D-80FA-FB54914B0B17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7AF5750-75A5-4E8D-80FA-FB54914B0B17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7AF5750-75A5-4E8D-80FA-FB54914B0B17}.Release|Any CPU.Build.0 = Release|Any CPU + {4DD5E62E-E447-419D-82BF-C918F08091BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4DD5E62E-E447-419D-82BF-C918F08091BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4DD5E62E-E447-419D-82BF-C918F08091BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4DD5E62E-E447-419D-82BF-C918F08091BD}.Release|Any CPU.Build.0 = Release|Any CPU + {EF0AD0D5-3DAC-4C4E-8ED7-0E443C79E168}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF0AD0D5-3DAC-4C4E-8ED7-0E443C79E168}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF0AD0D5-3DAC-4C4E-8ED7-0E443C79E168}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF0AD0D5-3DAC-4C4E-8ED7-0E443C79E168}.Release|Any CPU.Build.0 = Release|Any CPU + {F1B23009-3334-4B1B-8198-2C618346062D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1B23009-3334-4B1B-8198-2C618346062D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1B23009-3334-4B1B-8198-2C618346062D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1B23009-3334-4B1B-8198-2C618346062D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {054B7FBC-190D-43FA-B6D6-13A2BA7CB92D} = {BB7AC02C-03FD-4F17-B4A9-CDECC1A63DA5} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {724FD185-E1F2-44BD-89EA-DFD1DBF6453A} + EndGlobalSection +EndGlobal From e006da2a5b09afea7e0da39cf2b9236b05f2d545 Mon Sep 17 00:00:00 2001 From: Sergey Ruzin Date: Mon, 6 Jun 2022 17:19:17 +0300 Subject: [PATCH 3/6] Fixed path to BlazorApp --- .../Behavioral.Automation.DemoBindings/Bootstrapper.cs | 2 +- .../Behavioral.Automation.DemoScenarios.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Bootstrapper.cs b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Bootstrapper.cs index 64b17a22..ef1346fc 100644 --- a/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Bootstrapper.cs +++ b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoBindings/Bootstrapper.cs @@ -41,7 +41,7 @@ private static bool IsConnectionEstablished() private static void RunTestApp() { - string testAppPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "..", "src", + string testAppPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "..", "..", "src", "BlazorApp"); _coreRunProcess = new Process diff --git a/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj index 788d9982..17efee93 100644 --- a/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj +++ b/Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios/Behavioral.Automation.DemoScenarios.csproj @@ -10,7 +10,7 @@ - + From 9fa4da280f056ff5134255112e82cbcec59483ee Mon Sep 17 00:00:00 2001 From: Sergey Ruzin Date: Tue, 7 Jun 2022 10:24:37 +0300 Subject: [PATCH 4/6] Changed browser launch parameters for pipeline --- .github/workflows/Autotests.yaml | 2 +- .github/workflows/main.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Autotests.yaml b/.github/workflows/Autotests.yaml index d3c47225..8d8f869d 100644 --- a/.github/workflows/Autotests.yaml +++ b/.github/workflows/Autotests.yaml @@ -6,7 +6,7 @@ on: branches: [ main ] env: - BROWSER_PARAMS: "--window-size=1920,1080 --allowed-ips" + BROWSER_PARAMS: "--window-size=1920,1080 --allowed-ips --no-sandbox" jobs: build: diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index da21b6d0..4e459698 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -28,7 +28,7 @@ jobs: run: dotnet build -c Release --no-restore - name: Get version run: | - export VER=$(grep -oP '\d+\.\d+\.\d+(?=)' /Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj) + export VER=$(grep -oP '\d+\.\d+\.\d+(?=)' Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj) echo "VER=$VER" >> $GITHUB_ENV echo $VER - name: Package app From 17bd59a35f80209cca09f07d7477fd938cfbded8 Mon Sep 17 00:00:00 2001 From: Sergey Ruzin Date: Wed, 8 Jun 2022 17:59:58 +0300 Subject: [PATCH 5/6] Added package info to .csproj --- .../Behavioral.Automation.Playwright.csproj | 37 +++++++++++++++---- .../Behavioral.Automation.csproj | 2 +- Behavioral.Automation.Selenium/CHANGELOG.md | 2 +- src/BlazorApp/BlazorApp.csproj | 1 + 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj index 022c2fc3..efcaf5af 100644 --- a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj @@ -1,6 +1,27 @@ + true + Quantori Inc. + Platform design is based on strong and well-defined borderline between procedural test cases structure and object-oriented code-behind. + + We think that test cases implementation approach (inside BDD paradigm) is literaly the same across different applications. That means that we can define and reuse grammar structures across different application domains. On top of this, while talking about single page web applications, we may take into account that atomic controls behavior is also the same across different domains. + + The whole automation code is divided into the following parts: + - Feature files + - Bindings + - Wrappers + - Infrastructure bindings + - UI structure descriptive code + - Supportive code + + Quantori Inc. + 0.1 + https://github.com/quantori/Behavioral.Automation + true + true + snupkg + net6.0 enable @@ -8,17 +29,17 @@ - - - - - - + + + + + + - - + + diff --git a/Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj b/Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj index f2053ec9..3182f812 100644 --- a/Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj +++ b/Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj @@ -16,7 +16,7 @@ The whole automation code is divided into the following parts: - UI structure descriptive code - Supportive code Quantori Inc. - 1.11.0 + 1.13.0 https://github.com/quantori/Behavioral.Automation true true diff --git a/Behavioral.Automation.Selenium/CHANGELOG.md b/Behavioral.Automation.Selenium/CHANGELOG.md index 42748bd9..f719e8e6 100644 --- a/Behavioral.Automation.Selenium/CHANGELOG.md +++ b/Behavioral.Automation.Selenium/CHANGELOG.md @@ -4,6 +4,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -[1.12.0] - 2022-06-03 +[1.13.0] - 2022-06-03 ### Added - Changed folder structure to separate Selenium and Playwright versions of the framework \ No newline at end of file diff --git a/src/BlazorApp/BlazorApp.csproj b/src/BlazorApp/BlazorApp.csproj index c78c9c7e..40670e21 100644 --- a/src/BlazorApp/BlazorApp.csproj +++ b/src/BlazorApp/BlazorApp.csproj @@ -4,6 +4,7 @@ net6.0 enable enable + preview From 8b27f2e9a821dbaf70bd34dbca76a3339e028f5f Mon Sep 17 00:00:00 2001 From: Sergey Ruzin Date: Thu, 30 Jun 2022 17:07:43 +0300 Subject: [PATCH 6/6] Added bindings, element wrappers and elements search --- .../Behavioral.Automation.Configs.csproj | 19 ++ .../ConfigManager.cs | 41 ++++ .../utils/NormalizePath.cs | 11 ++ .../Behavioral.Automation.Playwright.csproj | 7 +- .../Bindings/AttributeBinding.cs | 60 ++++++ .../Bindings/ClickBinding.cs | 58 ++++++ .../Bindings/DropdownBinding.cs | 184 ++++++++++++++++++ .../Bindings/ElementCollectionBinding.cs | 51 +++++ .../Bindings/InputBinding.cs | 49 +++++ .../Bindings/NavigationBinding.cs | 45 +++++ .../Bindings/PageBinding.cs | 22 +++ .../Bindings/TableBinding.cs | 94 +++++++++ .../Bindings/VisibilityBinding.cs | 42 ++++ .../Configs/Config.cs | 20 ++ .../Context/WebContext.cs | 9 + .../ElementTransformations.cs | 88 +++++++++ .../Behavioral.Automation.Playwright/Hooks.cs | 90 +++++++++ .../Pages/ISelectorStorage.cs | 6 + .../Pages/MainPage.cs | 10 + .../ComplexBindingBuilder.cs | 148 -------------- .../IComplexBindingBuilder.cs | 18 -- .../IStepParametersProcessor.cs | 13 -- .../ElementSelectors/DropdownSelector.cs | 8 + .../ElementSelectors/ElementSelector.cs | 8 + .../ElementSelectors/TableSelector.cs | 9 + .../Services/ILocatorProvider.cs | 9 + .../Services/LocatorProvider.cs | 32 +++ .../Services/LocatorStorageService.cs | 23 +++ .../TestServicesBuilder.cs | 24 +++ .../Utils/PrintValuesHelper.cs | 22 +++ .../Utils/StringExtensions.cs | 29 +-- .../WebElementsWrappers/DropdownWrapper.cs | 36 ++++ .../Interface/IDropdownWrapper.cs | 16 ++ .../Interface/ITableWrapper.cs | 19 ++ .../Interface/IWebElementWrapper.cs | 13 ++ .../WebElementsWrappers/TableWrapper.cs | 38 ++++ .../WebElementsWrappers/WebElementWrapper.cs | 19 ++ Behavioral.Automation.sln | 6 + 38 files changed, 1201 insertions(+), 195 deletions(-) create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Configs/Behavioral.Automation.Configs.csproj create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Configs/ConfigManager.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Configs/utils/NormalizePath.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/AttributeBinding.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/ClickBinding.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/DropdownBinding.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/ElementCollectionBinding.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/InputBinding.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/NavigationBinding.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/PageBinding.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/TableBinding.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/VisibilityBinding.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Configs/Config.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Context/WebContext.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/ElementTransformations/ElementTransformations.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Hooks.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Pages/ISelectorStorage.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Pages/MainPage.cs delete mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/ComplexBindingBuilder.cs delete mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/IComplexBindingBuilder.cs delete mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/IStepParametersProcessor.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/DropdownSelector.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/ElementSelector.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/TableSelector.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ILocatorProvider.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/LocatorProvider.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/LocatorStorageService.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/TestServicesBuilder.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Utils/PrintValuesHelper.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/DropdownWrapper.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/IDropdownWrapper.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/ITableWrapper.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/IWebElementWrapper.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/TableWrapper.cs create mode 100644 Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/WebElementWrapper.cs diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Configs/Behavioral.Automation.Configs.csproj b/Behavioral.Automation.Playwright/Behavioral.Automation.Configs/Behavioral.Automation.Configs.csproj new file mode 100644 index 00000000..a0fc964f --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Configs/Behavioral.Automation.Configs.csproj @@ -0,0 +1,19 @@ + + + + net6.0 + enable + enable + Debug;Release;Test;Dev;Prod + AnyCPU + + + + + + + + + + + diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Configs/ConfigManager.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Configs/ConfigManager.cs new file mode 100644 index 00000000..4adeabd9 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Configs/ConfigManager.cs @@ -0,0 +1,41 @@ +using System.Reflection; +using Microsoft.Extensions.Configuration; + +namespace Behavioral.Automation.Configs; + +public static class ConfigManager +{ + private static IConfiguration Configuration { get; } + + static ConfigManager() + { + var env = Environment.GetEnvironmentVariable("STAND"); + + if (string.IsNullOrEmpty(env)) + { + var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(); + var configAttribute = attributes.FirstOrDefault(attribute => attribute.TypeId.Equals(typeof(AssemblyConfigurationAttribute))); + var configEnv = (AssemblyConfigurationAttribute) configAttribute!; + env = configEnv.Configuration; + } + + Configuration = new ConfigurationBuilder() + .AddJsonFile("AutomationConfig.json", true, true) + .AddJsonFile($"AutomationConfig.{env.ToLower()}.json", true, true) + .AddEnvironmentVariables() + .Build(); + } + + public static T GetConfig() + { + if (Configuration is null) throw new ArgumentException("Please, init configuration"); + + var config = Configuration.Get(); + return config; + } + + public static string GetConfig(string configKey) + { + return Configuration.GetSection(configKey).Value; + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Configs/utils/NormalizePath.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Configs/utils/NormalizePath.cs new file mode 100644 index 00000000..fb2f7b72 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Configs/utils/NormalizePath.cs @@ -0,0 +1,11 @@ +namespace Behavioral.Automation.Configs.utils; + +public static class NormalizePath +{ + public static string NormalizePathAccordingOs(this string fullPath) + { + fullPath = fullPath.Replace("/", Path.DirectorySeparatorChar.ToString()); + fullPath = fullPath.Replace(@"\", Path.DirectorySeparatorChar.ToString()); + return fullPath; + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj index a0eeb395..1f35e31b 100644 --- a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj @@ -29,6 +29,10 @@ + + + + @@ -38,8 +42,7 @@ - - + diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/AttributeBinding.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/AttributeBinding.cs new file mode 100644 index 00000000..741e73e9 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/AttributeBinding.cs @@ -0,0 +1,60 @@ +using System.Linq; +using System.Threading.Tasks; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using Microsoft.Playwright; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.Bindings; + +[Binding] +public class AttributeBinding +{ + private readonly ElementTransformations.ElementTransformations _elementTransformations; + + public AttributeBinding(ElementTransformations.ElementTransformations elementTransformations) + { + _elementTransformations = elementTransformations; + } + + + /// + /// Check if element is disabled or enabled + /// + /// Tested web element wrapper + /// Element expected status (enabled or disabled) + /// Then "Test" input should be enabled + [Given(@"the ""(.+?)"" is (enabled|disabled)")] + [Then(@"the ""(.+?)"" should be| (enabled|disabled)")] + public async Task CheckElementIsDisabled(IWebElementWrapper element, bool enabled) + { + if (enabled) + { + await Assertions.Expect(element.Locator).Not.ToBeDisabledAsync(); + } + else + { + await Assertions.Expect(element.Locator).ToBeDisabledAsync(); + } + } + + /// + /// Check that multiple elements are disabled or enabled + /// + /// Elements expected status (enabled or disabled) + /// Specflow table with element names to be tested + /// + /// Then the following controls should be enabled: + /// | control | + /// | Test" input | + /// | Test2 input | + /// + [Given("the following controls are (enabled|disabled):")] + [Then("the following controls should be (enabled|disabled):")] + public async Task CheckControlTypeCollectionShown(bool enabled, Table table) + { + foreach (var row in table.Rows) + { + await CheckElementIsDisabled(_elementTransformations.GetElement(row.Values.First()), enabled); + } + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/ClickBinding.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/ClickBinding.cs new file mode 100644 index 00000000..cdadf9e8 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/ClickBinding.cs @@ -0,0 +1,58 @@ +using System.Threading.Tasks; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.Bindings; + +[Binding] +public class ClickBinding +{ + /// + /// Execute click on the element + /// + /// Tested web element wrapper + /// When user clicks on "Test" button + [Given(@"user clicked on ""(.+?)""")] + [When(@"user clicks on ""(.+?)""")] + public async Task ClickOnElement(IWebElementWrapper element) + { + await element.Locator.ClickAsync(); + } + + /// + /// Execute double click on the element + /// + /// Tested web element wrapper + /// When user clicks twice on "Test" button + [Given(@"user clicked twice on ""(.+?)""")] + [When(@"user clicks twice on ""(.+?)""")] + public async Task ClickTwiceOnElement(IWebElementWrapper element) + { + await element.Locator.DblClickAsync(); + } + + /// + /// Execute click on the specific element in the collection + /// + /// Number of the tested element in the collection + /// Tested web element wrapper + /// When user clicks at first element among "Test" buttons (note that numbers from 1 to 10 can be written as words) + /// Hover mouse over element + /// + /// Tested web element wrapper + /// When user hovers mouse over "Test" button + [Given(@"user hovered mouse over ""(.+?)""")] + [When(@"user hovers mouse over ""(.+?)""")] + public async Task HoverMouse(IWebElementWrapper element) + { + await element.Locator.HoverAsync(); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/DropdownBinding.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/DropdownBinding.cs new file mode 100644 index 00000000..8575d858 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/DropdownBinding.cs @@ -0,0 +1,184 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Behavioral.Automation.Playwright.Utils; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using Microsoft.Playwright; +using NUnit.Framework; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.Bindings; + +[Binding] +public class DropdownBinding +{ + /// + /// Select entry inside dropdown + /// + /// Entry's value + /// Tested web element wrapper + [Given(@"user selected ""(.+?)"" in ""(.+?)""")] + [When(@"user selects ""(.+?)"" in ""(.+?)""")] + public async Task SelectValueInDropdown(string entry, IDropdownWrapper element) + { + await element.SelectValue(entry); + } + + /// + /// Check dropdown selected value + /// + /// Tested web element wrapper + /// Assertion behavior (instant or continuous) + /// Expected selected value + /// Given the "Test" dropdown selected value is "Test value" + [Given(@"the ""(.+?)"" selected value is ""(.+?)""")] + [Then(@"the ""(.+?)"" selected value should be ""(.+?)""")] + public async Task CheckSelectedValue(IDropdownWrapper wrapper, string value) + { + await Assertions.Expect(wrapper.Locator).ToHaveValueAsync(value); + } + + /// + /// Check values stored inside dropdown + /// + /// Tested web element wrapper + /// Specflow table with expected dropdown items + /// + /// Then the "Test" dropdown should have the following values: + /// | value | + /// | Test value 1 | + /// | Test value 2 | + /// + [Given(@"the ""(.+?)"" has the following values:")] + [Then(@"the ""(.*?)"" should have the following values:")] + public async Task CheckAllItems(IDropdownWrapper wrapper, Table items) + { + await CheckDropdownElements(wrapper, items, $"{wrapper.Caption} values"); + } + + /// + /// Check that dropdown contains specific value among its other values + /// + /// Tested web element wrapper + /// Assertion behavior + /// Expected value + /// Then "Test" dropdown should contain "Test value" + [Given(@"the ""(.+?)"" (contains|does not contain) ""(.+?)""")] + [Then(@"the ""(.+?)"" should (contain|not contain) ""(.+?)""")] + public async Task CheckDropdownContainsItems( + IDropdownWrapper wrapper, + string behavior, + string value) + { + var actualValues = await wrapper.ItemsTexts; + if (behavior.Contains("not")) + { + CollectionAssert.DoesNotContain(actualValues, value, + actualValues.CreateDropdownErrorMessage(wrapper.Caption)); + } + else + { + CollectionAssert.Contains(actualValues, value, actualValues.CreateDropdownErrorMessage(wrapper.Caption)); + } + } + + /// + /// Check values stored inside dropdown by partial match + /// + /// Tested web element wrapper + /// Positive or negative assertion + /// Specflow table with expected dropdown items + /// + /// Then the "Test" dropdown should contain the following values: + /// | value | + /// | Test value 1 | + /// | Test value 2 | + /// + [Given(@"the ""(.+?)"" (contains|does not contain) the following values:")] + [Then(@"the ""(.+?)"" should (contain|not contain) the following values:")] + public async Task CheckDropdownContainsMultipleItems(IDropdownWrapper wrapper, string behavior, Table table) + { + foreach (var row in table.Rows) + { + await CheckDropdownContainsItems(wrapper, behavior, row.Values.First()); + } + } + + /// + /// Select multiple value inside dropdown (if dropdown supports multi select) + /// + /// Tested web element wrapper + /// Specflow table which contains expected values + /// + /// When user selects multiple entries in "Test" dropdown: + /// | entry | + /// | Entry1 | + /// | Entry2 | + /// + [Given(@"user selected multiple entries in ""(.+?)"":")] + [When(@"user selects multiple entries in ""(.+?)"":")] + public void ClickOnMultipleEntries(IDropdownWrapper wrapper, Table entries) + { + wrapper.SelectValue(entries.Rows.Select(x => x.Values.First()).ToArray()); + } + + /// + /// Check that value is enabled or disabled inside dropdown + /// + /// Value text + /// Check type + /// Dropdown element object + /// + /// Then the "Entry 1" value should become disabled in "Test" dropdown + /// + [Given(@"the ""(.+?)"" value is (enabled|disabled) in ""(.+?)""")] + [Then(@"the ""(.+?)"" value should be (enabled|disabled) in ""(.+?)""")] + public async Task CheckValueInDropdownIsEnabled(string value, bool enabled, IDropdownWrapper wrapper) + { + var optionToCheck = wrapper.GetOption(value); + if (enabled) + { + await Assertions.Expect(optionToCheck).Not.ToBeDisabledAsync(); + } + else + { + await Assertions.Expect(optionToCheck).ToBeDisabledAsync(); + } + } + + /// + /// Check that multiple values are enabled or disabled inside dropdown + /// + /// Check type + /// Dropdown element object + /// + /// Then the following values should become disabled in "Test" dropdown: + /// | entry | + /// | Entry1 | + /// | Entry2 | + /// + [Given(@"the following values are (enabled|disabled) in ""(.+?)"":")] + [Then(@"the following values should be (enabled|disabled) in ""(.+?)"":")] + public async Task CheckMultipleValuesInDropdownAreEnabled(bool enabled, + IDropdownWrapper wrapper, Table table) + { + foreach (var row in table.Rows) + { + await CheckValueInDropdownIsEnabled(row.Values.First(), enabled, wrapper); + } + } + + private async Task CheckDropdownElements(IDropdownWrapper wrapper, Table expectedValues, string valueType) + { + for (var i = 0; i < expectedValues.Rows.Count; i++) + { + var expectedValue = expectedValues.Rows.ElementAt(i).Values.FirstOrDefault(); + var actualValues = await wrapper.ItemsTexts; + var elementToCheck = actualValues.ElementAt(i); + + CollectionAssert.AreEqual(expectedValue, elementToCheck, + $"Actual: {string.Join(" | ", elementToCheck)}{Environment.NewLine}" + + $"Expected: {string.Join(" | ", expectedValue)}{Environment.NewLine}"); + } + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/ElementCollectionBinding.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/ElementCollectionBinding.cs new file mode 100644 index 00000000..55915b1c --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/ElementCollectionBinding.cs @@ -0,0 +1,51 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Behavioral.Automation.Playwright.Services; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using NUnit.Framework; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.Bindings; + +[Binding] +public class ElementCollectionBinding +{ + private readonly LocatorStorageService _locatorStorageService; + + public ElementCollectionBinding(LocatorStorageService locatorStorageService) + { + _locatorStorageService = locatorStorageService; + } + + [Given(@"user clicked on the ""(.+?)"" with ""(.+?)"" text")] + [When(@"user clicks on the ""(.+?)"" with ""(.+?)"" text")] + public async Task ClickOnElementByText(IWebElementWrapper element, string text) + { + var allTextContents = await element.Locator.AllTextContentsAsync(); + var index = allTextContents.ToList().FindIndex(s => s.Equals(text, StringComparison.InvariantCultureIgnoreCase)); + if (index < 0) + { + Assert.Fail($"No element with text '{text}' found in '{element}' collection."); + } + await element.Locator.Nth(index).ClickAsync(); + } + + [Given(@"user clicked on every ""(.*)""")] + [When(@"user clicks on every ""(.*)""")] + public async Task ClickOnEveryElement(IWebElementWrapper element) + { + var count = await element.Locator.CountAsync(); + for (var i = 0; i < count; i++) + { + await element.Locator.Nth(i).ClickAsync(); + } + } + + [Given(@"user clicked on ""(.+?)"" element among ""(.+?)""")] + [When(@"user clicks on ""(.+?)"" element among ""(.+?)""")] + public async Task ClickOnElementByIndex(IWebElementWrapper element, int index) + { + await element.Locator.Nth(index).ClickAsync(); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/InputBinding.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/InputBinding.cs new file mode 100644 index 00000000..02a5eca8 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/InputBinding.cs @@ -0,0 +1,49 @@ +using System.Linq; +using System.Threading.Tasks; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.Bindings; + +[Binding] +public class InputBinding +{ + private readonly ElementTransformations.ElementTransformations _elementTransformations; + + public InputBinding(ElementTransformations.ElementTransformations elementTransformations) + { + _elementTransformations = elementTransformations; + } + + /// + /// Enter string into text field or input + /// + /// String to enter + /// Tested web element wrapper + /// When user enters "test string" into "Test input" + [Given(@"user entered (.+?) into ""(.+?)""")] + [When(@"user enters ""(.+?)"" into ""(.+?)""")] + public async Task FillInput(string text, IWebElementWrapper element) + { + await element.Locator.FillAsync(text); + } + + /// Enter multiple value into multiple controls + /// + /// Specflow table which stores name of controls and values to enter + /// + /// When user enters the following values into the following controls: + /// | Value | element | + /// | "Test value" | Test1 input | + /// | "Test value" | Test2 input | + /// + [Given("user entered the following values into the following controls:")] + [When("user enters the following values into the following controls:")] + public async Task EnterInputIntoMultipleControls(Table table) + { + foreach (var row in table.Rows) + { + await FillInput(row.Values.First(), _elementTransformations.GetElement(row.Values.Last())); + } + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/NavigationBinding.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/NavigationBinding.cs new file mode 100644 index 00000000..11ddc318 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/NavigationBinding.cs @@ -0,0 +1,45 @@ +using System; +using System.Threading.Tasks; +using Behavioral.Automation.Configs; +using Behavioral.Automation.Playwright.Configs; +using Behavioral.Automation.Playwright.Context; +using Microsoft.Playwright; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.Bindings; + +[Binding] +public class NavigationBinding +{ + private readonly WebContext _webContext; + + public NavigationBinding(WebContext webContext) + { + _webContext = webContext; + } + + [Given(@"URL ""(.+?)"" is opened")] + public async Task GivenUrlIsOpened(string url) + { + if (IsAbsoluteUrl(url)) + { + await _webContext.Page.GotoAsync(url); + return; + } + + await _webContext.Page.GotoAsync(ConfigManager.GetConfig().BaseUrl + url, + new PageGotoOptions { WaitUntil = WaitUntilState.NetworkIdle, Timeout = 300000 }); + } + + private static bool IsAbsoluteUrl(string url) + { + return Uri.IsWellFormedUriString(url, UriKind.Absolute); + } + + [Given("application URL is opened")] + public async Task GivenApplicationUrlIsOpened() + { + await _webContext.Page.GotoAsync(ConfigManager.GetConfig().BaseUrl, + new PageGotoOptions { WaitUntil = WaitUntilState.NetworkIdle, Timeout = 300000 }); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/PageBinding.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/PageBinding.cs new file mode 100644 index 00000000..50d59071 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/PageBinding.cs @@ -0,0 +1,22 @@ +using Behavioral.Automation.Playwright.Context; +using Microsoft.Playwright; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.Bindings; + +[Binding] +public class PageBinding +{ + private readonly WebContext _webContext; + + public PageBinding(WebContext webContext) + { + _webContext = webContext; + } + + [Then(@"page title should be ""(.+?)""")] + public void ThenPageTitleShouldBe(string title) + { + Assertions.Expect(_webContext.Page).ToHaveTitleAsync(title); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/TableBinding.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/TableBinding.cs new file mode 100644 index 00000000..d1189cfd --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/TableBinding.cs @@ -0,0 +1,94 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Behavioral.Automation.Configs; +using Behavioral.Automation.Playwright.Configs; +using Behavioral.Automation.Playwright.Services; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using Microsoft.Playwright; +using NUnit.Framework; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.Bindings; + +[Binding] +public class TableBinding +{ + private static readonly float? Timeout = ConfigManager.GetConfig().AssertTimeoutMilliseconds; + + [Given(@"user clicked clicked on ""(.+?)"" header in ""(.+?)""")] + [When(@"user clicks clicked on ""(.+?)"" header in ""(.+?)""")] + public async Task ClickOnHeaderCell(string headerTitle, ITableWrapper element) + { + var headerToClick = element.HeaderCells.Filter(new LocatorFilterOptions {HasTextString = headerTitle}); + await headerToClick.ClickAsync(); + } + + [Given(@"the ""(.+?)"" has the following rows (with|without) headers:")] + [Then(@"the ""(.+?)"" should have the following rows (with|without) headers:")] + public async Task CheckTableRows(ITableWrapper element,string countingHeaders, Table expectedTable) + { + var checkHeadersNeeded = countingHeaders != "without"; + if (checkHeadersNeeded) + { + var expectedHeader = expectedTable.Header; + var actualHeaderText = await element.HeaderCells.AllTextContentsAsync(); + CollectionAssert.AreEqual(expectedHeader, actualHeaderText, + $"Actual: {string.Join(" | ", actualHeaderText)}{Environment.NewLine}" + + $"Expected: {string.Join(" | ", expectedHeader)}{Environment.NewLine}"); + } + + await element.WebContext.Page.WaitForLoadStateAsync(LoadState.NetworkIdle); + var actualRows = element.Rows; + var rowCount = await actualRows.CountAsync(); + + Assert.That(rowCount, Is.EqualTo(expectedTable.Rows.Count), "Rows count mismatch."); + + for (var i = 0; i < expectedTable.Rows.Count; i++) + { + var rowToCheck = element.Rows.Nth(i); + var actualRowValues = await element.GetCellsForRow(rowToCheck).AllTextContentsAsync(); + CollectionAssert.AreEqual(expectedTable.Rows[i].Values, actualRowValues, + "Row #{i} mismatch. {Environment.NewLine} " + + $"Actual: {string.Join(" | ", actualRowValues)}{Environment.NewLine}" + + $"Expected: {string.Join(" | ", expectedTable.Rows[i].Values)}{Environment.NewLine}"); + } + } + + [Given(@"the ""(.+?)"" contains the following rows (with|without) headers:")] + [Then(@"the ""(.+?)"" should contain the following rows (with|without) headers:")] + public async Task CheckTableContainRows(ITableWrapper element, string countingHeaders, Table expectedTable) + { + var checkHeadersNeeded = countingHeaders != "without"; + if (checkHeadersNeeded) + { + var actualHeaderText = await element.HeaderCells.AllTextContentsAsync(); + var actualHeaderTextTrimmed = actualHeaderText.Select(s => s.Trim()); + + CollectionAssert.IsSubsetOf(expectedTable.Header, actualHeaderTextTrimmed, + $"Element: Header of {element.Caption}{Environment.NewLine}"); + } + + for (var i = 0; i < expectedTable.Rows.Count; i++) + { + var rowToCheck = element.Rows.Nth(i); + var actualRowValues = await element.GetCellsForRow(rowToCheck).AllTextContentsAsync(); + var actualRowValuesTrimmed = actualRowValues.Select(s => s.Trim()); + CollectionAssert.IsSubsetOf(expectedTable.Rows[i].Values, actualRowValuesTrimmed, + $"Row #{i}{Environment.NewLine}Row selector:{ await rowToCheck.TextContentAsync()}{Environment.NewLine}Cell selector:{element.CellsSelector}{Environment.NewLine}"); + } + } + + /// + /// Check number of table rows + /// + /// Tested web element wrapper + /// Expected number of rows + /// Then "Test" table should have 5 items + [Given(@"the ""(.+?)"" has ""(.+?)"" items")] + [Then(@"the ""(.+?)"" should have ""(.+?)"" items")] + public async Task CheckTableItemsCount(ITableWrapper element, int expectedRowsCount) + { + await Assertions.Expect(element.Rows).ToHaveCountAsync(expectedRowsCount, new LocatorAssertionsToHaveCountOptions { Timeout = Timeout }); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/VisibilityBinding.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/VisibilityBinding.cs new file mode 100644 index 00000000..b58c177f --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Bindings/VisibilityBinding.cs @@ -0,0 +1,42 @@ +using System.Linq; +using System.Threading.Tasks; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using Microsoft.Playwright; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.Bindings; + +[Binding] +public class VisibilityBinding +{ + private readonly ElementTransformations.ElementTransformations _elementTransformations; + + public VisibilityBinding(ElementTransformations.ElementTransformations elementTransformations) + { + _elementTransformations = elementTransformations; + } + + [Given(@"the ""(.+?)"" (is|is not) visible")] + [Then(@"the ""(.+?)"" should (be|be not) visible")] + public async Task CheckElementVisibility(IWebElementWrapper element, string condition) + { + if (!condition.Contains("not")) + { + await Assertions.Expect(element.Locator).ToBeVisibleAsync(); + } + else + { + await Assertions.Expect(element.Locator).Not.ToBeVisibleAsync(); + } + } + + [Given("the following controls (are|are not) visible:")] + [Then("the following controls should (be|be not) visible:")] + public async Task CheckMultipleControlsVisibility(string condition, Table table) + { + foreach (var row in table.Rows) + { + await CheckElementVisibility(_elementTransformations.GetElement(row.Values.First()), condition); + } + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Configs/Config.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Configs/Config.cs new file mode 100644 index 00000000..06be618f --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Configs/Config.cs @@ -0,0 +1,20 @@ +using Microsoft.Extensions.Configuration; + +namespace Behavioral.Automation.Playwright.Configs; + +public class Config +{ + [ConfigurationKeyName("BASE_URL")] + public string BaseUrl { get; set; } + + [ConfigurationKeyName("SEARCH_ATTRIBUTE")] + public string SearchAttribute { get; set; } + + [ConfigurationKeyName("ASSERT_TIMEOUT_MILLISECONDS")] + public float? AssertTimeoutMilliseconds { get; set; } + + [ConfigurationKeyName("SLOW_MO_MILLISECONDS")] + public float? SlowMoMilliseconds { get; set; } + + [ConfigurationKeyName("HEADLESS")] public bool? Headless { get; set; } = true; +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Context/WebContext.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Context/WebContext.cs new file mode 100644 index 00000000..f11c1c63 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Context/WebContext.cs @@ -0,0 +1,9 @@ +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.Context; + +public class WebContext +{ + public IBrowserContext Context { get; set; } + public IPage Page { get; set; } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/ElementTransformations/ElementTransformations.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/ElementTransformations/ElementTransformations.cs new file mode 100644 index 00000000..840e9fac --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/ElementTransformations/ElementTransformations.cs @@ -0,0 +1,88 @@ +using Behavioral.Automation.Playwright.Context; +using Behavioral.Automation.Playwright.Services; +using Behavioral.Automation.Playwright.Services.ElementSelectors; +using Behavioral.Automation.Playwright.Utils; +using Behavioral.Automation.Playwright.WebElementsWrappers; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using JetBrains.Annotations; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright.ElementTransformations; + +[Binding] +public class ElementTransformations +{ + private readonly WebContext _webContext; + private readonly ILocatorProvider _locatorProvider; + private readonly LocatorStorageService _locatorStorageService; + + public ElementTransformations(WebContext webContext, ILocatorProvider locatorProvider, + LocatorStorageService locatorStorageService) + { + _webContext = webContext; + _locatorProvider = locatorProvider; + _locatorStorageService = locatorStorageService; + } + + [StepArgumentTransformation] + public IWebElementWrapper GetElement(string caption) + { + var selector = _locatorStorageService.Get(caption); + return new WebElementWrapper(_webContext, _locatorProvider.GetLocator(selector), caption); + } + + [StepArgumentTransformation] + public IDropdownWrapper GetDropdownElement(string caption) + { + var dropdownSelector = _locatorStorageService.Get(caption); + return new DropdownWrapper(_webContext, _locatorProvider.GetLocator(dropdownSelector.BaseElementSelector), + _locatorProvider.GetLocator(dropdownSelector.ItemSelector), caption); + } + + [StepArgumentTransformation] + public ITableWrapper GetTableElement(string caption) + { + var tableSelector = _locatorStorageService.Get(caption); + return new TableWrapper(_webContext, + _locatorProvider.GetLocator(tableSelector.BaseElementSelector), + _locatorProvider.GetLocator(tableSelector.RowSelector), + tableSelector.CellSelector, + _locatorProvider.GetLocator(tableSelector.HeaderCellSelector), + caption); + } + + /// + /// Transform "enabled" or "disabled" string into bool value + /// + /// "enabled" or "disabled" string + /// + [StepArgumentTransformation("(enabled|disabled)")] + public bool ConvertEnabledState(string enabled) + { + return enabled == "enabled"; + } + + /// + /// Convert strings into the numbers + /// + /// String with the number which is received from Specflow steps + /// + [StepArgumentTransformation, NotNull] + public int ParseNumber(string number) + { + return number switch + { + ("first") => 1, + ("second") => 2, + ("third") => 3, + ("fourth") => 4, + ("fifth") => 5, + ("sixth") => 6, + ("seventh") => 7, + ("eighth") => 8, + ("ninth") => 9, + ("tenth") => 10, + _ => StringExtensions.ParseNumberFromString(number) + }; + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Hooks.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Hooks.cs new file mode 100644 index 00000000..004cc78b --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Hooks.cs @@ -0,0 +1,90 @@ +using System; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Behavioral.Automation.Configs; +using Behavioral.Automation.Playwright.Configs; +using Behavioral.Automation.Playwright.Context; +using BoDi; +using Microsoft.Playwright; +using NUnit.Framework; +using TechTalk.SpecFlow; + +namespace Behavioral.Automation.Playwright; + +[Binding] +public class Hooks +{ + private readonly IObjectContainer _objectContainer; + private readonly WebContext _webContext; + private static IPlaywright? _playwright; + private static IBrowser? _browser; + private readonly ScenarioContext _scenarioContext; + private static readonly float? SlowMoMilliseconds = ConfigManager.GetConfig().SlowMoMilliseconds; + private static readonly bool? Headless = ConfigManager.GetConfig().Headless; + private readonly TestServicesBuilder _testServicesBuilder; + + public Hooks(WebContext webContext, ScenarioContext scenarioContext, IObjectContainer objectContainer) + { + _objectContainer = objectContainer; + _webContext = webContext; + _scenarioContext = scenarioContext; + _testServicesBuilder = new TestServicesBuilder(objectContainer); + } + + [BeforeTestRun] + public static async Task InitBrowser() + { + _playwright = await Microsoft.Playwright.Playwright.CreateAsync(); + if (_playwright is null) throw new Exception("Failed to initialize playwright."); + _browser = await InitBrowserAsync(); + if (_browser is null) throw new Exception("Failed to initialize browser."); + } + + [BeforeScenario] + public async Task CreateContextAsync() + { + _webContext.Context = await _browser!.NewContextAsync(); + _webContext.Page = await _webContext.Context.NewPageAsync(); + } + + [AfterScenario] + public async Task CloseContextAsync() + { + await _webContext.Context.CloseAsync(); + } + + [AfterTestRun] + public static void CloseBrowser() + { + _browser!.CloseAsync(); + _playwright!.Dispose(); + } + + [AfterScenario(Order = 0)] + public async Task MakeScreenshot() + { + if (_scenarioContext.TestError != null) + { + var path = new string(TestContext.CurrentContext.Test.Name + .Where(x => !Path.GetInvalidFileNameChars().Contains(x)) + .ToArray()) + ".png"; + await _webContext.Page.ScreenshotAsync(new PageScreenshotOptions + { + Path = path + }); + + TestContext.AddTestAttachment(path); + } + } + + //TODO Implement configuration + private static async Task InitBrowserAsync() + { + return await _playwright!.Chromium.LaunchAsync(new BrowserTypeLaunchOptions + { + Headless = Headless, + SlowMo = SlowMoMilliseconds, + }); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Pages/ISelectorStorage.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Pages/ISelectorStorage.cs new file mode 100644 index 00000000..79cf8998 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Pages/ISelectorStorage.cs @@ -0,0 +1,6 @@ +namespace Behavioral.Automation.Playwright.Pages; + +public interface ISelectorStorage +{ + +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Pages/MainPage.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Pages/MainPage.cs new file mode 100644 index 00000000..bea30368 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Pages/MainPage.cs @@ -0,0 +1,10 @@ +using Behavioral.Automation.Configs; +using Behavioral.Automation.Playwright.Configs; + +namespace Behavioral.Automation.Playwright.Pages; + +class MainPage : ISelectorStorage +{ + private static readonly string Id = ConfigManager.GetConfig().SearchAttribute; + +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/ComplexBindingBuilder.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/ComplexBindingBuilder.cs deleted file mode 100644 index 302c343b..00000000 --- a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/ComplexBindingBuilder.cs +++ /dev/null @@ -1,148 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using NUnit.Framework; -using TechTalk.SpecFlow; -using TechTalk.SpecFlow.Bindings; - -namespace Behavioral.Automation.Playwright.Services.ComplexBindingBuilder -{ - /// - /// Contains BuildAction methods which should be used to call other bindings inside the code (multiple clicks, value selections, etc.) - /// This way actions in called bindings will appear in test logs - /// - public class ComplexBindingBuilder : IComplexBindingBuilder - { - private readonly ITestRunner _runner; - private readonly IStepParametersProcessor _stepParametersProcessor; - private readonly ScenarioContext _scenarioContext; - - private readonly int _indentationSize = 4; - private int _indendationLevel = 1; - - public ComplexBindingBuilder( - ITestRunner runner, - IStepParametersProcessor stepParametersProcessor, - ScenarioContext scenarioContext) - { - _runner = runner; - _stepParametersProcessor = stepParametersProcessor; - _scenarioContext = scenarioContext; - } - - public void Indent() - { - _indendationLevel++; - } - - public void ReduceIndentation() - { - _indendationLevel--; - } - - public void BuildAction(Action method) - { - var attributes = method.GetMethodInfo().GetCustomAttributes(true); - BuildAction(Array.Empty(), attributes, method.GetMethodInfo().Name); - } - - public void BuildAction(Action method, params object[] pars) - { - var attributes = method.GetMethodInfo().GetCustomAttributes(true); - BuildAction(pars, attributes, method.GetMethodInfo().Name); - } - - public void BuildAction(Action method, params object[] pars) - { - var attributes = method.GetMethodInfo().GetCustomAttributes(true); - BuildAction(pars, attributes, method.GetMethodInfo().Name); - } - - public void BuildAction(Action method, params object[] pars) - { - var attributes = method.GetMethodInfo().GetCustomAttributes(true); - BuildAction(pars, attributes, method.GetMethodInfo().Name); - } - - public void BuildAction(Action method, params object[] pars) - { - var attributes = method.GetMethodInfo().GetCustomAttributes(true); - BuildAction(pars, attributes, method.GetMethodInfo().Name); - } - - private void BuildAction(object[] pars, IEnumerable attributes, string methodName) - { - var definitionType = GetStepDefinitionType().ToString(); - var attributeForCurrentStep = attributes.FirstOrDefault(a => a.GetType().Name.StartsWith(definitionType, StringComparison.OrdinalIgnoreCase)); - if (attributeForCurrentStep == null) - { - Assert.Inconclusive($"{definitionType} attribute is not provided for {methodName} binding method"); - } - - string stepExpression; - var table = pars.FirstOrDefault(d => d.GetType() == typeof(Table)); - if (table != null) - { - var parsList = pars.ToList(); - parsList.Remove(table); - stepExpression = _stepParametersProcessor.CreateStepExpression(attributeForCurrentStep.Regex, parsList.ToArray()); - RunAction(stepExpression, (Table)table); - } - else - { - stepExpression = _stepParametersProcessor.CreateStepExpression(attributeForCurrentStep.Regex, pars); - RunAction(stepExpression); - } - TestContext.WriteLine($"{new String(' ', _indendationLevel * _indentationSize)}{stepExpression}"); - } - - private void RunAction(string stepExpression) - { - switch (GetStepDefinitionType()) - { - case StepDefinitionType.Given: - _runner.Given(stepExpression); - break; - - case StepDefinitionType.When: - _runner.When(stepExpression); - break; - - case StepDefinitionType.Then: - _runner.Then(stepExpression); - break; - } - } - - private StepDefinitionType GetStepDefinitionType() - { - try - { - return _scenarioContext.StepContext.StepInfo.StepDefinitionType; - } - catch (NullReferenceException) - { - return StepDefinitionType.Given; - } - } - - private void RunAction(string stepExpression, Table table) - { - switch (_scenarioContext.StepContext.StepInfo.StepDefinitionType) - { - case StepDefinitionType.Given: - _runner.Given(stepExpression, null, table); - break; - - case StepDefinitionType.When: - _runner.When(stepExpression, null, table); - break; - - case StepDefinitionType.Then: - _runner.Then(stepExpression, null, table); - break; - } - } - } -} diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/IComplexBindingBuilder.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/IComplexBindingBuilder.cs deleted file mode 100644 index 802a9f01..00000000 --- a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/IComplexBindingBuilder.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Behavioral.Automation.Playwright.Services.ComplexBindingBuilder -{ - /// - /// This interface contain methods which are used to call other bindings inside test methods, so their actions appear in the logs - /// - public interface IComplexBindingBuilder - { - void BuildAction(Action method); - void BuildAction(Action method, params object[] pars); - void BuildAction(Action method, params object[] pars); - void BuildAction(Action method, params object[] pars); - void BuildAction(Action method, params object[] pars); - void Indent(); - void ReduceIndentation(); - } -} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/IStepParametersProcessor.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/IStepParametersProcessor.cs deleted file mode 100644 index 887735ab..00000000 --- a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ComplexBindingBuilder/IStepParametersProcessor.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Text.RegularExpressions; - -namespace Behavioral.Automation.Playwright.Services.ComplexBindingBuilder -{ - /// - /// This interface contains methods which convert objects passed to ComplexBindingBuilder into step expression to use in Runner - /// - public interface IStepParametersProcessor - { - string CreateStepExpression(string pattern, params object[] arguments); - public bool TryParseStepExpressionArguments(Regex regex, string stepExpression, out string[] arguments); - } -} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/DropdownSelector.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/DropdownSelector.cs new file mode 100644 index 00000000..a9a4a2db --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/DropdownSelector.cs @@ -0,0 +1,8 @@ +namespace Behavioral.Automation.Playwright.Services.ElementSelectors; + +public class DropdownSelector : ElementSelector +{ + public ElementSelector BaseElementSelector { get; set; } + + public ElementSelector ItemSelector { get; set; } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/ElementSelector.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/ElementSelector.cs new file mode 100644 index 00000000..acd578b8 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/ElementSelector.cs @@ -0,0 +1,8 @@ +namespace Behavioral.Automation.Playwright.Services.ElementSelectors; + +public class ElementSelector +{ + public string? IdSelector { get; set; } + + public string? XpathSelector { get; set; } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/TableSelector.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/TableSelector.cs new file mode 100644 index 00000000..dffa5fb6 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ElementSelectors/TableSelector.cs @@ -0,0 +1,9 @@ +namespace Behavioral.Automation.Playwright.Services.ElementSelectors; + +public class TableSelector : ElementSelector +{ + public ElementSelector BaseElementSelector { get; set; } + public ElementSelector RowSelector { get; set; } + public ElementSelector? CellSelector { get; set; } + public ElementSelector? HeaderCellSelector { get; set; } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ILocatorProvider.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ILocatorProvider.cs new file mode 100644 index 00000000..77acd2a0 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/ILocatorProvider.cs @@ -0,0 +1,9 @@ +using Behavioral.Automation.Playwright.Services.ElementSelectors; +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.Services; + +public interface ILocatorProvider +{ + public ILocator GetLocator(ElementSelector selector); +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/LocatorProvider.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/LocatorProvider.cs new file mode 100644 index 00000000..4af3c0b2 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/LocatorProvider.cs @@ -0,0 +1,32 @@ +using System; +using Behavioral.Automation.Configs; +using Behavioral.Automation.Playwright.Configs; +using Behavioral.Automation.Playwright.Context; +using Behavioral.Automation.Playwright.Services.ElementSelectors; +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.Services; + +public class LocatorProvider : ILocatorProvider +{ + private readonly LocatorStorageService _locatorStorageService; + private readonly WebContext _webContext; + private readonly string _searchAttribute = ConfigManager.GetConfig().SearchAttribute; + + public LocatorProvider(LocatorStorageService locatorStorageService, WebContext webContext) + { + _locatorStorageService = locatorStorageService; + _webContext = webContext; + } + + public ILocator GetLocator(ElementSelector selector) + { + if (selector.IdSelector != null) + { + return _webContext.Page.Locator($"//*[@{_searchAttribute}='{selector.IdSelector}']"); + } + + return selector.XpathSelector != null ? _webContext.Page.Locator(selector.XpathSelector) : + throw new NullReferenceException("Element was not found or web context is null"); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/LocatorStorageService.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/LocatorStorageService.cs new file mode 100644 index 00000000..b366eda9 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Services/LocatorStorageService.cs @@ -0,0 +1,23 @@ +using System; +using Behavioral.Automation.Playwright.Pages; +using Behavioral.Automation.Playwright.Services.ElementSelectors; +using Behavioral.Automation.Playwright.Utils; +using JetBrains.Annotations; + +namespace Behavioral.Automation.Playwright.Services; + +[UsedImplicitly] +public class LocatorStorageService +{ + //TODO: Impl factory + public T Get(string elementName) + { + //TODO:impl search service, check type is exist + var mainPage = typeof(MainPage); + var page = Activator.CreateInstance(mainPage); + + var element = (T)mainPage.GetField(elementName.ToCamelCase())?.GetValue(page)!; + if (element is null) throw new Exception($"'{elementName}' selectors not found."); + return element; + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/TestServicesBuilder.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/TestServicesBuilder.cs new file mode 100644 index 00000000..4e87fe17 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/TestServicesBuilder.cs @@ -0,0 +1,24 @@ +using Behavioral.Automation.Playwright.Services; +using BoDi; +using Gherkin.Ast; + +namespace Behavioral.Automation.Playwright +{ + /// + /// Initialise all necessary objects before test execution + /// + public sealed class TestServicesBuilder + { + private readonly IObjectContainer _objectContainer; + + public TestServicesBuilder(IObjectContainer objectContainer) + { + _objectContainer = objectContainer; + } + + public void Build() + { + _objectContainer.RegisterTypeAs(); + } + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Utils/PrintValuesHelper.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Utils/PrintValuesHelper.cs new file mode 100644 index 00000000..5c3ff145 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Utils/PrintValuesHelper.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Behavioral.Automation.Playwright.Utils; + +public static class PrintValuesHelper +{ + /// + /// Method that returns error message with elements aggregation + /// + /// wrapper caption + /// collection of dropdown elements in string form + /// Error message with actual collection items + public static string CreateDropdownErrorMessage(this IEnumerable items, string caption) + { + caption ??= "Collection"; + if (items == null || !items.Any()) + return $"'{caption}' is empty"; + + return $"Actual '{caption}' items are: {items.Aggregate((x, y) => $"{x}, {y}")}"; + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Utils/StringExtensions.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Utils/StringExtensions.cs index cfa356a8..78950ed2 100644 --- a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Utils/StringExtensions.cs +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Utils/StringExtensions.cs @@ -1,20 +1,21 @@ -using System.Text.RegularExpressions; +using System.Text.RegularExpressions; -namespace Behavioral.Automation.Playwright.Utils +namespace Behavioral.Automation.Playwright.Utils; + +public static class StringExtensions { + public static string ToCamelCase(this string str) + { + return Regex.Replace(str, @"[ ](\w)", m => m.Groups[1].Value.ToUpper()); + } + /// - /// Perform various operations with strings + /// Convert string into int /// - public static class StringExtensions + /// String to get number from + /// int converted from string + public static int ParseNumberFromString(string s) { - /// - /// Convert string into int - /// - /// String to get number from - /// int converted from string - public static int ParseNumberFromString(string s) - { - return int.Parse(Regex.Match(s, @"\d+").Value); - } + return int.Parse(Regex.Match(s, @"\d+").Value); } -} +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/DropdownWrapper.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/DropdownWrapper.cs new file mode 100644 index 00000000..1af9c28a --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/DropdownWrapper.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Behavioral.Automation.Playwright.Context; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.WebElementsWrappers; + +public class DropdownWrapper : WebElementWrapper, IDropdownWrapper +{ + public DropdownWrapper(WebContext webContext, ILocator locator, ILocator itemLocator, string caption) : + base(webContext, locator, caption) + { + Items = itemLocator; + } + public ILocator Items { get; set; } + + public Task> ItemsTexts => Items.AllTextContentsAsync(); + + public async Task SelectValue(params string[] elements) + { + await Locator.ClickAsync(); + foreach (var element in elements) + { + var optionToClick = GetOption(element); + await optionToClick.ClickAsync(); + } + } + + public ILocator GetOption(string option) + { + return Items.Filter(new LocatorFilterOptions {HasTextString = option}); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/IDropdownWrapper.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/IDropdownWrapper.cs new file mode 100644 index 00000000..a8e90f07 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/IDropdownWrapper.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.WebElementsWrappers.Interface; + +public interface IDropdownWrapper: IWebElementWrapper +{ + public ILocator Items { get; set; } + + public Task> ItemsTexts { get; } + + public Task SelectValue(params string[] elements); + + public ILocator GetOption(string option); +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/ITableWrapper.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/ITableWrapper.cs new file mode 100644 index 00000000..19e6a923 --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/ITableWrapper.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Behavioral.Automation.Playwright.Services.ElementSelectors; +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.WebElementsWrappers.Interface; + +public interface ITableWrapper: IWebElementWrapper +{ + public ILocator Rows { get; set; } + + public ElementSelector CellsSelector { get; set; } + + public ILocator? HeaderCells { get; set; } + + public ILocator GetCellsForRow(ILocator row); + + //public Task> HeaderCellsTextAsync { get; } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/IWebElementWrapper.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/IWebElementWrapper.cs new file mode 100644 index 00000000..2c35e83c --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/Interface/IWebElementWrapper.cs @@ -0,0 +1,13 @@ +using Behavioral.Automation.Playwright.Context; +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.WebElementsWrappers.Interface; + +public interface IWebElementWrapper +{ + public WebContext WebContext { get; } + + public string Caption { get;} + + public ILocator Locator { get; } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/TableWrapper.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/TableWrapper.cs new file mode 100644 index 00000000..5f147cca --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/TableWrapper.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Behavioral.Automation.Playwright.Context; +using Behavioral.Automation.Playwright.Services.ElementSelectors; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using Microsoft.Playwright; +using NUnit.Framework; + +namespace Behavioral.Automation.Playwright.WebElementsWrappers; + +public class TableWrapper : WebElementWrapper, ITableWrapper +{ + public TableWrapper(WebContext webContext, + ILocator locator, + ILocator rowLocator, + ElementSelector cellsSelector, + ILocator? headerCellsLocator, + string caption) : + base(webContext, locator, caption) + { + Rows = rowLocator; + CellsSelector = cellsSelector; + HeaderCells = headerCellsLocator; + } + + public ILocator Rows { get; set; } + + public ElementSelector CellsSelector { get; set; } + + public ILocator? HeaderCells { get; set; } + + public ILocator GetCellsForRow(ILocator row) + { + var cellSelector = CellsSelector.IdSelector ?? CellsSelector.XpathSelector; + return row.Locator(cellSelector); + } +} \ No newline at end of file diff --git a/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/WebElementWrapper.cs b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/WebElementWrapper.cs new file mode 100644 index 00000000..d4f894ca --- /dev/null +++ b/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/WebElementsWrappers/WebElementWrapper.cs @@ -0,0 +1,19 @@ +using Behavioral.Automation.Playwright.Context; +using Behavioral.Automation.Playwright.Services; +using Behavioral.Automation.Playwright.WebElementsWrappers.Interface; +using Microsoft.Playwright; + +namespace Behavioral.Automation.Playwright.WebElementsWrappers; + +public class WebElementWrapper : IWebElementWrapper +{ + public WebElementWrapper(WebContext webContext, ILocator locator, string caption) + { + WebContext = webContext; + Locator = locator; + Caption = caption; + } + public WebContext WebContext { get; } + public ILocator Locator { get; } + public string Caption { get; } +} \ No newline at end of file diff --git a/Behavioral.Automation.sln b/Behavioral.Automation.sln index 7cc01611..2d341212 100644 --- a/Behavioral.Automation.sln +++ b/Behavioral.Automation.sln @@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp", "src\BlazorApp\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Behavioral.Automation.Playwright", "Behavioral.Automation.Playwright\Behavioral.Automation.Playwright\Behavioral.Automation.Playwright.csproj", "{F1B23009-3334-4B1B-8198-2C618346062D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Behavioral.Automation.Configs", "Behavioral.Automation.Playwright\Behavioral.Automation.Configs\Behavioral.Automation.Configs.csproj", "{7460A60F-85B2-4DCE-B190-000503AE8550}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,6 +48,10 @@ Global {F1B23009-3334-4B1B-8198-2C618346062D}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1B23009-3334-4B1B-8198-2C618346062D}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1B23009-3334-4B1B-8198-2C618346062D}.Release|Any CPU.Build.0 = Release|Any CPU + {7460A60F-85B2-4DCE-B190-000503AE8550}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7460A60F-85B2-4DCE-B190-000503AE8550}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7460A60F-85B2-4DCE-B190-000503AE8550}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7460A60F-85B2-4DCE-B190-000503AE8550}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE