Skip to content

Commit

Permalink
documentation : property uage
Browse files Browse the repository at this point in the history
  • Loading branch information
bcivel committed Sep 19, 2024
1 parent cc9af03 commit 000ce2e
Show file tree
Hide file tree
Showing 25 changed files with 337 additions and 5 deletions.
18 changes: 13 additions & 5 deletions source/src/main/resources/documentation/D3/documentation_en.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,24 @@ We are happy to welcome new contributors!
=================================================

---
= Execution Use Case
:file-to-include: howto_exe_{lang}.adoc
= Manage property on Testcase

:file-to-include: howto_property_{lang}.adoc
include::include/{lang}/{file-to-include}[]

link:{repo-url}/{file-to-include}[image:edit-doc.png[FR,20,20]^] _{contribution-message}_
== Use static string (text)
:file-to-include: howto_property_text_static_{lang}.adoc
include::include/{lang}/{file-to-include}[]

== From SaaS Instance to my local Selenium/Appium installation
:file-to-include: howto_exe_localexecution_{lang}.adoc
== Generate random string with defined length (text)
:file-to-include: howto_property_text_random_{lang}.adoc
include::include/{lang}/{file-to-include}[]

== Get information from Web Page (getFromHTML)
:file-to-include: howto_property_html_{lang}.adoc
include::include/{lang}/{file-to-include}[]


link:{repo-url}/{file-to-include}[image:edit-doc.png[FR,20,20]^] _{contribution-message}_

---
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Variabilizing data is essential for building robust and efficient automated test. It provide Flexibility, Reusability and Maintainability :

** *Dynamic Data:* Imagine you have a test that checks that different user can login. Instead of hardcoding each steps, you can use variables and use the same step without rewriting the entire test script.

** *Multiple Scenarios:* You can use variables to run the same test with different inputs, like different user names, passwords, or product IDs. This helps you cover a wider range of scenarios without creating separate tests for each variation.

** *Clearer Scenarios:* Variables make your test scripts more readable. Instead of seeing hardcoded values scattered throughout, you have meaningful names like username , password , or product_id . This makes it easier to understand what the test is doing.

** *Easy Updates:* If you need to change a value, you only need to update the variable definition, not every place it's used in the test. This saves time and reduces the risk of errors.
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@

=== Get value from HTML Element

==== Get value from first HTML Element

This property type retrieves the value from the first HTML element that matches a specified selector. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns its value. If no element is found, it returns NA, could not find . This function is useful for quickly accessing form inputs or text content from the first occurrence of a specific HTML element in the document.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Value* option
*** Nature : Choose *Static* option
*** Rank : Keep *0*
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_value_static_0.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

==== Get value from specific HTML Element

This property type retrieves the value from a specific HTML element (defined in rank field) that matches a specified selector. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns its value. If no element is found, it returns NA, could not find . This function is useful for quickly accessing form inputs or text content from a specific HTML element in the document.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Value* option
*** Nature : Choose *Static* option
*** Rank : Put an Integer, which is the element number that is retrieved
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_value_static_n.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

==== Get value from random HTML Element

This property type retrieves the value from a random HTML element (defined in rank field) that matches a specified selector. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns its value. If no element is found, it returns NA, could not find . This function is useful for quickly accessing form inputs or text content from a random HTML element matching criteria in the document.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Value* option
*** Nature : Choose *Random* option
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_value_random.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

=== Get raw element from HTML

==== Get raw element from first HTML Element

This property type retrieves the raw HTML element from the first HTML element that matches a specified selector. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns the HTML code of the element as a string. If no element is found, it returns NA, could not find . This function is useful for inspecting the structure of an HTML element and extracting the HTML code for further processing.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Raw* option
*** Nature : Choose *Static* option
*** Rank : Keep 0
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_raw_static_0.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

==== Get raw element from specific HTML Element

This property type retrieves the raw HTML element from a specific HTML element (defined in rank field) that matches a specified selector. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns the HTML code of the element as a string. If no element is found, it returns NA, could not find . This function is useful for inspecting the structure of a specific HTML element and extracting the HTML code for further processing.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Raw* option
*** Nature : Choose *Static* option
*** Rank : Put an Integer, which is the element number that is retrieved
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_raw_static_n.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

==== Get raw element from random HTML Element

This property type retrieves the raw HTML element from a random HTML element (defined in rank field) that matches a specified selector. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns the HTML code of the element as a string. If no element is found, it returns NA, could not find . This function is useful for inspecting the structure of a random HTML element matching criteria and extracting the HTML code for further processing.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Raw* option
*** Nature : Choose *Random* option
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_raw_random.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

=== Get position of HTML element

==== Get position of first HTML Element

This property type retrieves the position (x,y) in pixel of the first HTML element that matches a specified selector, relative to the top left corner of the browser window. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns a tuple containing the x and y coordinates of the top-left corner of the element. If no element is found, it returns NA, could not find . This function is useful for determining the location of an element on the page and for interacting with it programmatically.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Coordinate* option
*** Nature : Choose *Static* option
*** Rank : Keep 0
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_coord_static_0.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

==== Get position of specific HTML Element

This property type retrieves the position (x,y) in pixel of a specific HTML element (defined in rank field) that matches a specified selector, relative to the top left corner of the browser window. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns a tuple containing the x and y coordinates of the top-left corner of the element. If no element is found, it returns NA, could not find . This function is useful for determining the location of a specific element on the page and for interacting with it programmatically.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Coordinate* option
*** Nature : Choose *Static* option
*** Rank : Put an Integer, which is the element number that is retrieved
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_coord_static_n.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

