Skip to content

Commit dacd0c2

Browse files
committed
[web-app] Unify steps for cookie management
1 parent 5c9fc13 commit dacd0c2

File tree

26 files changed

+580
-863
lines changed

26 files changed

+580
-863
lines changed

docs/modules/plugins/pages/plugin-web-app.adoc

Lines changed: 1 addition & 211 deletions
Original file line numberDiff line numberDiff line change
@@ -750,217 +750,7 @@ When I select `$option` in dropdown located `$locator`
750750
When I select `Red` in dropdown located by `id(colors)`
751751
----
752752

753-
754-
=== Cookie Steps
755-
756-
==== Validate cookie presence
757-
758-
Validates whether the certain cookie is set.
759-
760-
[source,gherkin]
761-
----
762-
Then cookie with name that $stringComparisonRule `$cookieName` is set
763-
----
764-
* `$stringComparisonRule` - xref:parameters:string-comparison-rule.adoc[String comparison rule].
765-
* `$cookieName` - The name of the cookie to check presence.
766-
767-
.Check the session cookie is present
768-
[source,gherkin]
769-
----
770-
Then cookie with name that is equal to `JSESSIONID` is set
771-
----
772-
773-
==== Validate cookie absence
774-
775-
Validates whether the certain cookie is not set.
776-
777-
[source,gherkin]
778-
----
779-
Then cookie with name that $stringComparisonRule `$cookieName` is not set
780-
----
781-
* `$stringComparisonRule` - xref:parameters:string-comparison-rule.adoc[String comparison rule].
782-
* `$cookieName` - The name of the cookie to check absence.
783-
784-
.Check that Google Analytics cookies are not present
785-
[source,gherkin]
786-
----
787-
Then cookie with name that matches `_ga.*` is not set
788-
----
789-
790-
==== Set cookies
791-
792-
Adds the cookies provided in the input xref:ROOT:glossary.adoc#_examplestable[ExamplesTable]. It's allowed to add the
793-
cookies for the current domain only: make sure the web browser is opened at the
794-
expected domain. The actions performed by the step:
795-
796-
* add the cookies;
797-
* refresh the current page (this action is required to apply the changes in cookies).
798-
799-
[source,gherkin]
800-
----
801-
When I set all cookies for current domain:$parameters
802-
----
803-
* `$parameters` - The parameters of the cookies to set as xref:ROOT:glossary.adoc#_examplestable[ExamplesTable]:
804-
+
805-
[cols="1,2", options="header"]
806-
|===
807-
808-
|Column Name
809-
|Description
810-
811-
|`cookieName`
812-
|the name of the cookie to set
813-
814-
|`cookieValue`
815-
|the value of the cookie to set
816-
817-
|`path`
818-
|the path of the cookie to set
819-
820-
|===
821-
822-
.Set the cookie for the current domain
823-
[source,gherkin]
824-
----
825-
When I set all cookies for current domain:
826-
|cookieName |cookieValue |path |
827-
|cookieAgreed |2 |/ |
828-
----
829-
830-
==== Set cookies without applying changes
831-
832-
Adds the cookies provided in the input xref:ROOT:glossary.adoc#_examplestable[ExamplesTable], but does not apply the
833-
changes in cookies. The current page must be refreshed or the navigation must be performed to apply the cookie changes.
834-
It's allowed to add the cookies for the current domain only: make sure the web browser is opened at the expected domain.
835-
836-
[source,gherkin]
837-
----
838-
When I set all cookies for current domain without applying changes:$parameters
839-
----
840-
* `$parameters` - The parameters of the cookies to set as xref:ROOT:glossary.adoc#_examplestable[ExamplesTable]:
841-
+
842-
[cols="1,2", options="header"]
843-
|===
844-
845-
|Column Name
846-
|Description
847-
848-
|`cookieName`
849-
|the name of the cookie to set
850-
851-
|`cookieValue`
852-
|the value of the cookie to set
853-
854-
|`path`
855-
|the path of the cookie to set
856-
857-
|===
858-
859-
.Set the cookie for the current domain
860-
[source,gherkin]
861-
----
862-
When I set all cookies for current domain without applying changes:
863-
|cookieName |cookieValue |path |
864-
|cookieAgreed |2 |/ |
865-
When I refresh page
866-
----
867-
868-
==== Get cookie value
869-
870-
Finds the cookie by the name and saves its value to a variable.
871-
872-
[source,gherkin]
873-
----
874-
When I save value of cookie with name `$cookieName` to $scopes variable `$variableName`
875-
----
876-
* `$cookieName` - The name of the cookie to save the value.
877-
* `$scopes` - xref:commons:variables.adoc#_scopes[The comma-separated set of the variables scopes].
878-
* `$variableName` - The variable name to save the cookie value.
879-
880-
.Get the value of the session cookie
881-
[source,gherkin]
882-
----
883-
When I save value of cookie with name `JSESSIONID` to scenario variable `session-id`
884-
----
885-
886-
==== Get cookie
887-
888-
Finds the cookie by the name and saves all its parameters as JSON to a variable.
889-
890-
[source,gherkin]
891-
----
892-
When I save cookie with name `$cookieName` as JSON to $scopes variable `$variableName`
893-
----
894-
* `$cookieName` - The name of the cookie to save.
895-
* `$scopes` - xref:commons:variables.adoc#_scopes[The comma-separated set of the variables scopes].
896-
* `$variableName` - The variable name to save the cookie.
897-
898-
.Get the session cookie
899-
[source,gherkin]
900-
----
901-
When I save cookie with name `JSESSIONID` as JSON to scenario variable `session-id`
902-
----
903-
904-
==== Remove cookie
905-
906-
Removes the certain cookie from the current domain. The actions performed by the step:
907-
908-
* remove the certain cookie the from current domain;
909-
* refresh the current page (this action is required to apply the changes in cookies).
910-
911-
[source,gherkin]
912-
----
913-
When I remove cookie with name `$cookieName` from current domain
914-
----
915-
* `$cookieName` - The name of the cookie to remove.
916-
917-
.Remove the session cookie
918-
[source,gherkin]
919-
----
920-
When I remove cookie with name `JSESSIONID` from current domain
921-
----
922-
923-
==== Remove cookie without applying changes
924-
925-
Removes the certain cookie from the current domain, but does not apply the
926-
changes in cookies. The current page must be refreshed or the navigation must
927-
be performed to apply the cookie changes.
928-
929-
[source,gherkin]
930-
----
931-
When I remove cookie with name `$cookieName` from current domain without applying changes
932-
----
933-
* `$cookieName` - The name of the cookie to remove.
934-
935-
.Remove the session cookie
936-
[source,gherkin]
937-
----
938-
When I remove cookie with name `JSESSIONID` from current domain without applying changes
939-
When I refresh page
940-
----
941-
942-
==== Remove all cookies
943-
944-
Removes all cookies from the current domain. The actions performed by the step:
945-
946-
* remove all cookies from the current domain;
947-
* refresh the current page (this action is required to apply the changes in cookies).
948-
949-
[source,gherkin]
950-
----
951-
When I remove all cookies from current domain
952-
----
953-
954-
==== Remove all cookies without applying changes
955-
956-
Removes all cookies from the current domain, but does not apply the changes in
957-
cookies. The current page must be refreshed or the navigation must be performed
958-
to apply the cookie changes.
959-
960-
[source,gherkin]
961-
----
962-
When I remove all cookies from current domain without applying changes
963-
----
753+
include::plugins:partial$web-cookie-steps.adoc[]
964754

