Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#9 #12

Merged
merged 17 commits into from
Nov 28, 2017
Merged

#9 #12

Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@
"EC": true
},
"root": true,
"ecmaFeatures": {
"modules": true
},
"rules": {
// Possible Errors
"comma-dangle": [2, "never"],
"no-cond-assign": 2,
"no-console": 0,
"no-console": 1,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
Expand Down Expand Up @@ -88,7 +85,7 @@
"no-caller": 2,
"no-case-declarations": 2,
"no-div-regex": 2,
"no-else-return": 1,
"no-else-return": 2,
"no-empty-pattern": 2,
"no-eq-null": 2,
"no-eval": 2,
Expand Down Expand Up @@ -133,7 +130,7 @@
"yoda": [2, "never", { "exceptRange": true }],

// Strict Mode
"strict": [0, "global"],
"strict": [2, "global"],

// Variables
"init-declarations": 0,
Expand All @@ -145,7 +142,7 @@
"no-undef-init": 2,
"no-undef": 2,
"no-undefined": 0,
"no-unused-vars": 1,
"no-unused-vars": 2,
"no-use-before-define": 2,

// Stylistic Issues
Expand Down Expand Up @@ -198,7 +195,7 @@
"padded-blocks": 0,
"quote-props": [2, "consistent-as-needed"],
"quotes": [2, "single", "avoid-escape"],
"require-jsdoc": 2,
"require-jsdoc": 1,
"semi-spacing": [2, {"before": false, "after": true}],
"semi": [0, "always"],
"sort-vars": 0,
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ node_modules
.*
!.travis.yml
!.editorconfig
!.eslintrc.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we will remove this line, then any changes to .eslintrc.json will not be tracked by git - are we sure that it should not be tracked?

*.xml
.settings
downloads
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ install:

# http://docs.travis-ci.com/user/pull-requests/
script:
- npm run lint
- npm run mocha
- npm run cucumber
12 changes: 3 additions & 9 deletions src/helpers/objects.processor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict'

/* eslint no-param-reassign: 0*/
/* eslint no-undef: 0 */

Expand Down Expand Up @@ -35,14 +33,10 @@ function injectInto(locator, injection) {
const body = locator.replace(/\[[0-9]+\]$/, '')

return injectInto(body, injection) + nums
} else {
// Locator ends with brackets, which contain some properties
return locator.substring(0, locator.length - 1) + ' and ' + injection
}
} else {
// Locator contains no brackets
return locator + '[' + injection
return locator.substring(0, locator.length - 1) + ' and ' + injection
}
return locator + '[' + injection
}

function pageObjectGetter(str) {
Expand Down Expand Up @@ -70,7 +64,7 @@ function getPageObject(str) {
const pageObjectGetterFunc = objectsProcessor.pageObjectGetter || pageObjectGetter
const value = pageObjectGetterFunc(str)
const idValue = value.replace(_r(regDynamicId, 'g'), id.getId())
const injection = 'not(ancestor-or-self::*[contains(@style,"visibility: hidden") ' +
const injection = 'not(ancestor-or-self::*[contains(@style,"visibility: hidden;") ' +
'or contains(@style,"display: none") or contains(@class,"x-hide-offsets")])'
const injectedvalue = injectInto(idValue, injection)

Expand Down
2 changes: 0 additions & 2 deletions src/helpers/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict'

const escapeRegExp = function (str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\$&')
}
Expand Down
3 changes: 1 addition & 2 deletions src/steps/given.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint no-undef: 0 */

'use strict'
/* eslint new-cap: 0 */

const { defineSupportCode } = require('cucumber')
const { dictionaryObject, getDictionaryObject } = require('../helpers/objects.processor')
Expand Down
3 changes: 1 addition & 2 deletions src/steps/then.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint no-undef: 0 */

'use strict'
/* eslint new-cap: 0 */

const { defineSupportCode } = require('cucumber')
const { pageObject, getPageObject } = require('../helpers/objects.processor')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; is missing at the end of a line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets try to use no semicolons.

Expand Down
1 change: 0 additions & 1 deletion test/features/page_objects/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict'
let e = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; is missing at the end of a line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets try to use no semicolons.


e.txtHeader = '//*[@id="header"]'
Expand Down
4 changes: 1 addition & 3 deletions test/mocha/objects.processor.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict'

const { expect } = require('chai')

const {
Expand Down Expand Up @@ -49,7 +47,7 @@ describe('getPageObject', () => {
{
step: 'When I click object from main page',
regExp: _r(`When I click ${pageObject}`),
result: `//div[@id='${realId}' and not(ancestor-or-self::*[contains(@style,"visibility: hidden") ` +
result: `//div[@id='${realId}' and not(ancestor-or-self::*[contains(@style,"visibility: hidden;") ` +
'or contains(@style,"display: none") or contains(@class,"x-hide-offsets")])]'
}
]
Expand Down