Closed stychu closed 2 years ago
No idea why providing exact POs doesn't work for you...
This should work as expected, in addition I would suggest doing something like:
include: {
I: './custom/steps_file',
pages: './pages',
fragments: './fragments',
}
and have an index.js
file in your pages
and fragments
folder, this way you don't need to update your config when you add new pages/fragments :) this would require you to move out the steps_file.js
too..
In my case, I just included them in the config file
include: {
data: './test.data.js',
searchAddressComp: '../../test/codeceptjs/components/searchAddress.js',
restaurantList: '../../test/codeceptjs/pages/RestaurantList',
loginPage: '../../test/codeceptjs/pages/LoginPage',
menuPage: '../../test/codeceptjs/pages/MenuPage',
checkoutPage: '../../test/codeceptjs/pages/CheckoutPage',
orderConfirmationPage: '../../test/codeceptjs/pages/orderConfirmationPage'
},
And call them directly in test file without any injection.
Before((I) => {
I.amOnPage('/_test');
searchAddressComp.addressInput(searchAddress);
});
Scenario('Search a restaurant on restaurant list', async (I) => {
const deliveryAddress = await I.grabTextFrom(restaurantList.deliveryAddress);
expect(deliveryAddress).to.eql(searchAddress);
restaurantList.searchRestaurant();
I.see(data.restaurantList.testRestaurantName);
});
@xMutaGenx solution somehow works but I would love to be able to do like @PeterNgTr but I can't achieve this ;/
@stychu are you using latest codeceptjs 2.0.7?
Yes @PeterNgTr
@stychu are you using the same name when doing export default
in your code
dashboardPage: './pages/dashboard.js',
like this
export default dashboardPage = {
...
}
I do have module.exports = {
@stychu please try my approach :)
@PeterNgTr what wersion of node ure using ?
@stychu 8.15
I thought we should use >=8.9.1
as per https://github.com/Codeception/CodeceptJS/blob/master/package.json#L94 @PeterNgTr
yeah 8.15
is > 8.9.1
:P
Derp, sorry T_T
@PeterNgTr I guess you are also using some transpilers? Could you share your package.json?
{
"name": "test-test",
"dependencies": {
"babel-preset-es2015": "6.24.1",
"babel-preset-stage-2": "6.24.1",
"bluebird": "2.9.13",
"brfs": "0.0.8",
"bromote": "~0.2.1",
"browserify": "14.4.0",
"browserstack-automate": "^1.0.2",
"cls-bluebird": "~1.0.0",
"compression": "1.7.0",
"continuation-local-storage": "^3.1.0",
"exorcist": "0.4.0",
"express": "^4.0.0",
"findit": "~0.1.2",
"ismobilejs": "~0.3.9",
"livereload-js": "2.2.2",
"lodash": "~2.4.1",
"md5": "^2.0.0",
"moment": "~2.17.0",
"moment-timezone": "~0.5.0",
"morgan": "1.8.2",
"newrelic": "~4.10.0",
"node-uuid": "^1.4.0",
"planout": "2.0.2",
"proxy-middleware": "~0.5.0",
"request": "~2.81.0",
"run-sequence": "1.1.0",
"rx": "^2.5.0",
"semver": "^5.3.0",
"sha256": "^0.2.0",
"sticky-kit": "1.1.3",
"through2-map": "^2.0.0",
"tiny-lr": "1.0.5",
"uglify-js": "3.0.28",
"underscore.string": "~2.3.3",
"virtual-dom": "2.1.1"
},
"devDependencies": {
"babel-eslint": "8.0.1",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-env": "1.6.1",
"babelify": "^7.3.0",
"chai": "4.1.2",
"chai-as-promised": "7.1.1",
"chai-json-schema": "1.5.0",
"commander": "2.13.0",
"del": "3.0.0",
"eslint": "4.7.1",
"eslint-config-airbnb": "15.1.0",
"eslint-config-dhg-phoenix": "0.0.11",
"eslint-friendly-formatter": "3.0.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.3.0",
"glob": "^6.0.0",
"gulp": "3.9.1",
"gulp-autoprefixer": "4.0.0",
"gulp-cached": "1.1.1",
"gulp-environments": "0.1.2",
"gulp-iconfont": "9.0.2",
"gulp-load-plugins": "1.5.0",
"gulp-minify-css": "1.2.4",
"gulp-nodemon": "2.2.1",
"gulp-notify": "3.0.0",
"gulp-plumber": "1.1.0",
"gulp-rev": "8.0.0",
"gulp-rev-replace": "0.4.3",
"gulp-sass": "3.1.0",
"gulp-sass-inheritance": "1.1.0",
"gulp-size": "^2.0.0",
"gulp-sourcemaps": "2.6.1",
"husky": "0.14.3",
"isomorphic-fetch": "2.2.1",
"longjohn": "0.2.12",
"mkdirp": "0.5.1",
"mocha": "3.5.0",
"node-neat": "^1.7.0",
"nyc": "12.0.2",
"proxyquire": "1.3.1",
"rosie": "2.0.1",
"shelljs": "0.8.1",
"sinon": "3.2.1",
"sinon-chai": "2.13.0",
"sinon-stub-promise": "4.0.0",
"vinyl-paths": "^2.1.0",
"eslint-plugin-codeceptjs": "0.4.0",
"webdriverio": "5.4.14",
"xmlhttprequest": "1.8.0",
"browserstack-local": "1.3.7",
"codeceptjs": "2.0.7",
"dateformat": "3.0.3",
"faker": "4.1.0",
"import-export": "1.0.1"
},
"scripts": {
}
}
hmm yeah I believe there is much more configuration needed to be able to use pgo like you but I don't have time for digging it right now :( BUt thanks @PeterNgTr
Okay, I've checked once again and it seems that I can provide exact PO's and it works. What misleads my judgment is that whenever I provide PO's which I want then I lose the ability for autocompletion and it highlights my functions from the PO's as unresolved/not recognized.
This is when I provide PO's as they're included in the config
This is when I import the exact PO. I lose autocompletion and its highlighted.
Both works but I want second one also give me autocompletion... Any idea @DavertMik maybe?
I am having the same issues. Would love to have a way to use autocompletion.
Yeah, I didn't found a solution :(
What are you trying to achieve?
When I have multipe pageobject I want to be able to include only specific ones
What do you get instead?
From the docs
It seems like I must provide all pageobjects in order as they are specified in the config in order to access them.