UNPKG

6.47 kBMarkdownView Raw
1## Step Definitions
2
3Note that the words in italics are optional.
4
5### Given...
6
7| Step definition | Snippet Code | Notes |
8| --- | --- | --- |
9| I am on the 'PAGE_NAME' page | givenonpage | PAGE_NAME should match the name of the page object file in your pages directory but use spaces instead of dashes and use lowercase for your page object file names with dash separating (kebab-case). This step definition sets the current page object |
10| the page url is 'URL' | givenpageurl | |
11| the page url is not 'URL' | givennotpageurl | |
12| animations are disabled | givendisableAnimations | |
13| _the_ 'LOCATOR' is visible | givenvisible | |
14| _the_ 'LOCATOR' is hidden | givenhidden | |
15| _the_ 'LOCATOR' is enabled | givenenabled | |
16| _the_ 'LOCATOR' is disabled | givendisabled | |
17| _the_ 'LOCATOR' is selected | givenselected | |
18| _the_ 'LOCATOR' is not selected | givennotselected | |
19| _the_ 'LOCATOR' is checked | givenchecked | |
20| _the_ 'LOCATOR' is not checked | givennotchecked | |
21| _the_ 'LOCATOR' is on the page | givenexists | |
22| _the_ 'LOCATOR' is not on the page | givennotexists | |
23| the title is 'STRING' | giventitle | |
24| the title is not 'STRING' | givennottitle | |
25| _the_ 'LOCATOR' contains the text 'STRING' | givencontainstext | |
26| _the_ 'LOCATOR' does not contain the text 'STRING' | givennotcontainstext | |
27| _the_ 'LOCATOR' contains any text | givencontainsanytext | |
28| _the_ 'LOCATOR' does not contain any text | givennotcontainsanytext | |
29| _the_ 'LOCATOR' has an attribute 'ATTRIBUTE_NAME' with a value of 'VALUE' | givenattribute | |
30| _the_ 'LOCATOR' is empty | givenempty | |
31| _the_ 'LOCATOR' is not empty | givennotempty | |
32| the value of _the_ 'LOCATOR' is 'VALUE' | givenvalue | |
33| the value of _the_ 'LOCATOR' is not 'VALUE' | givennotvalue | |
34| I set the cookie 'COOKIE_NAME' with value 'VALUE' | givensetcookie | |
35| the cookie 'COOKIE_NAME' is set to 'VALUE' | givencookie | |
36| the cookie 'COOKIE_NAME' is not set to 'VALUE' | givennotcookie | |
37| the cookie 'COOKIE_NAME' is set | givencookieset | |
38| the cookie 'COOKIE_NAME' is not set | givennotcookieset | |
39
40### When...
41
42| Step definition | Snippet Code | Notes |
43| --- | --- | --- |
44| I click _the_ 'LOCATOR' | whenclick | |
45| I append 'STRING' to 'LOCATOR' | whenappend | |
46| I set 'LOCATOR' to 'STRING' | whenset | |
47| I append 'STRING' to react field 'LOCATOR' | whenappendreact | |
48| I set react field 'LOCATOR' to 'STRING' | whensetreact | |
49| I submit the _form_ 'LOCATOR' | whensubmit | |
50| I press 'KEY' | whenkey | |
51| I clear _the_ 'LOCATOR' | whenclear | |
52| I select the option for select element 'LOCATOR' with the text 'VALUE' | whenoption | |
53
54### Then...
55
56| Step definition | Snippet Code | Notes |
57| --- | --- | --- |
58| I expect to be on the 'PAGE_NAME' page | thenonpage | This step does 2 things: it changes the current page object so that any subsequent steps will use locators / selectors / XPaths from the PAGE_NAME page object, and then asserts the URL from that new page object if it exists. |
59| I expect the url to contain 'STRING' | thenurlcontains | Using this just checks the URL, it does not change the page object so should not be used for end to end testing unless it is the final step |
60| I expect the url to be 'STRING' | thenurl | Using this just checks the URL, it does not change the page object so should not be used for end to end testing unless it is the final step |
61| I expect the url to not be 'STRING' | thennoturl | Using this just checks the URL, it does not change the page object so should not be used for end to end testing unless it is the final step |
62| I expect the url 'URL' is opened in a new tab | thenurlnewtab | |
63| I expect _the_ 'LOCATOR' to be visible | thenvisible | |
64| I expect _the_ 'LOCATOR' to be hidden | thenhidden | |
65| I expect the (bottom OR top OR left OR right)* border colour of the 'LOCATOR' to be 'STRING' | thenbordercolour | Pick a side (bottom, top, left, or right) or remove the expected side. |
66| I expect the colour of the 'LOCATOR' to be 'STRING' | thencolour | |
67| I expect the background colour of the 'LOCATOR' to be 'STRING' | thenbackgroundcolour | |
68| I expect the title to be 'STRING' | thentitle | |
69| I expect the title to not be 'STRING' | thennottitle | |
70| I expect _the_ 'LOCATOR' to contain the text 'STRING' | thencontainstext | |
71| I expect _the_ 'LOCATOR' to not contain the text 'STRING' | thennotcontainstext | |
72| I expect _the_ 'LOCATOR' to contain any text | thencontainsanytext | |
73| I expect _the_ 'LOCATOR' to not contain any text | thennotcontainsanytext | |
74| I expect _the_ 'LOCATOR' to appear exactly 'NUMBER' times | thenappearexactly | |
75| I expect _the_ 'LOCATOR' to not appear exactly 'NUMBER' times | thennotappearexactly | |
76| I expect _the_ 'LOCATOR' to exist | thenexists | |
77| I expect _the_ 'LOCATOR' to not exist | thennotexists | |
78| I expect _the_ 'LOCATOR' to be checked | thenchecked | |
79| I expect _the_ 'LOCATOR' to not be checked | thennotchecked | |
80| I expect _the_ 'LOCATOR' to be selected | thenselected | |
81| I expect _the_ 'LOCATOR' to not be selected | thennotselected | |
82| I expect _the_ 'LOCATOR' to be enabled | thenenabled | |
83| I expect _the_ 'LOCATOR' to be disabled | thendisabled | |
84| I expect cookie 'COOKIE_NAME' to contain 'STRING' | thencookiecontain | |
85| I expect cookie 'COOKIE_NAME' to not contain 'STRING' | thennotcookiecontain | |
86| I expect cookie 'COOKIE_NAME' to exist | thencookieexists | |
87| I expect cookie 'COOKIE_NAME' to not exist | thennotcookieexists | |
88| I expect _the_ 'LOCATOR' to have the class 'CLASS_NAME' | thenclassname | |
89| I expect _the_ 'LOCATOR' to not have the class 'CLASS_NAME' | thennotclassname | |
90| I expect _the_ 'LOCATOR' to be focused | thenfocused | |
91| I expect _the_ 'LOCATOR' to be empty | thenempty | |
92| I expect _the_ 'LOCATOR' to not be empty | thennotempty | |
93| I expect the value of _the_ 'LOCATOR' to be 'STRING' | thenvalue | Used for getting the value of an input |
94| I expect the value of _the_ 'LOCATOR' to not be 'STRING' | thennotvalue | Used for getting the value of an input |
95| I expect _the_ 'LOCATOR' has an attribute 'ATTRIBUTE_NAME' with a value of 'VALUE' | thenattribute | |
96| take a screenshot | thenscreenshot | |
97| fail step and take screenshot | thendie | |
\No newline at end of file