-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from lacell75/asyncImprovement
Manage cucumber steps
- Loading branch information
Showing
7 changed files
with
172 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
When('I click on the element {string}', (selector) => { | ||
$(selector).click(); | ||
}); | ||
|
||
When('I am open webDriverIO', () => { | ||
browser.url('https://webdriver.io'); | ||
}); | ||
|
||
Given(/^I switch to frame "([^"]*)?"$/, switchToFrame); | ||
|
||
Then( | ||
/^I wait on element "([^"]*)?"(?: for (\d+)ms)*(?: to( not)* (be checked|be enabled|be selected|be displayed|contain a text|contain a value|exist|contain the text))*( "([^"]*)?")*$/, | ||
{ | ||
wrapperOptions: { | ||
retry: 3, | ||
}, | ||
}, | ||
waitFor | ||
); | ||
|
||
After((scenario) => { | ||
if (scenario.result.status === 'SKIPPED') { | ||
return true; | ||
} | ||
|
||
if (scenario.result.status === 'PASSED' && failureObject === null) { | ||
return true; | ||
} | ||
console.log('Save a screenshot'); | ||
browser.saveScreenshot(filePath); | ||
}); | ||
|
||
Before({ tags: '@NotMandatory' }, () => { | ||
if (browser.params.featureContext === 'skip NotMandatory scenarios') { | ||
return 'skipped'; | ||
} | ||
return true; | ||
}); | ||
|
||
BeforeStep((feat) => { | ||
const scenario = JSON.stringify(feat.pickle); | ||
if (scenario && (scenario.includes('endif') || scenario.includes('else'))) { | ||
return true; | ||
} | ||
if (browser.params.scenarioContext === 'skip next steps') { | ||
return 'skipped'; | ||
} | ||
return true; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
When('I click on the element {string}', async selector => { | ||
await $(selector).click(); | ||
}); | ||
|
||
When('I am open webDriverIO', async () => { | ||
await browser.url('https://webdriver.io'); | ||
}); | ||
|
||
Given(/^I switch to frame "([^"]*)?"$/, switchToFrame); | ||
|
||
Then( | ||
/^I wait on element "([^"]*)?"(?: for (\d+)ms)*(?: to( not)* (be checked|be enabled|be selected|be displayed|contain a text|contain a value|exist|contain the text))*( "([^"]*)?")*$/, | ||
{ | ||
wrapperOptions: { | ||
retry: 3, | ||
}, | ||
}, | ||
waitFor | ||
); | ||
|
||
After(async scenario => { | ||
if (scenario.result.status === 'SKIPPED') { | ||
return true; | ||
} | ||
|
||
if (scenario.result.status === 'PASSED' && failureObject === null) { | ||
return true; | ||
} | ||
console.log('Save a screenshot'); | ||
await browser.saveScreenshot(filePath); | ||
}); | ||
|
||
Before({ tags: '@NotMandatory' }, async () => { | ||
if (browser.params.featureContext === 'skip NotMandatory scenarios') { | ||
return 'skipped'; | ||
} | ||
return true; | ||
}); | ||
|
||
BeforeStep((feat) => { | ||
const scenario = JSON.stringify(feat.pickle); | ||
if (scenario && (scenario.includes('endif') || scenario.includes('else'))) { | ||
return true; | ||
} | ||
if (browser.params.scenarioContext === 'skip next steps') { | ||
return 'skipped'; | ||
} | ||
return true; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters