Skip to content

Commit

Permalink
Update syntax for "When I go to the relative URL '$relativeURL'" step
Browse files Browse the repository at this point in the history
  • Loading branch information
vkepin committed Jan 5, 2023
1 parent b147549 commit 3c69425
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 4 deletions.
44 changes: 44 additions & 0 deletions docs/modules/plugins/partials/plugin-web-app-steps.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 <i>relative URL</i> step variable
* <br>
* A <b>relative URL</b> - points to a file within a web site (like <i>'about.html'</i> or <i>'/products'</i>)<br>
* A <b>relative URL</b> - points to a file within a web site
* (like <i>'about.html'</i> or <i>'/products'</i>)<br>
* <p>
* <table border="1">
* <caption>Examples:</caption>
* <tr>
* <td>Current page</td><td>Relative URL parameter</td><td>Opened page</td>
* </tr>
* <tr>
* <td>https://mysite.com/path/foo</td><td>stats</td><td>https://mysite.com/path/stats</td>
* </tr>
* <tr>
* <td>https://mysite.com/path/foo</td><td>/documents</td><td>https://mysite.com/documents</td>
* </tr>
* </table>
* <p>
* Actions performed at this step:
* <ul>
Expand All @@ -248,7 +263,7 @@ public void isPageScrolledToAnElement(Locator locator)
* <p>
* @param relativeURL A string value of the relative URL
*/
@When("I go to the relative URL '$relativeURL'")
@When("I go to relative URL `$relativeURL`")
public void iGoTo(String relativeURL)
{
setContextSteps.switchingToDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,7 @@ When I wait until element located by `<locator>` contains text `<text>'
Composite: Then element located '$locator' disappears in '$timeout'
!-- WARNING: The step "Then element located '$locator' disappears in '$timeout'" is deprecated and will be removed in VIVIDUS 0.6.0
Then element located by `<locator>` disappears in `<timeout>`

Composite: When I go to the relative URL '$relativeURL'
!-- WARNING: The step "When I go to the relative URL '$relativeURL'" is deprecated and will be removed in VIVIDUS 0.7.0
When I go to relative URL `<relativeURL>`
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ Examples:
|DNS_LOOKUP_TIME |
|DOM_CONTENT_LOAD_TIME|
|PAGE_LOAD_TIME |

Scenario: Verify step: When I go to relative URL `$relativeURL`
Given I am on a page with the URL '${vividus-test-site-url}'
When I go to relative URL `/elementState.html`
Then number of elements found by `id(element-to-hide)` is equal to `1`

Scenario: Verify deprecated step: When I go to the relative URL '$relativeURL'
Given I am on a page with the URL '${vividus-test-site-url}'
When I go to the relative URL '/elementState.html'
Then number of elements found by `id(element-to-hide)` is equal to `1`

0 comments on commit 3c69425

Please sign in to comment.