965755
include::plugins:partial$web-storage-steps.adoc[]
966756

docs/modules/plugins/partials/web-cookie-steps.adoc

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ Then cookie with name that matches `_ga.*` is not set
3636

3737
==== Set cookies
3838

39-
Adds the cookies provided in the input xref:ROOT:glossary.adoc#_examplestable[ExamplesTable].
39+
Adds the cookies provided in the input xref:ROOT:glossary.adoc#_examplestable[ExamplesTable]. It's allowed to add the
40+
cookies for the current domain only: make sure the web browser is opened at the
41+
expected domain. The actions performed by the step:
42+
43+
* add the cookies;
44+
* refresh the current page (this action is required to apply the changes in cookies).
4045

4146
[source,gherkin]
4247
----
@@ -69,6 +74,44 @@ When I set all cookies for current domain:
6974
|cookieAgreed |2 |/ |
7075
----
7176

77+
==== Set cookies without applying changes
78+
79+
Adds the cookies provided in the input xref:ROOT:glossary.adoc#_examplestable[ExamplesTable], but does not apply the
80+
changes in cookies. The current page must be refreshed or the navigation must be performed to apply the cookie changes.
81+
It's allowed to add the cookies for the current domain only: make sure the web browser is opened at the expected domain.
82+
83+
[source,gherkin]
84+
----
85+
When I set all cookies for current domain without applying changes:$parameters
86+
----
87+
* `$parameters` - The parameters of the cookies to set as xref:ROOT:glossary.adoc#_examplestable[ExamplesTable]:
88+
+
89+
[cols="1,2", options="header"]
90+
|===
91+
92+
|Column Name
93+
|Description
94+
95+
|`cookieName`
96+
|the name of the cookie to set
97+
98+
|`cookieValue`
99+
|the value of the cookie to set
100+
101+
|`path`
102+
|the path of the cookie to set
103+
104+
|===
105+
106+
.Set the cookie for the current domain
107+
[source,gherkin]
108+
----
109+
When I set all cookies for current domain without applying changes:
110+
|cookieName |cookieValue |path |
111+
|cookieAgreed |2 |/ |
112+
When I refresh page
113+
----
114+
72115
==== Get cookie value
73116

