webship-js 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +43 -32
- package/package.json +1 -1
- package/tests/features/test--then--i-should--not--see-text-in-element.feature +9 -14
- package/tests/features/test--then--i-should--see-text-in-element-by-attr.feature +10 -0
- package/tests/features/test--then--i-should--see-text-in-element.feature +10 -0
- package/tests/features/test--then--i-should-not-see-an-element-by-attr.feature +8 -0
- package/tests/features/test--then--i-should-not-see-an-element.feature +8 -0
- package/tests/features/test--then--i-should-see-an-element-by-attr.feature +8 -0
- package/tests/features/test--then--i-should-see-an-element.feature +6 -6
- package/tests/features/test--then--the-element-should-contain-cssproperty.feature +9 -0
- package/tests/features/test--then--the-element-should-not-contain-cssproperty.feature +10 -0
- package/tests/features/test--when--i-click-link-by-attribute.feature +7 -1
- package/tests/features/test--when--i-fill-in-by-attr.feature +18 -4
- package/tests/features/test--when--i-fill-in-table-by-attr.feature +1 -1
- package/tests/features/test--when--i-fill-in.feature +11 -11
- package/tests/features/test--when--i-select-option-from-dropdownlist-by-attr.feature +16 -0
- package/tests/features/test--when--i-select-option-from-dropdownlist.feature +4 -4
- package/tests/step-definitions/webship.js +221 -53
- package/tests/features/test--then--the-element-should_not-contain-cssproperty.feature +0 -15
package/.gitlab-ci.yml
CHANGED
|
@@ -1,40 +1,51 @@
|
|
|
1
|
-
image:
|
|
1
|
+
image: cimg/base:stable-20.04
|
|
2
2
|
|
|
3
|
+
services:
|
|
4
|
+
- name: selenium/standalone-chrome
|
|
5
|
+
alias: selenium
|
|
6
|
+
|
|
7
|
+
variables:
|
|
8
|
+
CHROME_VERSION: "115.0.5790.110-1"
|
|
9
|
+
CHROME_DRIVER_VERSION: "114.0.5735.90"
|
|
10
|
+
NODE_OPTIONS: "--openssl-legacy-provider"
|
|
11
|
+
|
|
12
|
+
before_script:
|
|
13
|
+
- sudo apt-get update -qq
|
|
14
|
+
- sudo apt-get upgrade -qqy
|
|
15
|
+
- sudo apt-get install -yqq vim links lynx git diffutils htop curl wget p7zip-full unzip zip sed gcc g++ make libfreetype6-dev libaio1 libaio-dev libonig-dev libpng-dev
|
|
16
|
+
- sudo apt-get install -yqq xvfb libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3.0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3
|
|
17
|
+
- curl -sL https://deb.nodesource.com/setup_18.x | sudo bash -
|
|
18
|
+
- sudo apt-get install -y nodejs
|
|
19
|
+
- sudo npm install -g yarn
|
|
20
|
+
- sudo apt-get update
|
|
21
|
+
- sudo apt-get install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless
|
|
22
|
+
- sudo apt-get install -y libu2f-udev
|
|
23
|
+
- sudo apt-get install -y libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
|
|
24
|
+
- wget https://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
|
|
25
|
+
- sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
|
|
26
|
+
- rm google-chrome-stable_${CHROME_VERSION}_amd64.deb
|
|
27
|
+
- wget http://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip
|
|
28
|
+
- unzip chromedriver_linux64.zip
|
|
29
|
+
- sudo chmod +x chromedriver
|
|
30
|
+
- sudo mv chromedriver /usr/bin/
|
|
31
|
+
- rm chromedriver_linux64.zip
|
|
32
|
+
|
|
3
33
|
stages:
|
|
4
|
-
-
|
|
34
|
+
- build
|
|
5
35
|
- test
|
|
6
36
|
|
|
7
|
-
|
|
8
|
-
stage:
|
|
37
|
+
webship-js-build:
|
|
38
|
+
stage: build
|
|
9
39
|
script:
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
- apt-get install -y nodejs yarn
|
|
13
|
-
|
|
14
|
-
# Install Google Chrome and Chromedriver
|
|
15
|
-
- apt-get install -y wget unzip
|
|
16
|
-
- wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
17
|
-
- dpkg -i google-chrome*.deb
|
|
18
|
-
- apt-get -f install -y
|
|
19
|
-
- CHROMEDRIVER_VERSION=$(curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
|
|
20
|
-
- wget -q https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip
|
|
21
|
-
- unzip chromedriver_linux64.zip
|
|
22
|
-
- mv chromedriver /usr/local/bin/
|
|
23
|
-
- chmod +x /usr/local/bin/chromedriver
|
|
24
|
-
|
|
25
|
-
# Install dependencies and run Webpack
|
|
40
|
+
- wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.4.0/selenium-server-4.4.0.jar
|
|
41
|
+
- nohup java -jar selenium-server-4.4.0.jar standalone > selenium.log 2>&1 &
|
|
26
42
|
- yarn install
|
|
27
|
-
-
|
|
43
|
+
- node webship-init -ci circleci -os linux -b chrome
|
|
44
|
+
- export NODE_OPTIONS=--openssl-legacy-provider
|
|
45
|
+
- yarn start &
|
|
28
46
|
- yarn test
|
|
29
47
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
when: always
|
|
35
|
-
paths:
|
|
36
|
-
- selenium/
|
|
37
|
-
variables:
|
|
38
|
-
SELENIUM_REMOTE_URL: http://localhost:8080
|
|
39
|
-
GITLAB_TARGET_SELENIUM_REMOTE_URL: http://localhost:4444/wd/hub
|
|
40
|
-
|
|
48
|
+
only:
|
|
49
|
+
refs:
|
|
50
|
+
- tags
|
|
51
|
+
- branches
|
package/package.json
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
Feature: An example to test whether
|
|
1
|
+
Feature: An example to test whether the input text does not contain a specific value by its attribute
|
|
2
2
|
As a tester
|
|
3
|
-
I want to be able to check an
|
|
4
|
-
|
|
5
|
-
Scenario: Check an element if it contains a specific text
|
|
6
|
-
Given I am on "/test--then--i-should--not--see-text-in-element.html"
|
|
7
|
-
When I fill in "Username" with "user1"
|
|
8
|
-
And I fill in "Password" with "1234"
|
|
9
|
-
Then I should see "user1" in the "#uname" element
|
|
10
|
-
When I fill in "uname" with: by attr
|
|
11
|
-
And I fill in "Password" with:
|
|
12
|
-
Then I should not see "user1" in the "#uname" element
|
|
13
|
-
|
|
3
|
+
I want to be able to check an input text does not contain a specific value by its attribute
|
|
14
4
|
Scenario: Check an element if it does not contain a specific text
|
|
15
5
|
Given I am on "/test--then--i-should--not--see-text-in-element.html"
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
When I fill in "Username" with "user1"
|
|
7
|
+
And I fill in "Password" with "1234"
|
|
8
|
+
Then I should see "user1" in the "Username" element
|
|
9
|
+
When I fill in "uname" with: by attr
|
|
10
|
+
And I fill in "Password" with:
|
|
11
|
+
Then I should not see "user1" in the "Username" element
|
|
12
|
+
Then I should not see "1234" in the "pword" element by attr
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Feature: An example to test whether an element contains a certain text or not
|
|
2
|
+
As a tester
|
|
3
|
+
I want to be able to check an element contains a certain text or not
|
|
4
|
+
|
|
5
|
+
Scenario: Check an element if it contains a specific text
|
|
6
|
+
Given I am on "/test--then--i-should--not--see-text-in-element.html"
|
|
7
|
+
When I fill in "Username" with "user1"
|
|
8
|
+
And I fill in "Password" with "1234"
|
|
9
|
+
Then I should see "user1" in the "uname" element by its "id" attr
|
|
10
|
+
And I should see "1234" in the "pwordcss" element by attr
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Feature: An example to test whether an input text contains a certain text by its label
|
|
2
|
+
As a tester
|
|
3
|
+
I want to be able to check an element contains a certain text or not
|
|
4
|
+
|
|
5
|
+
Scenario: Check an element if it contains a specific text
|
|
6
|
+
Given I am on "/test--then--i-should--not--see-text-in-element.html"
|
|
7
|
+
When I fill in "Username" with "user1"
|
|
8
|
+
And I fill in "Password" with "1234"
|
|
9
|
+
Then I should see "user1" in the "Username" element
|
|
10
|
+
And I should see "1234" in the "Password" element
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Feature: An example to test not seeing for a specific element on current page by its label
|
|
2
|
+
As a user
|
|
3
|
+
I want to make sure that when I'm on a particular page, I should not see a specific element by its label
|
|
4
|
+
|
|
5
|
+
Scenario: Check to test not seeing for a specific element by its label
|
|
6
|
+
Given I am on "/test--then--i-should--see-text-in-element.html"
|
|
7
|
+
Then I should not see an "emailId" element by its "id" attr
|
|
8
|
+
And I should not see a "countryCss" element by attr
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Feature: An example to test not seeing for a specific element on current page by its label
|
|
2
|
+
As a user
|
|
3
|
+
I want to make sure that when I'm on a particular page, I should not see a specific element by its label
|
|
4
|
+
|
|
5
|
+
Scenario: Check to test not seeing for a specific element by its label
|
|
6
|
+
Given I am on "/test--then--i-should--see-text-in-element.html"
|
|
7
|
+
Then I should not see an "Eamil" element
|
|
8
|
+
And I should not see a "Country" element
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Feature: An example to test seeing for a specific element on current page by its attributes
|
|
2
|
+
As a user
|
|
3
|
+
I want to make sure that when I'm on a particular page, I should see a specific element by its attributes
|
|
4
|
+
|
|
5
|
+
Scenario: Check to test seeing for a specific element by its attributes
|
|
6
|
+
Given I am on "/test--then--i-should--see-text-in-element.html"
|
|
7
|
+
Then I should see a "uname" element by its "id" attr
|
|
8
|
+
And I should see a "pwordcss" element by attr
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
Feature: An example to test seeing for a specific element on current page
|
|
1
|
+
Feature: An example to test seeing for a specific element on current page by its label
|
|
2
2
|
As a user
|
|
3
|
-
I want to make sure that when I'm on a particular page, I should see a specific element
|
|
3
|
+
I want to make sure that when I'm on a particular page, I should see a specific element by its label
|
|
4
4
|
|
|
5
|
-
Scenario: Check to test seeing for a specific element
|
|
6
|
-
Given I am on "/
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Scenario: Check to test seeing for a specific element by its label
|
|
6
|
+
Given I am on "/test--then--i-should--see-text-in-element.html"
|
|
7
|
+
Then I should see a "Username" element
|
|
8
|
+
And I should see a "Password" element
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Feature: An example to test if the element contains a certain expected CSS property.
|
|
2
|
+
As a developer
|
|
3
|
+
I want to be able to test if the element contains a certain expected CSS property.
|
|
4
|
+
|
|
5
|
+
Scenario: Check element if the element contains a certain expected CSS property
|
|
6
|
+
Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
|
|
7
|
+
Then I should see a "body" element by attr
|
|
8
|
+
When I press "Submit"
|
|
9
|
+
Then the "body" element should contain "background-color:white;" css style
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Feature: An example to test if the element does not contain a certain expected CSS property.
|
|
2
|
+
As a developer
|
|
3
|
+
I want to be able to test if the element does not contain a certain expected CSS property.
|
|
4
|
+
|
|
5
|
+
Scenario: Check element if the element not contain a certain CSS property
|
|
6
|
+
Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
|
|
7
|
+
Then I should see a "body" element by attr
|
|
8
|
+
When I press "Submit"
|
|
9
|
+
Then the "#uname" element should not contain "border:solid 5px red;" css style
|
|
10
|
+
And the "pword" element should not contain "font-size: 28px;" css style
|
|
@@ -5,7 +5,7 @@ Feature: An example to click link by its attribute
|
|
|
5
5
|
|
|
6
6
|
Scenario: Check click link by class attribute
|
|
7
7
|
Given I am on "/test--when--i-click-link.html"
|
|
8
|
-
When I click "
|
|
8
|
+
When I click "#aboutUsid" by attr
|
|
9
9
|
And I wait max of 2 seconds
|
|
10
10
|
Then I should see "About Us"
|
|
11
11
|
|
|
@@ -13,4 +13,10 @@ Feature: An example to click link by its attribute
|
|
|
13
13
|
Given I am on "/test--when--i-click-link.html"
|
|
14
14
|
When I click "aboutUsid" by its "id" attribute
|
|
15
15
|
And I wait max of 2 seconds
|
|
16
|
+
Then I should see "About Us"
|
|
17
|
+
|
|
18
|
+
Scenario: Check click link by class attribute
|
|
19
|
+
Given I am on "/test--when--i-click-link.html"
|
|
20
|
+
When I click "aboutUs" by "class" attr
|
|
21
|
+
And I wait max of 2 seconds
|
|
16
22
|
Then I should see "About Us"
|
|
@@ -2,10 +2,10 @@ Feature: An example of filling the input textbox with value by its attribute
|
|
|
2
2
|
As a tester
|
|
3
3
|
I want to be able to fill input text with value by its attribute
|
|
4
4
|
|
|
5
|
-
Scenario: Check fill in input field with
|
|
5
|
+
Scenario: Check fill in input field with ready format attribute
|
|
6
6
|
Given I am on "/test--when--i-fill-in.html"
|
|
7
|
-
When I fill in "uname" with "John Smith" by attr
|
|
8
|
-
And I fill in "pwordcss" with "1234" by attr
|
|
7
|
+
When I fill in "#uname" with "John Smith" by attr
|
|
8
|
+
And I fill in "pwordcss" with "1234" by its "class" attr
|
|
9
9
|
When I press "Login"
|
|
10
10
|
Then I should see "You enter Username: John Smith and Password: 1234"
|
|
11
11
|
|
|
@@ -14,4 +14,18 @@ I want to be able to fill input text with value by its attribute
|
|
|
14
14
|
When I fill in "Your full name" with "John Smith" by its "placeholder" attr
|
|
15
15
|
And I fill in "Your Password" with "1234" by attr
|
|
16
16
|
When I press "Login"
|
|
17
|
-
Then I should see "You enter Username: John Smith and Password: 1234"
|
|
17
|
+
Then I should see "You enter Username: John Smith and Password: 1234"
|
|
18
|
+
|
|
19
|
+
Scenario: Check fill in value for input field
|
|
20
|
+
Given I am on "/test--when--i-fill-in.html"
|
|
21
|
+
When I fill in "John Smith" for "#uname" by attr
|
|
22
|
+
When I fill in "1234" for "pwordcss" by attr
|
|
23
|
+
When I press "Login"
|
|
24
|
+
Then I should see "You enter Username: John Smith and Password: 1234"
|
|
25
|
+
|
|
26
|
+
Scenario: Check fill in input field with empty value
|
|
27
|
+
Given I am on "/test--when--i-fill-in.html"
|
|
28
|
+
When I fill in "#uname" with: by attribute
|
|
29
|
+
And I fill in "password" with: by attr
|
|
30
|
+
When I press "Login" by attr
|
|
31
|
+
Then I should see "You enter Username: and Password:"
|
|
@@ -5,7 +5,7 @@ I want to be able to fill input text with value by attribute
|
|
|
5
5
|
Scenario: Check fill in table of input fields by different attribute
|
|
6
6
|
Given I am on "/test--when--i-fill-in.html"
|
|
7
7
|
When I fill in the following: by attr
|
|
8
|
-
| uname | John Smith |
|
|
8
|
+
| #uname | John Smith |
|
|
9
9
|
| pwordcss | 1234 |
|
|
10
10
|
When I press "Login"
|
|
11
11
|
Then I should see "You enter Username: John Smith and Password: 1234"
|
|
@@ -6,27 +6,27 @@ I want to be able to fill input text with value
|
|
|
6
6
|
Given I am on "/test--when--i-fill-in.html"
|
|
7
7
|
When I fill in "Username" with "John Smith"
|
|
8
8
|
When I fill in "Password" with "1234"
|
|
9
|
-
When I press "Login"
|
|
9
|
+
When I press "Login"
|
|
10
10
|
Then I should see "You enter Username: John Smith and Password: 1234"
|
|
11
11
|
|
|
12
|
-
Scenario: Check fill in input field with empty value
|
|
13
|
-
Given I am on "/test--when--i-fill-in.html"
|
|
14
|
-
When I fill in "uname" with: by its "id" attribute
|
|
15
|
-
And I fill in "Your Password" with: by attr
|
|
16
|
-
When I press "Login" by attr
|
|
17
|
-
Then I should see "You enter Username: and Password:"
|
|
18
|
-
|
|
19
12
|
Scenario: Check fill in value for input field
|
|
20
13
|
Given I am on "/test--when--i-fill-in.html"
|
|
21
14
|
When I fill in "John Smith" for "Username"
|
|
22
|
-
When I fill in "1234" for "
|
|
23
|
-
When I press "Login"
|
|
15
|
+
When I fill in "1234" for "Password"
|
|
16
|
+
When I press "Login"
|
|
24
17
|
Then I should see "You enter Username: John Smith and Password: 1234"
|
|
25
18
|
|
|
19
|
+
Scenario: Check fill in input field with empty value
|
|
20
|
+
Given I am on "/test--when--i-fill-in.html"
|
|
21
|
+
When I fill in "Username" with:
|
|
22
|
+
And I fill in "Password" with:
|
|
23
|
+
When I press "Login"
|
|
24
|
+
Then I should see "You enter Username: and Password:"
|
|
25
|
+
|
|
26
26
|
Scenario: Check fill in table of input fields
|
|
27
27
|
Given I am on "/test--when--i-fill-in.html"
|
|
28
28
|
When I fill in the following:
|
|
29
29
|
| Username | John Smith |
|
|
30
30
|
| Password | 1234 |
|
|
31
|
-
When I press "Login"
|
|
31
|
+
When I press "Login"
|
|
32
32
|
Then I should see "You enter Username: John Smith and Password: 1234"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Feature: An example to select option from dropdown list by its attributes
|
|
2
|
+
|
|
3
|
+
As a tester
|
|
4
|
+
I want to be able to test select option from dropdown list by its attributes
|
|
5
|
+
|
|
6
|
+
Scenario: Check of selecting option from dropdown list by its attributes
|
|
7
|
+
Given I am on "/test--when--i-select-option-from-dropdownlist.html"
|
|
8
|
+
When I select "Saab" from "#cars" by attr
|
|
9
|
+
When I press "Submit"
|
|
10
|
+
Then I should see "Option ( Saab ) has been selected successfully"
|
|
11
|
+
|
|
12
|
+
Scenario: Check of selecting option from drop down list
|
|
13
|
+
Given I am on "/test--when--i-select-option-from-dropdownlist.html"
|
|
14
|
+
When I select "Mercedes" from "cars" by its "id" attr
|
|
15
|
+
When I press "Submit"
|
|
16
|
+
Then I should see "Option ( Mercedes ) has been selected successfully"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Feature: An example to select option
|
|
1
|
+
Feature: An example to select the option in the dropdown list field by its text label
|
|
2
2
|
|
|
3
3
|
As a tester
|
|
4
|
-
I want to be able to test select option from
|
|
4
|
+
I want to be able to test select option from dropdown list by its text label
|
|
5
5
|
|
|
6
|
-
Scenario: Check of selecting option from
|
|
6
|
+
Scenario: Check of selecting option from dropdown list by its text label
|
|
7
7
|
Given I am on "/test--when--i-select-option-from-dropdownlist.html"
|
|
8
|
-
When I select "Saab" from "
|
|
8
|
+
When I select "Saab" from "Choose a car:"
|
|
9
9
|
When I press "Submit" by attr
|
|
10
10
|
Then I should see "Option ( Saab ) has been selected successfully"
|
|
@@ -149,18 +149,21 @@ When(/^(I|we)* click "([^"]*)?"$/, function (pronoundCase, item) {
|
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* Click Link with specified element
|
|
152
|
-
* Example: When I click "
|
|
153
|
-
* Example: When I click "
|
|
154
|
-
* Example: And I click "
|
|
152
|
+
* Example: When I click "#aboutUsid" by attr
|
|
153
|
+
* Example: When I click "aboutUsCss" by attribute
|
|
154
|
+
* Example: And I click "aboutUsCss" by "class" attr
|
|
155
155
|
* Example: And I click "aboutUsid" by its "id" attribute
|
|
156
156
|
*
|
|
157
157
|
*/
|
|
158
158
|
When(/^(I|we)* click "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, attrValue, itsCase, attr, attrCase) {
|
|
159
159
|
|
|
160
160
|
const hasASpace = attrValue.indexOf(' ');
|
|
161
|
-
|
|
162
161
|
var selector = '';
|
|
163
|
-
|
|
162
|
+
|
|
163
|
+
if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
|
|
164
|
+
selector = attrValue;
|
|
165
|
+
}
|
|
166
|
+
else if (!attr && hasASpace == -1){
|
|
164
167
|
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
165
168
|
}
|
|
166
169
|
else if (!attr && hasASpace > -1){
|
|
@@ -210,6 +213,7 @@ When(/^(I|we)* fill in "([^"]*)?" with "([^"]*)?"$/, function (pronoundCase, fie
|
|
|
210
213
|
|
|
211
214
|
/**
|
|
212
215
|
* Fill input type text with value by its attribute
|
|
216
|
+
* Example: When I fill in "#uname" by attr
|
|
213
217
|
* Example: When I fill in "uname" with "John Smith" by attr
|
|
214
218
|
* Example: And I fill in "pwordcss" with "1234" by "class" attr
|
|
215
219
|
* Example: And I fill in "Your full name" with "John Smith" by its "placeholder" attribute
|
|
@@ -218,9 +222,12 @@ When(/^(I|we)* fill in "([^"]*)?" with "([^"]*)?"$/, function (pronoundCase, fie
|
|
|
218
222
|
When(/^(I|we)* fill in "([^"]*)?" with "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, attrValue, txtValue, itsCase, attr, attrCase) {
|
|
219
223
|
|
|
220
224
|
const hasASpace = attrValue.indexOf(' ');
|
|
221
|
-
|
|
222
225
|
var selector = '';
|
|
223
|
-
|
|
226
|
+
|
|
227
|
+
if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
|
|
228
|
+
selector = attrValue;
|
|
229
|
+
}
|
|
230
|
+
else if (!attr && hasASpace == -1){
|
|
224
231
|
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
225
232
|
}
|
|
226
233
|
else if (!attr && hasASpace > -1){
|
|
@@ -248,6 +255,7 @@ When(/^(I|we)* fill in "([^"]*)?" with:$/, function (pronoundCase, field) {
|
|
|
248
255
|
|
|
249
256
|
/**
|
|
250
257
|
* Fill input type text with empty value by its attribute
|
|
258
|
+
* Example: When I fill in "#uname" with: by attr
|
|
251
259
|
* Example: When I fill in "uname" with: by attr
|
|
252
260
|
* Example: And I fill in "pwordcss" with: by "class" attr
|
|
253
261
|
* Example: And I fill in "Your full name" with: by its "placeholder" attribute
|
|
@@ -256,10 +264,12 @@ When(/^(I|we)* fill in "([^"]*)?" with:$/, function (pronoundCase, field) {
|
|
|
256
264
|
When(/^(I|we)* fill in "([^"]*)?" with: by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, attrValue , itsCase, attr, attrCase) {
|
|
257
265
|
|
|
258
266
|
const hasASpace = attrValue.indexOf(' ');
|
|
259
|
-
const txtValue = '';
|
|
260
267
|
var selector = '';
|
|
261
268
|
|
|
262
|
-
if (
|
|
269
|
+
if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
|
|
270
|
+
selector = attrValue;
|
|
271
|
+
}
|
|
272
|
+
else if (!attr && hasASpace == -1){
|
|
263
273
|
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
264
274
|
}
|
|
265
275
|
else if (!attr && hasASpace > -1){
|
|
@@ -269,8 +279,7 @@ When(/^(I|we)* fill in "([^"]*)?" with: by( its)*( "([^"]*)?")* (attribute|attr)
|
|
|
269
279
|
selector = '[' + attr + '="' + attrValue + '"]';
|
|
270
280
|
}
|
|
271
281
|
|
|
272
|
-
return browser.setValue(selector,
|
|
273
|
-
|
|
282
|
+
return browser.setValue(selector, '');
|
|
274
283
|
});
|
|
275
284
|
|
|
276
285
|
/**
|
|
@@ -287,6 +296,7 @@ When(/^(I|we)* fill in "([^"]*)?" for "([^"]*)?"$/, function (pronoundCase, valu
|
|
|
287
296
|
|
|
288
297
|
/**
|
|
289
298
|
* Fill in value for input type text by its attribute
|
|
299
|
+
* Example: When I fill in "John Smith" for "#uname" by attr
|
|
290
300
|
* Example: When I fill in "John Smith" for "uname" by attr
|
|
291
301
|
* Example: And I fill in "1234" for "pwordcss" by "class" attr
|
|
292
302
|
* Example: And I fill in "John Smith" for "Your full name" by its "placeholder" attribute
|
|
@@ -295,9 +305,12 @@ When(/^(I|we)* fill in "([^"]*)?" for "([^"]*)?"$/, function (pronoundCase, valu
|
|
|
295
305
|
When(/^(I|we)* fill in "([^"]*)?" for "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, txtValue, attrValue, itsCase, attr, attrCase) {
|
|
296
306
|
|
|
297
307
|
const hasASpace = attrValue.indexOf(' ');
|
|
298
|
-
|
|
299
308
|
var selector = '';
|
|
300
|
-
|
|
309
|
+
|
|
310
|
+
if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
|
|
311
|
+
selector = attrValue;
|
|
312
|
+
}
|
|
313
|
+
else if (!attr && hasASpace == -1){
|
|
301
314
|
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
302
315
|
}
|
|
303
316
|
else if (!attr && hasASpace > -1){
|
|
@@ -337,7 +350,7 @@ When(/^(I|we)* fill in the following:$/, function (pronoundCase, table) {
|
|
|
337
350
|
/**
|
|
338
351
|
* Fill in value for input type text by its attributeFill form fields of type input Text with the provided table according to their attributes
|
|
339
352
|
* Example: When I fill in the following: by attr
|
|
340
|
-
* | uname | John Smith |
|
|
353
|
+
* | #uname | John Smith |
|
|
341
354
|
* | pwordcss | 1234 |
|
|
342
355
|
|
|
343
356
|
* Example: When I fill in the following: by its "placeholder" attribute
|
|
@@ -349,7 +362,11 @@ When(/^(I|we)* fill in the following: by( its)*( "([^"]*)?")* (attribute|attr)$/
|
|
|
349
362
|
|
|
350
363
|
var hasASpace = table.rawTable[0][0].indexOf(' ');
|
|
351
364
|
var selector = '';
|
|
352
|
-
|
|
365
|
+
|
|
366
|
+
if((table.rawTable[0][0].startsWith('#') || table.rawTable[0][0].startsWith('.')) && hasASpace == -1){
|
|
367
|
+
selector = table.rawTable[0][0];
|
|
368
|
+
}
|
|
369
|
+
else if (!attr && hasASpace == -1){
|
|
353
370
|
selector = table.rawTable[0][0] + ',#' + table.rawTable[0][0] + ',.' + table.rawTable[0][0] + ',[name=' + table.rawTable[0][0] + "]," + '[value="' + table.rawTable[0][0] + '"],[placeholder="' + table.rawTable[0][0] + '"]';
|
|
354
371
|
}
|
|
355
372
|
else if (!attr && hasASpace > -1){
|
|
@@ -366,7 +383,11 @@ When(/^(I|we)* fill in the following: by( its)*( "([^"]*)?")* (attribute|attr)$/
|
|
|
366
383
|
|
|
367
384
|
hasASpace = row[0].indexOf(' ');
|
|
368
385
|
var selector = '';
|
|
369
|
-
|
|
386
|
+
|
|
387
|
+
if((row[0].startsWith('#') || row[0].startsWith('.')) && hasASpace == -1){
|
|
388
|
+
selector = row[0];
|
|
389
|
+
}
|
|
390
|
+
else if (!attr && hasASpace == -1){
|
|
370
391
|
|
|
371
392
|
selector = row[0] + ',#' + row[0] + ',.' + row[0] + ',[name=' + row[0] + "]," + '[value="' + row[0] + '"],[placeholder="' + row[0] + '"]';
|
|
372
393
|
}
|
|
@@ -383,13 +404,50 @@ When(/^(I|we)* fill in the following: by( its)*( "([^"]*)?")* (attribute|attr)$/
|
|
|
383
404
|
});
|
|
384
405
|
|
|
385
406
|
/**
|
|
386
|
-
*
|
|
407
|
+
* Selecting the option in the dropdown list field by its text label
|
|
387
408
|
* Example: When I select "Mercedes" from "Cars"
|
|
388
409
|
*
|
|
389
410
|
*/
|
|
390
411
|
When(/^(I|we)* select "([^"]*)?" from "([^"]*)?"$/, function (pronoundCase, option, dropdownlist) {
|
|
391
412
|
|
|
392
|
-
browser.
|
|
413
|
+
const elementField = browser.element.findByText(dropdownlist);
|
|
414
|
+
browser.getAttribute(elementField, 'for', function (eleAttribute) {
|
|
415
|
+
return browser.waitForElementVisible('css selector', '#' + eleAttribute.value)
|
|
416
|
+
.click('#' + eleAttribute.value)
|
|
417
|
+
.click(browser.element.findByText(option))
|
|
418
|
+
.click('#' + eleAttribute.value);
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Selects option in select field
|
|
424
|
+
* Example: When I select "Mercedes" from "cars" its "id" attr
|
|
425
|
+
* Example: When I select "Saab" from "#cars" by attr
|
|
426
|
+
*
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
When(/^(I|we)* select "([^"]*)?" from "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, option, attrValue, itsCase, attr, attrCase) {
|
|
430
|
+
|
|
431
|
+
const hasASpace = attrValue.indexOf(' ');
|
|
432
|
+
|
|
433
|
+
var selector = '';
|
|
434
|
+
if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
|
|
435
|
+
selector = attrValue;
|
|
436
|
+
}
|
|
437
|
+
else if (!attr && hasASpace == -1){
|
|
438
|
+
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
439
|
+
}
|
|
440
|
+
else if (!attr && hasASpace > -1){
|
|
441
|
+
selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
selector = '[' + attr + '="' + attrValue + '"]';
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return browser.waitForElementVisible('css selector', selector)
|
|
448
|
+
.click(selector)
|
|
449
|
+
.click(browser.element.findByText(option))
|
|
450
|
+
.click(selector);
|
|
393
451
|
});
|
|
394
452
|
|
|
395
453
|
/**
|
|
@@ -483,71 +541,154 @@ Then(/^the response should not contain "([^"]*)?"$/, function (expectedText) {
|
|
|
483
541
|
|
|
484
542
|
|
|
485
543
|
/**
|
|
486
|
-
* Assert, that
|
|
487
|
-
* Example: Then I should see "John Smith" in the "
|
|
544
|
+
* Assert, that input text contains a specific value by its label
|
|
545
|
+
* Example: Then I should see "John Smith" in the "Username" element
|
|
488
546
|
*
|
|
489
547
|
*/
|
|
490
548
|
Then(/^(I|we)* should see "([^"]*)?" in the "([^"]*)?" element$/, function (pronoundCase, expectedText, element) {
|
|
549
|
+
const elementField = browser.element.findByText(element);
|
|
550
|
+
browser.getAttribute(elementField, 'for', function (eleAttribute) {
|
|
551
|
+
return this.shouldSee = function (browser) {
|
|
552
|
+
browser.assert.textContains('#' + eleAttribute.value, expectedText);
|
|
553
|
+
};
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Assert, that input text contains a specific value by its attributes
|
|
559
|
+
* Example: Then I should see "John Smith" in the "uname" element by its "id" attr
|
|
560
|
+
* Example: Then I should see "1234" in the "pwordcss" element by attr
|
|
561
|
+
*
|
|
562
|
+
*/
|
|
563
|
+
Then(/^(I|we)* should see "([^"]*)?" in the "([^"]*)?" element by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, expectedText, attrValue, itsCase, attr, attrCase) {
|
|
564
|
+
|
|
565
|
+
const hasASpace = attrValue.indexOf(' ');
|
|
566
|
+
|
|
567
|
+
var selector = '';
|
|
568
|
+
if (!attr && hasASpace == -1){
|
|
569
|
+
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
570
|
+
}
|
|
571
|
+
else if (!attr && hasASpace > -1){
|
|
572
|
+
selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
selector = '[' + attr + '="' + attrValue + '"]';
|
|
576
|
+
}
|
|
577
|
+
|
|
491
578
|
return this.shouldSee = function (browser) {
|
|
492
|
-
browser.assert.textContains(
|
|
579
|
+
browser.assert.textContains(selector, expectedText);
|
|
493
580
|
};
|
|
494
581
|
});
|
|
495
582
|
|
|
496
583
|
/**
|
|
497
|
-
* Assert, that
|
|
498
|
-
* Example: Then I should not see "Joe Smith" in the "
|
|
584
|
+
* Assert, that input text does not contain a specific value to be by its label
|
|
585
|
+
* Example: Then I should not see "Joe Smith" in the "Username" element
|
|
499
586
|
*
|
|
500
587
|
*/
|
|
501
588
|
Then(/^(I|we)* should not see "([^"]*)?" in the "([^"]*)?" element$/, function (pronoundCase, expectedText, element) {
|
|
502
589
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
590
|
+
const elementField = browser.element.findByText(element);
|
|
591
|
+
browser.getAttribute(elementField, 'for', function (eleAttribute) {
|
|
592
|
+
return this.shouldSee = function (browser) {
|
|
593
|
+
browser.assert.not.textContains('#' + eleAttribute.value, expectedText);
|
|
594
|
+
};
|
|
595
|
+
});
|
|
506
596
|
});
|
|
507
597
|
|
|
508
598
|
/**
|
|
509
|
-
* Assert, that
|
|
510
|
-
* Example: Then I should see
|
|
511
|
-
*
|
|
599
|
+
* Assert, that input text contains a specific value by its attributes
|
|
600
|
+
* Example: Then I should not see "John Smith" in the "uname" element by its "id" attr
|
|
601
|
+
* Example: Then I should not see "1234" in the "pwordcss" element by attr
|
|
602
|
+
*
|
|
512
603
|
*/
|
|
513
|
-
Then(/^(I|we)* should see
|
|
514
|
-
|
|
604
|
+
Then(/^(I|we)* should not see "([^"]*)?" in the "([^"]*)?" element by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, expectedText, attrValue, itsCase, attr, attrCase) {
|
|
605
|
+
|
|
606
|
+
const hasASpace = attrValue.indexOf(' ');
|
|
607
|
+
|
|
608
|
+
var selector = '';
|
|
609
|
+
if (!attr && hasASpace == -1){
|
|
610
|
+
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
611
|
+
}
|
|
612
|
+
else if (!attr && hasASpace > -1){
|
|
613
|
+
selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
selector = '[' + attr + '="' + attrValue + '"]';
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
return this.shouldSee = function (browser) {
|
|
620
|
+
browser.assert.not.textContains(selector, expectedText);
|
|
621
|
+
};
|
|
515
622
|
});
|
|
516
623
|
|
|
517
624
|
/**
|
|
518
|
-
* Assert, that element exists on current page
|
|
519
|
-
* Example: Then I should see
|
|
625
|
+
* Assert, that element exists on current page by its label
|
|
626
|
+
* Example: Then I should see a "Username" element
|
|
520
627
|
*
|
|
521
628
|
*/
|
|
522
|
-
Then(/^(I|we)* should see an "([^"]*)?" element$/, function (pronoundCase, element) {
|
|
523
|
-
|
|
629
|
+
Then(/^(I|we)* should see (a|an) "([^"]*)?" element$/, function (pronoundCase, aAnCase, element) {
|
|
630
|
+
const elementField = browser.element.findByText(element, { exact: true });
|
|
631
|
+
browser.getAttribute(elementField, 'for', function (eleAttribute) {
|
|
632
|
+
return browser.verify.visible('#' + eleAttribute.value);
|
|
633
|
+
});
|
|
524
634
|
});
|
|
525
635
|
|
|
526
636
|
/**
|
|
527
|
-
* Assert, that element
|
|
528
|
-
* Example: Then I should
|
|
529
|
-
*
|
|
637
|
+
* Assert, that element exists on the current page by its attribute
|
|
638
|
+
* Example: Then I should see a "uname" element by its "id" attr
|
|
639
|
+
* Example: Then I should see a "pwordcss" element by attr
|
|
640
|
+
*
|
|
530
641
|
*/
|
|
531
|
-
Then(/^(I|we)* should
|
|
532
|
-
|
|
642
|
+
Then(/^(I|we)* should see (a|an) "([^"]*)?" element by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, aAnCase, attrValue, itsCase, attr, attrCase) {
|
|
643
|
+
|
|
644
|
+
const hasASpace = attrValue.indexOf(' ');
|
|
645
|
+
|
|
646
|
+
var selector = '';
|
|
647
|
+
if (!attr && hasASpace == -1){
|
|
648
|
+
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
649
|
+
}
|
|
650
|
+
else if (!attr && hasASpace > -1){
|
|
651
|
+
selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
selector = '[' + attr + '="' + attrValue + '"]';
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
return browser.verify.visible(selector);
|
|
533
658
|
});
|
|
534
659
|
|
|
535
660
|
/**
|
|
536
|
-
* Assert, that element
|
|
661
|
+
* Assert, that element exists on current page by its label
|
|
537
662
|
* Example: Then I should not see a "Username" element
|
|
538
663
|
*
|
|
539
664
|
*/
|
|
540
|
-
Then(/^(I|we)* should not see a "([^"]*)?" element$/, function (pronoundCase, element) {
|
|
541
|
-
|
|
665
|
+
Then(/^(I|we)* should not see (a|an) "([^"]*)?" element$/, function (pronoundCase, aAnCase, element) {
|
|
666
|
+
|
|
667
|
+
browser.assert.not.textContains("html", element);
|
|
542
668
|
});
|
|
543
669
|
|
|
544
670
|
/**
|
|
545
|
-
* Assert, that element exists on current page
|
|
546
|
-
* Example: Then I should not see an "
|
|
671
|
+
* Assert, that element exists on current page by its attributes
|
|
672
|
+
* Example: Then I should not see an "emailId" element by its "id" attr
|
|
673
|
+
* Example: And I should not see a "countryCss" element by attr
|
|
547
674
|
*
|
|
548
675
|
*/
|
|
549
|
-
Then(/^(I|we)* should not see an "([^"]*)?" element$/, function (pronoundCase,
|
|
550
|
-
|
|
676
|
+
Then(/^(I|we)* should not see (a|an) "([^"]*)?" element by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, aAnCase, attrValue, itsCase, attr, attrCase) {
|
|
677
|
+
|
|
678
|
+
const hasASpace = attrValue.indexOf(' ');
|
|
679
|
+
|
|
680
|
+
var selector = '';
|
|
681
|
+
if (!attr && hasASpace == -1){
|
|
682
|
+
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
683
|
+
}
|
|
684
|
+
else if (!attr && hasASpace > -1){
|
|
685
|
+
selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
686
|
+
}
|
|
687
|
+
else {
|
|
688
|
+
selector = '[' + attr + '="' + attrValue + '"]';
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
return browser.expect.element(selector).to.not.be.present;
|
|
551
692
|
});
|
|
552
693
|
|
|
553
694
|
/**
|
|
@@ -555,7 +696,20 @@ Then(/^(I|we)* should not see an "([^"]*)?" element$/, function (pronoundCase, e
|
|
|
555
696
|
* Example: Then the "body" element should contain "color:white;"
|
|
556
697
|
*
|
|
557
698
|
*/
|
|
558
|
-
Then(/^the "([^"]*)?" element should contain "([^"]*)?"$/, function (
|
|
699
|
+
Then(/^the "([^"]*)?" element should contain "([^"]*)?" css style$/, function (attrValue, elementCss) {
|
|
700
|
+
|
|
701
|
+
const hasASpace = attrValue.indexOf(' ');
|
|
702
|
+
|
|
703
|
+
var selector = '';
|
|
704
|
+
if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
|
|
705
|
+
selector = attrValue;
|
|
706
|
+
}
|
|
707
|
+
else if (hasASpace == -1){
|
|
708
|
+
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
709
|
+
}
|
|
710
|
+
else if (hasASpace > -1){
|
|
711
|
+
selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
712
|
+
}
|
|
559
713
|
|
|
560
714
|
elementCss = elementCss.replace(";", '');
|
|
561
715
|
const cssPropertyArr = elementCss.split(":");
|
|
@@ -564,16 +718,30 @@ Then(/^the "([^"]*)?" element should contain "([^"]*)?"$/, function (element, el
|
|
|
564
718
|
const propertyVal = cssPropertyArr[1].trim();
|
|
565
719
|
|
|
566
720
|
this.checkCss = function (browser) {
|
|
567
|
-
browser.assert.cssProperty(
|
|
721
|
+
browser.assert.cssProperty(selector, cssProperty, propertyVal);
|
|
568
722
|
};
|
|
569
723
|
});
|
|
570
724
|
|
|
571
725
|
/**
|
|
572
726
|
* Assert, that element contains a specific CSS style
|
|
573
|
-
* Example: Then the "body" element should not contain "color:white;"
|
|
574
|
-
*
|
|
727
|
+
* Example: Then the "body" element should not contain "color:white;" css style
|
|
728
|
+
* Example: Then the "#uname" element should not contain "border:solid 5px red;" css style
|
|
729
|
+
* Example: Then the "pword" element should not contain "font-size: 26px;" css style
|
|
575
730
|
*/
|
|
576
|
-
Then(/^the "([^"]*)?" element should not contain "([^"]*)?"$/, function (
|
|
731
|
+
Then(/^the "([^"]*)?" element should not contain "([^"]*)?" css style$/, function (attrValue, elementCss) {
|
|
732
|
+
|
|
733
|
+
const hasASpace = attrValue.indexOf(' ');
|
|
734
|
+
|
|
735
|
+
var selector = '';
|
|
736
|
+
if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
|
|
737
|
+
selector = attrValue;
|
|
738
|
+
}
|
|
739
|
+
else if (hasASpace == -1){
|
|
740
|
+
selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
741
|
+
}
|
|
742
|
+
else if (hasASpace > -1){
|
|
743
|
+
selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
|
|
744
|
+
}
|
|
577
745
|
|
|
578
746
|
elementCss = elementCss.replace(";", '');
|
|
579
747
|
const cssPropertyArr = elementCss.split(":");
|
|
@@ -582,7 +750,7 @@ Then(/^the "([^"]*)?" element should not contain "([^"]*)?"$/, function (element
|
|
|
582
750
|
const propertyVal = cssPropertyArr[1].trim();
|
|
583
751
|
|
|
584
752
|
this.checkCss = function (browser) {
|
|
585
|
-
browser.assert.not.cssProperty(
|
|
753
|
+
browser.assert.not.cssProperty(selector, cssProperty, propertyVal);
|
|
586
754
|
};
|
|
587
755
|
});
|
|
588
756
|
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Feature: An example to test if the element contains a certain expected CSS property or not.
|
|
2
|
-
As a developer
|
|
3
|
-
I want to be able to test if the element contains a certain expected CSS property or not.
|
|
4
|
-
|
|
5
|
-
Scenario: Check element if the element contains a certain expected CSS property
|
|
6
|
-
Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
|
|
7
|
-
Then I should see a "body" element
|
|
8
|
-
When I press "Submit" by attr
|
|
9
|
-
Then the "body" element should contain "background-color:white;"
|
|
10
|
-
|
|
11
|
-
Scenario: Check element if the element not contains a certain CSS property
|
|
12
|
-
Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
|
|
13
|
-
Then I should see a "body" element
|
|
14
|
-
When I press "Submit" by attr
|
|
15
|
-
Then the "#uname" element should not contain "border:solid 5px red;"
|