diff --git a/docs/modules/plugins/partials/plugin-web-app-steps.adoc b/docs/modules/plugins/partials/plugin-web-app-steps.adoc index 69256dfa54..c933582ef1 100644 --- a/docs/modules/plugins/partials/plugin-web-app-steps.adoc +++ b/docs/modules/plugins/partials/plugin-web-app-steps.adoc @@ -2,7 +2,7 @@ :popup-alert: https://www.w3schools.com/js/js_popup.asp :close-spec: https://w3c.github.io/webdriver/webdriver-spec.html#close-window[close] -=== Page steps +=== Steps opening pages ==== Open main application page @@ -36,6 +36,54 @@ Given I am on page with URL `$pageURL` Given I am on page with URL `https://docs.vividus.dev/` ---- +==== Open page with relative URL + +Navigates the browser to the specific path in the current host defined in the _relative URL_ step parameter. + +A relative URL can point to a file within a web site (like `about.html` or `/products`). + +- If the parameter starts with '/' char, navigation will be performed from the root of the host, see examples below. +- If the parameter starts without '/' char or with './', navigation will be performed from the current path directory. + +.Examples +|=== +|Current page |Relative URL parameter|Opened page + +|https://mysite.com +|about.html +|https://mysite.com/about.html + +|https://mysite.com +|/products/new +|https://mysite.com/products/new + +|https://mysite.com/path/foo +|stats +|https://mysite.com/path/foo/stats + +|https://mysite.com/path/foo +|./docs/info.html +|https://mysite.com/path/foo/docs/info.html + +|https://mysite.com/path/foo +|/documents +|https://mysite.com/documents +|=== + +[source,gherkin] +---- +When I go to relative URL `$relativeURL` +---- + +* `relativeURL` - A string value of the relative URL + +. Open main application page and then navigate to '/products/new' page on the application host +[source,gherkin] +---- +Given I am on main application page +When I go to relative URL `/products/new` +---- + === Clicking steps ==== Click on element diff --git a/vividus-plugin-web-app/src/main/java/org/vividus/steps/ui/web/PageSteps.java b/vividus-plugin-web-app/src/main/java/org/vividus/steps/ui/web/PageSteps.java index 814c98595e..b12ecf0c5d 100644 --- a/vividus-plugin-web-app/src/main/java/org/vividus/steps/ui/web/PageSteps.java +++ b/vividus-plugin-web-app/src/main/java/org/vividus/steps/ui/web/PageSteps.java @@ -237,9 +237,24 @@ public void isPageScrolledToAnElement(Locator locator) } /** - * Goes to the relative URL + * Navigates the browser to the specific path in the current host + * defined in the relative URL step variable *
- * A relative URL - points to a file within a web site (like 'about.html' or '/products')
+ * A relative URL - points to a file within a web site + * (like 'about.html' or '/products')
+ *

+ * + * + * + * + * + * + * + * + * + * + * + *
Examples:
Current pageRelative URL parameterOpened page
https://mysite.com/path/foostatshttps://mysite.com/path/stats
https://mysite.com/path/foo/documentshttps://mysite.com/documents
*

* Actions performed at this step: *