74117
Finds the cookie by the name and saves its value to a variable.
@@ -107,7 +150,10 @@ When I save cookie with name `JSESSIONID` as JSON to scenario variable `session-
107150

108151
==== Remove cookie
109152

110-
Removes the certain cookie from the current domain.
153+
Removes the certain cookie from the current domain. The actions performed by the step:
154+
155+
* remove the certain cookie the from current domain;
156+
* refresh the current page (this action is required to apply the changes in cookies).
111157

112158
[source,gherkin]
113159
----
@@ -121,11 +167,44 @@ When I remove cookie with name `$cookieName` from current domain
121167
When I remove cookie with name `JSESSIONID` from current domain
122168
----
123169

170+
==== Remove cookie without applying changes
171+
172+
Removes the certain cookie from the current domain, but does not apply the
173+
changes in cookies. The current page must be refreshed or the navigation must
174+
be performed to apply the cookie changes.
175+
176+
[source,gherkin]
177+
----
178+
When I remove cookie with name `$cookieName` from current domain without applying changes
179+
----
180+
* `$cookieName` - The name of the cookie to remove.
181+
182+
.Remove the session cookie
183+
[source,gherkin]
184+
----
185+
When I remove cookie with name `JSESSIONID` from current domain without applying changes
186+
When I refresh page
187+
----
188+
124189
==== Remove all cookies
125190

126-
Removes all cookies from the current domain.
191+
Removes all cookies from the current domain. The actions performed by the step:
192+
193+
* remove all cookies from the current domain;
194+
* refresh the current page (this action is required to apply the changes in cookies).
127195

128196
[source,gherkin]
129197
----
130198
When I remove all cookies from current domain
131199
----
200+
201+
==== Remove all cookies without applying changes
202+
203+
Removes all cookies from the current domain, but does not apply the changes in
204+
cookies. The current page must be refreshed or the navigation must be performed
205+
to apply the cookie changes.
206+
207+
[source,gherkin]
208+
----
209+
When I remove all cookies from current domain without applying changes
210+
----

0 commit comments

Comments
 (0)