==== Get position of random HTML Element

This property type retrieves the position (x,y) in pixel of a random HTML element (defined in rank field) that matches a specified selector, relative to the top left corner of the browser window. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns a tuple containing the x and y coordinates of the top-left corner of the element. If no element is found, it returns NA, could not find . This function is useful for determining the location of a random element matching criteria on the page and for interacting with it programmatically.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Coordinate* option
*** Nature : Choose *Random* option
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_coord_random.png[Logo]

2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

=== Get attribute of HTML element

==== Get attribute of first HTML Element

This property type retrieves the value of a specific attribute from the first HTML element that matches a specified selector. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns the value of the specified attribute. If no element is found or the attribute is not found, it returns NA, could not find . This function is useful for accessing specific attributes of HTML elements, such as the 'href' attribute of a link or the 'src' attribute of an image.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Attribute* option
*** Nature : Choose Static option
*** Rank : Keep 0
*** Attribute Name : Put the attibute name
*** Value : Put the xpath (or any identifier) to retrieve the element *** Attribute : Put the attribute name to retrieve

image:property_html_attribute_static_0.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

==== Get attribute of specific HTML Element

This property type retrieves the value of a specific attribute from a specific HTML element (defined in rank field) that matches a specified selector. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns the value of the specified attribute. If no element is found or the attribute is not found, it returns NA, could not find . This function is useful for accessing specific attributes of a specific HTML element, such as the 'href' attribute of a link or the 'src' attribute of an image.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Attribute* option
*** Nature : Choose *Static* option
*** Rank : Put an Integer, which is the element number that is retrieved
*** Attribute Name : Put the attibute name
*** Value : Put the xpath (or any identifier) to retrieve the element *** Attribute : Put the attribute name to retrieve

image:property_html_attribute_static_n.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

==== Get attribute of random HTML Element

This property type retrieves the value of a specific attribute from a random HTML element that matches a specified selector. It takes an id, class, name, or any xpath as an argument, searches the DOM for the first matching element, and returns the value of the specified attribute. If no element is found or the attribute is not found, it returns NA, could not find . This function is useful for accessing specific attributes of a random HTML element matching criteria, such as the 'href' attribute of a link or the 'src' attribute of an image.

* 1 - Define a property

*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Attribute* option
*** Nature : Choose *Random* option
*** Attribute Name : Put the attibute name
*** Value : Put the xpath (or any identifier) to retrieve the element *** Attribute : Put the attribute name to retrieve

image:property_html_attribute_random.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

=== Get number of HTML element found

This property type retrieves the number of HTML elements found on the page that match a specified selector. It takes an id, class, name, or any xpath as an argument and returns the number of matching elements. If no element is found, it returns 0. This function is useful for determining the number of elements on the page that meet specific criteria, such as the number of links on a page or the number of images in a specific section.

* 1 - Define a property
*** Type : Choose *getFromHtml* option
*** Element Type : Choose *Count* option
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_count.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

=== Get table of value of all HTML element found

This property type retrieves the values of all HTML elements found on the page that match a specified selector and returns them as a table. It takes an id, class, name, or any xpath as an argument, searches the DOM for all matching elements, and returns a table where each row represents a found element and each column represents a specific attribute of that element. If no element is found, it returns an empty table. This function is useful for extracting data from a list of elements, such as the text content of all links on a page or the image URLs of all images in a gallery.

* 1 - Define a property
*** Type : Choose getFromHtml option
*** Element Type : Choose *Value List* option
*** Value : Put the xpath (or any identifier) to retrieve the element


image:property_html_valuelist.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

=== Get all HTML element found in raw format

This property type retrieves all HTML elements found on the page that match a specified selector and returns them as a list of strings. It takes an id, class, name, or any xpath as an argument, searches the DOM for all matching elements, and returns a list containing the raw HTML code of each element. If no element is found, it returns an empty list. This function is useful for inspecting the structure of all matching elements and for extracting the HTML code for further processing.

* 1 - Define a property
*** Type : Choose getFromHtml option
*** Element Type : Choose *Raw List* option
*** Value : Put the xpath (or any identifier) to retrieve the element

image:property_html_rawlist.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
In case you need to generate a random String

=== Generate random String with any alpha numeric characters

* 1 - Define a Random property

*** Type : Choose *text* option
*** Nature : Choose *Random* option
*** Length : Define the number of character you want to retrieve
*** Value : Keep empty

image:property_text_random.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_random_action.png[Logo]

=== Generate random String with specific alpha numeric characters

* 1 - Define a Random property

*** Type : Choose *text* option
*** Nature : Choose *Random* option
*** Length : Define the number of character you want to retrieve
*** Value : Put the characters that will be used to generate random string (case sensitive)

image:property_text_random2.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_random_action.png[Logo]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
You may have to use same step implementation with different data on different context (country for exemple). Or re-use the same step on other testcase (See how to add a Step in Library)

=== Generate static String

* 1 - Define a Static property

*** Type : Choose *text* option
*** Nature : Choose *Static* option
*** Value : Put the String you want to retreive

image:property_text_static.png[Logo]

* 2 - Then, use in in the scenario

image:property_text_static_action.png[Logo]

0 comments on commit 000ce2e

Please sign in to comment.