webship-js 1.0.26 → 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.
@@ -9,32 +9,15 @@ jobs:
9
9
 
10
10
  env:
11
11
  TEST_BASE_URL: http://localhost:8080
12
+ SELENIUM_HOST: http://selenium:4444/wd/hub
12
13
 
13
14
  steps:
14
15
  - name: Install Chrome
15
16
  run: |
16
- sudo apt install libu2f-udev
17
- sudo apt-get install libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
18
- export CHROME_BIN=/usr/bin/google-chrome
19
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
20
- sudo apt-get clean
21
- sudo apt-get update
22
- sudo apt-get install dpkg
23
- sudo dpkg -i google-chrome-stable_current_amd64.deb
24
- rm google-chrome-stable_current_amd64.deb
25
- google-chrome --version
26
-
27
- - name: Install/Update Chrome Driver
28
- run: |
29
- CHROME_DRIVER_VERSION=$(wget -qO- chromedriver.storage.googleapis.com/LATEST_RELEASE);
30
- echo $CHROME_DRIVER_VERSION;
31
- wget http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
32
- unzip chromedriver_linux64.zip
33
- chmod +x chromedriver
34
- mkdir -p $HOME/.composer/vendor/bin
35
- mv -f chromedriver $HOME/.composer/vendor/bin/
36
- rm chromedriver_linux64.zip
37
-
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
+
38
21
  - uses: actions/checkout@v3
39
22
  - name: Use Node.js
40
23
  uses: actions/setup-node@v3
@@ -43,8 +26,8 @@ jobs:
43
26
 
44
27
  - name: Run Selenium Standalone server
45
28
  run: |
46
- wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.4.0/selenium-server-4.4.0.jar
47
- java -jar selenium-server-4.4.0.jar -role node -hub http://localhost:4444
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
48
31
 
49
32
  - name: Install
50
33
  run: yarn install
@@ -1,33 +1,11 @@
1
-
2
1
  module.exports.command = function (option, dropdownlist) {
3
2
 
4
- browser.element('css selector', dropdownlist, function (result) {
3
+ browser.findElement('css selector', 'select[name=' + dropdownlist + ']', function (result) {
5
4
  if (result.status === 0) {
6
- return browser.click(dropdownlist + ' option[value=' + option + ']');
7
- } else {
8
- browser.element('css selector', '#' + dropdownlist, function (result) {
9
- if (result.status === 0) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.26",
3
+ "version": "1.0.29",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -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 "saab" from "#cars"
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,12 +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 "mercedes" from "Cars"
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
- return browser.click('select' + dropdownlist + ' option[value=' + option + ']');
197
+ browser.selectOption(option, dropdownlist);
198
198
  });
199
199
 
200
200
  /**