webship-js 1.0.28 → 1.0.29
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.
|
@@ -8,15 +8,16 @@ jobs:
|
|
|
8
8
|
runs-on: ubuntu-latest
|
|
9
9
|
|
|
10
10
|
env:
|
|
11
|
-
TEST_BASE_URL: http://localhost:
|
|
11
|
+
TEST_BASE_URL: http://localhost:8080
|
|
12
12
|
SELENIUM_HOST: http://selenium:4444/wd/hub
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
15
|
- name: Install Chrome
|
|
16
16
|
run: |
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
CHROME_VERSION="115.0.5790.110-1"
|
|
18
|
+
wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
|
|
19
|
+
sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
|
|
20
|
+
|
|
20
21
|
- uses: actions/checkout@v3
|
|
21
22
|
- name: Use Node.js
|
|
22
23
|
uses: actions/setup-node@v3
|
|
@@ -25,8 +26,8 @@ jobs:
|
|
|
25
26
|
|
|
26
27
|
- name: Run Selenium Standalone server
|
|
27
28
|
run: |
|
|
28
|
-
wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.
|
|
29
|
-
java -jar selenium-server-4.
|
|
29
|
+
wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.1.0/selenium-server-4.1.2.jar
|
|
30
|
+
java -jar selenium-server-4.1.2.jar standalone
|
|
30
31
|
|
|
31
32
|
- name: Install
|
|
32
33
|
run: yarn install
|
|
@@ -1,33 +1,11 @@
|
|
|
1
|
-
|
|
2
1
|
module.exports.command = function (option, dropdownlist) {
|
|
3
2
|
|
|
4
|
-
browser.
|
|
3
|
+
browser.findElement('css selector', 'select[name=' + dropdownlist + ']', function (result) {
|
|
5
4
|
if (result.status === 0) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
browser.element(
|
|
9
|
-
|
|
10
|
-
return browser.click('#' + dropdownlist + ' option[value=' + option + ']');
|
|
11
|
-
} else {
|
|
12
|
-
browser.element('css selector', 'select[name=' + dropdownlist + ']', function (result) {
|
|
13
|
-
if (result.status === 0) {
|
|
14
|
-
return browser.click('select[name=' + dropdownlist + ']' + ' option[value=' + option + ']');
|
|
15
|
-
} else {
|
|
16
|
-
browser.elements('css selector', 'label', function (elements) {
|
|
17
|
-
elements.value.forEach(function (elementsObj) {
|
|
18
|
-
browser.elementIdText(elementsObj.ELEMENT, function (result) {
|
|
19
|
-
if (result.value == dropdownlist) {
|
|
20
|
-
browser.getAttribute(elementsObj, "for", function (forVal) {
|
|
21
|
-
return browser.click('#' + forVal.value + ' option[value=' + option + ']');
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
5
|
+
browser.waitForElementVisible('css selector', 'select[name="' + dropdownlist + '"]')
|
|
6
|
+
.click('select[name="' + dropdownlist + '"]')
|
|
7
|
+
.click(browser.element.findByText(option))
|
|
8
|
+
.click('select[name="' + dropdownlist + '"]');
|
|
31
9
|
}
|
|
32
10
|
});
|
|
33
|
-
}
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ Feature: An example to select option from drop down list
|
|
|
5
5
|
|
|
6
6
|
Scenario: Check of selecting option from drop down list
|
|
7
7
|
Given I am on "/test--when--i-select-option-from-dropdownlist.html"
|
|
8
|
-
When I select "
|
|
8
|
+
When I select "Saab" from "cars"
|
|
9
9
|
When I press "Check select"
|
|
10
10
|
Then I should see "Option ( Saab ) has been selected successfully"
|
|
11
11
|
|
|
@@ -189,15 +189,12 @@ When(/^(I|we)* fill in the following:$/, function (pronoundCase, table) {
|
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
* Selects option in select field
|
|
192
|
-
* Example: When I select "
|
|
192
|
+
* Example: When I select "Mercedes" from "Cars"
|
|
193
193
|
*
|
|
194
194
|
*/
|
|
195
195
|
When(/^(I|we)* select "([^"]*)?" from "([^"]*)?"$/, function (pronoundCase, option, dropdownlist) {
|
|
196
196
|
|
|
197
|
-
browser.
|
|
198
|
-
.click('select[name="' + dropdownlist + '"]')
|
|
199
|
-
.click('select[name="' + dropdownlist + '"]' + ' option[value=' + option + ']')
|
|
200
|
-
.click('select[name="' + dropdownlist + '"]');
|
|
197
|
+
browser.selectOption(option, dropdownlist);
|
|
201
198
|
});
|
|
202
199
|
|
|
203
200
|
/**
|