codeceptjs-cucumber
Advanced tools
Comparing version
@@ -1,15 +0,14 @@ | ||
module.exports = function () { | ||
function takeNap(seconds) { | ||
return seconds ? this.wait(seconds) : this.wait(1); | ||
return seconds ? this.wait(seconds) : this.wait(1); | ||
} | ||
function grabCss(css) { | ||
return { css: css }; | ||
} | ||
return {css: css}; | ||
} | ||
return actor({ | ||
takeNap: takeNap, | ||
grabCss: grabCss | ||
grabCss: grabCss | ||
}); | ||
}; | ||
}; |
@@ -6,7 +6,7 @@ const Helper = codeceptjs.helper; | ||
class FakerHelper extends Helper { | ||
async grabRandomString(length) { | ||
return Faker.random.alphaNumeric(length || 10); | ||
} | ||
async grabRandomString(length) { | ||
return Faker.random.alphaNumeric(length || 10); | ||
} | ||
} | ||
module.exports = FakerHelper; |
@@ -1,12 +0,12 @@ | ||
const { I } = inject(); | ||
const {I} = inject(); | ||
module.exports = { | ||
locators: { | ||
searchBox: '.header-search-input' | ||
}, | ||
locators: { | ||
searchBox: '.header-search-input' | ||
}, | ||
search(searchFor) { | ||
I.fillField(I.grabCss(this.locators.searchBox), searchFor); | ||
I.pressKey('Enter'); | ||
} | ||
search(searchFor) { | ||
I.fillField(I.grabCss(this.locators.searchBox), searchFor); | ||
I.pressKey('Enter'); | ||
} | ||
}; |
@@ -1,21 +0,21 @@ | ||
const { I } = inject(); | ||
const {I} = inject(); | ||
module.exports = { | ||
locators: { | ||
resultLink: 'li.repo-list-item>div>h3>a', | ||
description: 'p.col-12.col-md-9', | ||
licenseInfo: 'p.f6.text-gray' | ||
}, | ||
locators: { | ||
resultLink: 'li.repo-list-item>div>h3>a', | ||
description: 'p.col-12.col-md-9', | ||
licenseInfo: 'p.f6.text-gray' | ||
}, | ||
async grabHrefForResult() { | ||
return await I.grabAttributeFrom(I.grabCss(this.locators.resultLink), 'href'); | ||
}, | ||
async grabHrefForResult() { | ||
return await I.grabAttributeFrom(I.grabCss(this.locators.resultLink), 'href'); | ||
}, | ||
async grabDescription() { | ||
return await I.grabTextFrom(I.grabCss(this.locators.description)); | ||
}, | ||
async grabDescription() { | ||
return await I.grabTextFrom(I.grabCss(this.locators.description)); | ||
}, | ||
async grabLicenseInfo() { | ||
return await I.grabTextFrom(I.grabCss(this.locators.licenseInfo)); | ||
} | ||
async grabLicenseInfo() { | ||
return await I.grabTextFrom(I.grabCss(this.locators.licenseInfo)); | ||
} | ||
}; |
@@ -1,6 +0,6 @@ | ||
const { I } = inject(); | ||
const {I} = inject(); | ||
const should = require('should/should'); | ||
Before(async () => { | ||
I.amOnPage('/#/'); | ||
I.amOnPage('/#/'); | ||
}); |
@@ -1,26 +0,26 @@ | ||
const { I, ghHomePage, ghSearchPage } = inject(); | ||
const {I, ghHomePage, ghSearchPage} = inject(); | ||
Given('Fred is on Github Homepage', () => { | ||
// navigate - genarally this should be part of Before hook. | ||
// But to explain Background in feature file, we have it in stepdef | ||
I.amOnPage('/'); | ||
// navigate - genarally this should be part of Before hook. | ||
// But to explain Background in feature file, we have it in stepdef | ||
I.amOnPage('/'); | ||
}); | ||
When(/he searches for the \"([^\"]*)\"/, searchFor => { | ||
ghHomePage.search(searchFor); | ||
ghHomePage.search(searchFor); | ||
}); | ||
Then(/he is able to see the \"([^\\"]*)\" in search results/, async (result) => { | ||
// verify Element Attribute | ||
(await ghSearchPage.grabHrefForResult())[0].should.containEql(result); | ||
// verify Element Attribute | ||
(await ghSearchPage.grabHrefForResult())[0].should.containEql(result); | ||
}); | ||
Then(/he sees all the detailed highlighted results including description or license info and many more/, | ||
async () => { | ||
// verify Complete Text | ||
(await ghSearchPage.grabDescription()).trim().should.equal('CodeceptJS E2E Framework with Cucumber, SauceLabs'); | ||
async () => { | ||
// verify Complete Text | ||
(await ghSearchPage.grabDescription()).trim().should.equal('CodeceptJS E2E Framework with Cucumber, SauceLabs'); | ||
// verify Partial Text | ||
// because there are two results for the same element, the result is in Array | ||
(await ghSearchPage.grabLicenseInfo())[0].should.containEql('MIT'); | ||
}); | ||
// verify Partial Text | ||
// because there are two results for the same element, the result is in Array | ||
(await ghSearchPage.grabLicenseInfo())[0].should.containEql('MIT'); | ||
}); |
@@ -21,31 +21,31 @@ let debug = require('debug')('acceptance:config'); | ||
let conf = { | ||
output: RELATIVE_PATH + 'report', | ||
cleanup: true, | ||
dev: { | ||
host: HOST | ||
}, | ||
helpers: { | ||
WebDriver: { | ||
url: HOST | ||
output: RELATIVE_PATH + 'report', | ||
cleanup: true, | ||
dev: { | ||
host: HOST | ||
}, | ||
Faker: { | ||
require: RELATIVE_PATH + 'helpers/faker.helper.js' | ||
helpers: { | ||
WebDriver: { | ||
url: HOST | ||
}, | ||
Faker: { | ||
require: RELATIVE_PATH + 'helpers/faker.helper.js' | ||
}, | ||
REST: {} | ||
}, | ||
REST: {} | ||
}, | ||
gherkin: { | ||
features: RELATIVE_PATH + 'features/**/*.feature', | ||
steps: [ | ||
STEPS_PATH + 'search/github.steps.js', | ||
STEPS_PATH + 'hooks/hooks.js' | ||
] | ||
}, | ||
include: { | ||
I: RELATIVE_PATH + 'helpers/custom.methods.js', | ||
ghHomePage: PAGES_PATH + 'github/gh-home.page.js', | ||
ghSearchPage: PAGES_PATH + 'github/gh-search.page.js' | ||
}, | ||
name: 'Github Acceptance Tests' | ||
gherkin: { | ||
features: RELATIVE_PATH + 'features/**/*.feature', | ||
steps: [ | ||
STEPS_PATH + 'search/github.steps.js', | ||
STEPS_PATH + 'hooks/hooks.js' | ||
] | ||
}, | ||
include: { | ||
I: RELATIVE_PATH + 'helpers/custom.methods.js', | ||
ghHomePage: PAGES_PATH + 'github/gh-home.page.js', | ||
ghSearchPage: PAGES_PATH + 'github/gh-search.page.js' | ||
}, | ||
name: 'Github Acceptance Tests' | ||
}; | ||
exports.config = merge(merge(conf, codeceptJsShared.conf), codeceptJsSauce.conf(SAUCE_USERNAME, SAUCE_KEY)); |
{ | ||
"name": "codeceptjs-cucumber", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "CodeceptJs Cucumber ", | ||
@@ -25,3 +25,3 @@ "scripts": { | ||
"codeceptjs": "^2.2.0", | ||
"codeceptjs-saucelabs": "^1.1.3", | ||
"codeceptjs-saucelabs": "^1.1.4", | ||
"codeceptjs-selenium": "^1.0.2", | ||
@@ -38,3 +38,3 @@ "debug": "^4.1.1", | ||
"license": "MIT", | ||
"gitHead": "c123449335a761f9b7df1b7896cfa56ead6acba3" | ||
"gitHead": "9cae5efdeb1f347513325432fae5ac56e57eb387" | ||
} |
Sorry, the diff of this file is not supported yet
30843
-99.34%13
-91.56%