-
-
Notifications
You must be signed in to change notification settings - Fork 753
[WIP] Refactoring #800
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
[WIP] Refactoring #800
Conversation
DavertMik
commented
Dec 2, 2017
- Update to NodeJS v8
- Refactor helpers to use async/await
- Merge Protractor & SeleniumWebDriver helpers
3e900a0 to
89d481f
Compare
| yield I.seeCurrentUrlEquals(`${site_url}/info`); | ||
| return I.dontSeeCurrentUrlEquals(`${site_url}/form`); | ||
| yield I.seeCurrentUrlEquals(`${siteUrl}/info`); | ||
| return I.dontSeeCurrentUrlEquals(`${siteUrl}/form`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
| yield I.amOnPage('/info'); | ||
| yield I.seeCurrentUrlEquals(`${site_url}/info`); | ||
| return I.dontSeeCurrentUrlEquals(`${site_url}/form`); | ||
| yield I.seeCurrentUrlEquals(`${siteUrl}/info`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'yield' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
'template literal syntax' is only available in ES6 (use 'esversion: 6').
| let I; | ||
| let data; | ||
| let site_url; | ||
| let siteUrl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
| it('should open any page of configured site', () => wd.amOnPage('/info').getUrl().then(url => url.should.eql(`${siteUrl}/info`))); | ||
|
|
||
| it('should open absolute url', () => wd.amOnPage(site_url).getUrl().then(url => url.should.eql(`${site_url}/`))); | ||
| it('should open absolute url', () => wd.amOnPage(siteUrl).getUrl().then(url => url.should.eql(`${siteUrl}/`))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
'template literal syntax' is only available in ES6 (use 'esversion: 6').
| it('should open main page of configured site', () => wd.amOnPage('/').getUrl().then(url => url.should.eql(`${siteUrl}/`))); | ||
|
|
||
| it('should open any page of configured site', () => wd.amOnPage('/info').getUrl().then(url => url.should.eql(`${site_url}/info`))); | ||
| it('should open any page of configured site', () => wd.amOnPage('/info').getUrl().then(url => url.should.eql(`${siteUrl}/info`))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
'template literal syntax' is only available in ES6 (use 'esversion: 6').
|
|
||
| let wd; | ||
| const site_url = TestHelper.siteUrl(); | ||
| const siteUrl = TestHelper.siteUrl(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
test/helper/Protractor_test.js
Outdated
| const TestHelper = require('../support/TestHelper'); | ||
|
|
||
| const site_url = 'http://davertmik.github.io/angular-demo-app'; | ||
| const siteUrl = 'http://davertmik.github.io/angular-demo-app'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
| const TestHelper = require('../support/TestHelper'); | ||
|
|
||
| const Protractor = require('../../lib/helper/Protractor'); | ||
| const TestHelper = require('../support/TestHelper'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
| return url.should.eql(`${site_url}/`); | ||
| yield I.amOnPage(siteUrl); | ||
| let url = yield browser.getCurrentUrl(); | ||
| return url.should.eql(`${siteUrl}/`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
test/helper/ProtractorWeb_test.js
Outdated
| const url = yield browser.getCurrentUrl(); | ||
| return url.should.eql(`${site_url}/`); | ||
| yield I.amOnPage(siteUrl); | ||
| let url = yield browser.getCurrentUrl(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
'yield' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
lib/helper/errors/ElementNotFound.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class properties must be methods. Expected '(' but instead saw 'new'.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
Expected an identifier and instead saw '${'.
'function closure expressions' is only available in Mozilla JavaScript extensions (use moz option).
Expected an identifier and instead saw ')'.
Expected an operator and instead saw '.'.
Expected an identifier and instead saw '{a}'.
Class properties must be methods. Expected '(' but instead saw '}'.
lib/helper/errors/ElementNotFound.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
lib/interfaces/bdd.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
lib/interfaces/bdd.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
lib/interfaces/bdd.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
lib/helper/SeleniumWebdriver.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
lib/locator.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
lib/locator.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
'template literal syntax' is only available in ES6 (use 'esversion: 6').
lib/locator.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
lib/locator.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
c0e0b74 to
18ac645
Compare
| submittedData(dataFile) { | ||
| return function (key) { | ||
| if (!fs.existsSync(dataFile)) { | ||
| const waitTill = new Date(new Date().getTime() + 1 * 1000); // wait for one sec for file to be created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
| yield I.amOnPage(siteUrl); | ||
| const url = yield browser.getCurrentUrl(); | ||
| return url.should.eql(`${site_url}/`); | ||
| return url.should.eql(`${siteUrl}/`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
|
|
||
| it('should open absolute url', function* () { | ||
| I.amOnPage(site_url); | ||
| yield I.amOnPage(siteUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'yield' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
| yield I.amOnPage('/info'); | ||
| const url = yield browser.getCurrentUrl(); | ||
| return url.should.eql(`${site_url}/info`); | ||
| return url.should.eql(`${siteUrl}/info`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
|
|
||
| it('should open any page of configured site', function* () { | ||
| I.amOnPage('/info'); | ||
| yield I.amOnPage('/info'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'yield' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
| yield I.amOnPage('/'); | ||
| const url = yield browser.getCurrentUrl(); | ||
| return url.should.eql(`${site_url}/`); | ||
| return url.should.eql(`${siteUrl}/`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'template literal syntax' is only available in ES6 (use 'esversion: 6').
| describe('open page : #amOnPage', () => { | ||
| it('should open main page of configured site', function* () { | ||
| I.amOnPage('/'); | ||
| yield I.amOnPage('/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'yield' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
test/helper/Protractor_test.js
Outdated
| if (I.isProtractor5) return; | ||
| return I.waitForText('Boom!', 0.5) | ||
| .thenCatch((e) => { | ||
| .then(() => { throw new Error('😟') }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
test/helper/Protractor_test.js
Outdated
| if (I.isProtractor5) return; | ||
| return I.waitForText('Nothing here', 0, '#hello') | ||
| .thenCatch((e) => { | ||
| .then(() => { throw new Error('😟') }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
test/helper/Protractor_test.js
Outdated
| url: siteUrl, | ||
| browser: 'chrome', | ||
| seleniumAddress: TestHelper.seleniumAddress(), | ||
| angular: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing trailing comma comma-dangle
lib/locator.js
Outdated
|
|
||
| function isXPath(locator) { | ||
| return locator.substr(0, 2) === '//' || locator.substr(0, 3) === './/'; | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
lib/locator.js
Outdated
|
|
||
| function isXPath(locator) { | ||
| return locator.substr(0, 2) === '//' || locator.substr(0, 3) === './/'; | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
|
|
||
| const site_url = 'http://davertmik.github.io/angular-demo-app'; | ||
| const web_app_url = TestHelper.siteUrl(); | ||
| const TestHelper = require('../support/TestHelper'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module '../support/TestHelper' import/no-unresolved
|
|
||
| let I; | ||
| let browser; | ||
| const should = require('chai').should(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module 'chai' import/no-unresolved
| const fileExists = require('../../lib/utils').fileExists; | ||
| const Protractor = require('../../lib/helper/Protractor'); | ||
| const AssertionFailedError = require('../../lib/assert/error'); | ||
| const webApiTests = require('./webapi'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module './webapi' import/no-unresolved
| const path = require('path'); | ||
| const fs = require('fs'); | ||
| const fileExists = require('../../lib/utils').fileExists; | ||
| const Protractor = require('../../lib/helper/Protractor'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module '../../lib/helper/Protractor' import/no-unresolved
| @@ -0,0 +1,165 @@ | |||
| const xpathLocator = require('./utils').xpathLocator; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module './utils' import/no-unresolved
| const co = require('co'); | ||
| const path = require('path'); | ||
| const recorder = require('../recorder'); | ||
| const ElementNotFound = require('./errors/ElementNotFound'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module './errors/ElementNotFound' import/no-unresolved
| const clearString = require('../utils').clearString; | ||
| const co = require('co'); | ||
| const path = require('path'); | ||
| const recorder = require('../recorder'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module '../recorder' import/no-unresolved
| @@ -1,4 +1,5 @@ | |||
| const requireg = require('requireg'); | |||
| const Locator = require('../locator'); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module '../locator' import/no-unresolved
| const els = await findFields(this.browser, locator); | ||
| assertElementExists(els, locator, 'Field'); | ||
| if (this.options.browser !== 'phantomjs') { | ||
| const remote = require('selenium-webdriver/remote'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module 'selenium-webdriver/remote' import/no-unresolved
| const ElementNotFound = require('./errors/ElementNotFound'); | ||
| const Locator = require('../locator'); | ||
| const path = require('path'); | ||
| const recorder = require('../recorder'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module '../recorder' import/no-unresolved
| "no-cond-assign": 0, | ||
| "array-callback-return": 0, | ||
| "function-paren-newline": 0 | ||
| "import/no-unresolved": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hound CI can't parse this rule. Also, it depends on current installation settings so strictly following it won't be helpful.
| "array-callback-return": 0, | ||
| "function-paren-newline": 0 | ||
| "import/no-unresolved": 0, | ||
| "no-await-in-loop": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have loops where await is used following if conditions. There is no clean way to rework it in Promise.all
| "function-paren-newline": 0 | ||
| "import/no-unresolved": 0, | ||
| "no-await-in-loop": 0, | ||
| "arrow-body-style": 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes some linex extra long and unreadable