From 135cc72670ac08e3d2fecae76ab38947fe5dbc2f Mon Sep 17 00:00:00 2001 From: Andrey Brovko Date: Fri, 13 May 2022 16:56:53 +0300 Subject: [PATCH 1/3] NavigationBinding: Improve "user opens relative URL" step --- CHANGELOG.md | 4 ++++ src/Behavioral.Automation/Behavioral.Automation.csproj | 2 +- src/Behavioral.Automation/Bindings/NavigationBInding.cs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf6b88f9..c1f2280c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ 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.9.4] - 2022-05-13 +### Changed +- Improve "user opens relative URL" step + [1.9.3] - 2022-05-12 ### Changed - Fix table rows count assertion message. diff --git a/src/Behavioral.Automation/Behavioral.Automation.csproj b/src/Behavioral.Automation/Behavioral.Automation.csproj index de377920..8c8a4b71 100644 --- a/src/Behavioral.Automation/Behavioral.Automation.csproj +++ b/src/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.9.3 + 1.9.4 https://github.com/quantori/Behavioral.Automation true true diff --git a/src/Behavioral.Automation/Bindings/NavigationBInding.cs b/src/Behavioral.Automation/Bindings/NavigationBInding.cs index 2aecd74e..ea1f6e27 100644 --- a/src/Behavioral.Automation/Bindings/NavigationBInding.cs +++ b/src/Behavioral.Automation/Bindings/NavigationBInding.cs @@ -56,7 +56,7 @@ public void NavigateToBaseUrl() [When("user opens relative URL \"(.*)\"")] public void NavigateToRelativeUrl([NotNull] string url) { - _driverService.NavigateToRelativeUrl(url); + _driverService.Navigate(ConfigServiceBase.BaseUrl + url); } /// From 347f16d7cb6ad5009afddc7d7b1f1697299d82ff Mon Sep 17 00:00:00 2001 From: Andrey Brovko Date: Fri, 13 May 2022 17:23:07 +0300 Subject: [PATCH 2/3] NavigationBinding updated. --- .../Bindings/NavigationBInding.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Behavioral.Automation/Bindings/NavigationBInding.cs b/src/Behavioral.Automation/Bindings/NavigationBInding.cs index ea1f6e27..c731134c 100644 --- a/src/Behavioral.Automation/Bindings/NavigationBInding.cs +++ b/src/Behavioral.Automation/Bindings/NavigationBInding.cs @@ -33,7 +33,12 @@ public NavigationBinding([NotNull] IDriverService driverService, [When("user opens URL \"(.*)\"")] public void Navigate([NotNull] string url) { - _driverService.Navigate(url); + if(IsAbsoluteUrl(url)) + { + _driverService.Navigate(url); + return; + } + _driverService.Navigate(ConfigServiceBase.BaseUrl + url); } /// @@ -56,7 +61,7 @@ public void NavigateToBaseUrl() [When("user opens relative URL \"(.*)\"")] public void NavigateToRelativeUrl([NotNull] string url) { - _driverService.Navigate(ConfigServiceBase.BaseUrl + url); + _driverService.NavigateToRelativeUrl(ConfigServiceBase.BaseUrl + url); } /// @@ -136,5 +141,10 @@ public void ReloadCurrentPage() { _driverService.Refresh(); } + + private static bool IsAbsoluteUrl(string url) + { + return Uri.IsWellFormedUriString(url, UriKind.Absolute); + } } } \ No newline at end of file From 4bf9fa78fe848376f072c939ea1d8e3e503d1fb2 Mon Sep 17 00:00:00 2001 From: Andrey Brovko Date: Fri, 13 May 2022 17:27:19 +0300 Subject: [PATCH 3/3] NavigateToRelativeUrl fix --- src/Behavioral.Automation/Bindings/NavigationBInding.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Behavioral.Automation/Bindings/NavigationBInding.cs b/src/Behavioral.Automation/Bindings/NavigationBInding.cs index c731134c..5cda7438 100644 --- a/src/Behavioral.Automation/Bindings/NavigationBInding.cs +++ b/src/Behavioral.Automation/Bindings/NavigationBInding.cs @@ -61,7 +61,7 @@ public void NavigateToBaseUrl() [When("user opens relative URL \"(.*)\"")] public void NavigateToRelativeUrl([NotNull] string url) { - _driverService.NavigateToRelativeUrl(ConfigServiceBase.BaseUrl + url); + _driverService.NavigateToRelativeUrl(url); } ///