From 3c694252a32cf1a4323cd37741fb872b9f6d4add Mon Sep 17 00:00:00 2001 From: Vitali Kepin Date: Mon, 2 Jan 2023 13:55:10 +0100 Subject: [PATCH] Update syntax for "When I go to the relative URL '$relativeURL'" step --- .../partials/plugin-web-app-steps.adoc | 44 +++++++++++++++++++ .../org/vividus/steps/ui/web/PageSteps.java | 23 ++++++++-- .../resources/steps/defaults/composite.steps | 4 ++ .../story/integration/PageStepsTests.story | 10 +++++ 4 files changed, 77 insertions(+), 4 deletions(-) diff --git a/docs/modules/plugins/partials/plugin-web-app-steps.adoc b/docs/modules/plugins/partials/plugin-web-app-steps.adoc index 2eed18ef49..e2042936c6 100644 --- a/docs/modules/plugins/partials/plugin-web-app-steps.adoc +++ b/docs/modules/plugins/partials/plugin-web-app-steps.adoc @@ -2,6 +2,50 @@ :popup-alert: https://www.w3schools.com/js/js_popup.asp :close-spec: https://w3c.github.io/webdriver/webdriver-spec.html#close-window[close] +=== Steps opening pages + +==== Open page with relative URL + +Navigates the browser to the specific path in the current host defined in the _relative URL_ step variable. + +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. + +.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/stats + +|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 8ab912d48b..aa726a9d47 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 @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 the original author or authors. + * Copyright 2019-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -236,9 +236,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: *