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

Added waitForPageToLoad function #57

Merged
merged 45 commits into from
Mar 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e0113a3
More code cleaning
Marketionist Mar 11, 2018
2cad97b
Added waitForLoaded function
Marketionist Mar 11, 2018
15b4188
Refactored wdio.conf.js to use steps.conf.js
Marketionist Mar 11, 2018
13ab29a
Added 'I click' step and test
Marketionist Mar 11, 2018
377ee6f
Renamed waitForPageToLoad()
Marketionist Mar 13, 2018
5e3c0e9
Refactored stepsConfig for global usage
Marketionist Mar 14, 2018
e323c9b
Fixed mocha tests to include stepsConfig
Marketionist Mar 14, 2018
5d262b4
We should not ignore .vscode/settings.json file
alexkrechik Mar 17, 2018
2942a0b
Fixed finishedLoadingConditions function
alexkrechik Mar 17, 2018
fa124c4
Fixed I click ${pageObject}$ method
alexkrechik Mar 17, 2018
0828574
Attempt to add .vscode folder
alexkrechik Mar 17, 2018
7cb8cd9
Added vscode settings.json file
alexkrechik Mar 17, 2018
9bb36e3
Removed unnecessary waiter in the end of feature
alexkrechik Mar 18, 2018
7a127c2
Separate steps config logic and values provided.
alexkrechik Mar 18, 2018
c0d1f18
Apply commands via applyStepsCommands function
alexkrechik Mar 18, 2018
81bbe4e
Using of config finishedLoadingConditions
alexkrechik Mar 18, 2018
46c7cc9
Using of const were possible
alexkrechik Mar 18, 2018
d1fed7e
Using Class for Id. Fixed mocha tests.
alexkrechik Mar 18, 2018
21ce939
Some fixes due to Dima's review
alexkrechik Mar 18, 2018
475207b
Use ecmaVersion: 2017 for linting
Marketionist Mar 20, 2018
bfdd711
Refactored 'I click' step to use async await
Marketionist Mar 20, 2018
32073a5
Switched to node.js 7 to use async await
Marketionist Mar 20, 2018
ad08727
Updated tests to be more descriptive
Marketionist Mar 20, 2018
09d9d3b
Refactored When steps to use async await
Marketionist Mar 20, 2018
fd00403
Refactored Then steps to use async await
Marketionist Mar 20, 2018
0e4594a
Refactored Given steps to use async await
Marketionist Mar 20, 2018
c535e88
Added moveToObject for click
Marketionist Mar 20, 2018
032f67e
Added 'I doubleclick' step
Marketionist Mar 20, 2018
8fe45b3
Used scroll and 2 clicks for steps with clicks
Marketionist Mar 21, 2018
a6d411a
Bumped up wdio-cucumber-framework: ^1.1.0, wdio-selenium-standalone-s…
Marketionist Mar 21, 2018
07437d0
Added checkbox with some js for tests
Marketionist Mar 21, 2018
493fab5
Added tests for 'I click', 'I doubleclick' steps
Marketionist Mar 21, 2018
d551cbd
Updated new-page with text block for doubleclick
Marketionist Mar 21, 2018
9b9cbff
Returned to moveToObject and doubleClick as it is not depricated
Marketionist Mar 21, 2018
e53491e
Updated tests for click and doubleclick
Marketionist Mar 21, 2018
d0b0266
Added loaders to new-page
Marketionist Mar 22, 2018
f906ad9
Added loaders scripts, styles, images
Marketionist Mar 22, 2018
297edb9
Added tests for waitForPageToLoad
Marketionist Mar 22, 2018
96bfce4
Used executeAsync in waitForPageToLoad
Marketionist Mar 22, 2018
3883fac
Added promise to waitForPageToLoad
Marketionist Mar 23, 2018
352a59b
Added loadingFinished
Marketionist Mar 23, 2018
821262f
Refactored defaultFinishedLoadingConditions
Marketionist Mar 24, 2018
c6f9593
Fixed loaderSelectore visibility issues.
alexkrechik Mar 25, 2018
61bc704
Fixed defaultFinishedLoadingConditions returnvalue
alexkrechik Mar 25, 2018
069847e
Fixed waitForPageToLoad function
alexkrechik Mar 25, 2018
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
4 changes: 2 additions & 2 deletions src/helpers/objects.processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function pageObjectGetter (str) {
function getPageObject (str) {
const pageObjectGetterFunc = stepsConfig.objectsProcessor.pageObjectGetter || pageObjectGetter;
const value = pageObjectGetterFunc(str);
const idValue = value.replace(_r(regDynamicId, 'g'), stepsConfig.id.getId());
const idValue = value.replace(_r(regDynamicId, 'g'), stepsConfig.id.id);
Copy link
Member Author

Choose a reason for hiding this comment

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

stepsConfig.id.id - sounds a bit strange - maybe it will be better to name it stepsConfig.id.idValue?

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 Expand Up @@ -99,7 +99,7 @@ function dictionaryGetter (str) {
function getDictionaryObject (str) {
const dictionaryGetterFunc = stepsConfig.objectsProcessor.dictionaryGetter || dictionaryGetter;
const value = dictionaryGetterFunc(str);
const idValue = value.replace(_r(regDynamicId, 'g'), stepsConfig.id.getId());
const idValue = value.replace(_r(regDynamicId, 'g'), stepsConfig.id.id);
Copy link
Member Author

Choose a reason for hiding this comment

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

stepsConfig.id.id - sounds a bit strange - maybe it will be better to name it stepsConfig.id.idValue?


return idValue;
}
Expand Down
14 changes: 9 additions & 5 deletions src/steps.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ module.exports = function ({
idGenerator = defaultIdGenerator, // <() => <string|number>> - function, that will return new generated id.
objectsProcessor = {} // objectsProcessor childs could be previded here - see objects.processor.js for more details.
}) {
const id = {
value: defaultIdValue || idGenerator.call(this),
getId: () => this.value,
regenerate: () => {
const Id = class {
constructor () {
this.value = defaultIdValue || idGenerator.call(this);
}
get id () {
Copy link
Member Author

Choose a reason for hiding this comment

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

stepsConfig.id.id - sounds a bit strange - maybe it will be better to name it stepsConfig.id.idValue?

return this.value;
}
regenerate () {
this.value = idGenerator.call(this);
}
};
Expand All @@ -30,7 +34,7 @@ module.exports = function ({
loaderSelectors,
finishedLoadingConditions: finishedLoadingConditions.bind(this, loaderSelectors),
pages,
id,
id: new Id(),
objectsProcessor
};
};
12 changes: 4 additions & 8 deletions test/mocha/objects.processor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,22 @@ const {
dynamicId
} = require('../../src/helpers/objects.processor');
const { _r } = require('../../src/helpers/utils');
const stepsConfigGenerator = require('../../src/steps.conf');

const realId = 12345;

// Makes stepsConfig visible globally to use stepsConfig.pages, stepsConfig.id, stepsConfig.loaderSelectors
global.stepsConfig = {};

global.stepsConfig.pages = {
const pages = {
main: {
object: `//div[@id='${dynamicId}']`
},
book: {
word: `dictionaryObject${dynamicId}`
}
};
const idGenerator = () => realId;

global.stepsConfig.id = {
getId: () => realId
};

global.objectsProcessor = {};
global.stepsConfig = stepsConfigGenerator({ pages, idGenerator });

describe('injectInto', () => {
const data = [
Expand Down