woocommerce / woocommerce-e2e-boilerplate

GNU General Public License v3.0
18 stars 3 forks source link

Example test fails with "products.grouped" is not defined #28

Closed BrianHenryIE closed 2 years ago

BrianHenryIE commented 2 years ago

The example test in the repo is failing with error:

Configuration property "products.grouped" is not defined

Steps to reproduce:

git clone https://github.com/woocommerce/woocommerce-e2e-boilerplate.git
cd woocommerce-e2e-boilerplate

echo v12 > .nvmrc
nvm use

npm init

nano package.json

> "docker:down": "npx wc-e2e docker:down",
> "docker:ssh": "npx wc-e2e docker:ssh",
> "docker:up": "npx wc-e2e docker:up",
> "test:e2e": "npx wc-e2e test:e2e",
> "test:e2e-debug": "npx wc-e2e test:e2e-debug",
> "test:e2e-dev": "npx wc-e2e test:e2e-d

npm i --save-dev @woocommerce/e2e-environment @woocommerce/e2e-utils @woocommerce/api jest

npm run docker:up

Fails with

key cannot contain a space

which is fixed upstream and can be fixed here with:

find ./node_modules/@woocommerce/e2e-environment/.env -exec sed -i '' 's/WORDPRESS_TITLE=WooCommerce Core E2E Test Suite/WORDPRESS_TITLE="WooCommerce Core E2E Test Suite"/g' {} +
npm run docker:up

npm run test:e2e

Fails with:

> woocommerce-e2e-boilerplate@1.0.0 test:e2e /Users/brianhenry/Sites/wce2e-productsgrouped/woocommerce-e2e-boilerplate
> npx wc-e2e test:e2e

Testing URL: http://localhost:8084

 FAIL  ../../../tests/e2e/specs/example.test.js
  ● Test suite failed to run

    Configuration property "products.grouped" is not defined

      at Config.get (../e2e-utils/node_modules/config/lib/config.js:182:11)
      at Object.<anonymous> (../../../../../../../ronrennick/Sites/solaris/woocommerce/tests/e2e/utils/src/components.js:26:38)
      at Object.<anonymous> (../../../../../../../ronrennick/Sites/solaris/woocommerce/tests/e2e/utils/src/index.js:12:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.942s
Ran all test suites.
Jest exit code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! woocommerce-e2e-boilerplate@1.0.0 test:e2e: `npx wc-e2e test:e2e`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the woocommerce-e2e-boilerplate@1.0.0 test:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brianhenry/.npm/_logs/2021-11-28T21_35_28_494Z-debug.log

And that debug.log is:


0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/brianhenry/.nvm/versions/node/v12.22.1/bin/node',
1 verbose cli   '/Users/brianhenry/.nvm/versions/node/v12.22.1/bin/npm',
1 verbose cli   'run',
1 verbose cli   'test:e2e'
1 verbose cli ]
2 info using npm@6.14.13
3 info using node@v12.22.1
4 verbose run-script [ 'pretest:e2e', 'test:e2e', 'posttest:e2e' ]
5 info lifecycle woocommerce-e2e-boilerplate@1.0.0~pretest:e2e: woocommerce-e2e-boilerplate@1.0.0
6 info lifecycle woocommerce-e2e-boilerplate@1.0.0~test:e2e: woocommerce-e2e-boilerplate@1.0.0
7 verbose lifecycle woocommerce-e2e-boilerplate@1.0.0~test:e2e: unsafe-perm in lifecycle true
8 verbose lifecycle woocommerce-e2e-boilerplate@1.0.0~test:e2e: PATH: /Users/brianhenry/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/brianhenry/Sites/wc$
9 verbose lifecycle woocommerce-e2e-boilerplate@1.0.0~test:e2e: CWD: /Users/brianhenry/Sites/wce2e-productsgrouped/woocommerce-e2e-boilerplate
10 silly lifecycle woocommerce-e2e-boilerplate@1.0.0~test:e2e: Args: [ '-c', 'npx wc-e2e test:e2e' ]
11 silly lifecycle woocommerce-e2e-boilerplate@1.0.0~test:e2e: Returned: code: 1  signal: null
12 info lifecycle woocommerce-e2e-boilerplate@1.0.0~test:e2e: Failed to exec test:e2e script
13 verbose stack Error: woocommerce-e2e-boilerplate@1.0.0 test:e2e: `npx wc-e2e test:e2e`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/brianhenry/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/Users/brianhenry/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1022:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid woocommerce-e2e-boilerplate@1.0.0
15 verbose cwd /Users/brianhenry/Sites/wce2e-productsgrouped/woocommerce-e2e-boilerplate
16 verbose Darwin 21.1.0
17 verbose argv "/Users/brianhenry/.nvm/versions/node/v12.22.1/bin/node" "/Users/brianhenry/.nvm/versions/node/v12.22.1/bin/npm" "run" "test:e2e"
18 verbose node v12.22.1
19 verbose npm  v6.14.13
20 error code ELIFECYCLE
21 error errno 1
22 error woocommerce-e2e-boilerplate@1.0.0 test:e2e: `npx wc-e2e test:e2e`
22 error Exit status 1
23 error Failed at the woocommerce-e2e-boilerplate@1.0.0 test:e2e script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I presume this is also fixed upstream. Is there a way of using nightly packages that might fix this? Better yet, nightly pinned to known working commits?

rrennick commented 2 years ago

I presume this is also fixed upstream. Is there a way of using nightly packages that might fix this?

@BrianHenryIE Thanks for reporting this issue. Does your default.json have the grouped product entry?

BrianHenryIE commented 2 years ago

Thanks. That got the test running.

Specifically, I copied the entire contents of e2e/config/default.json you linked into node_modules/@woocommerce/e2e-environment/config/default/default.json.

rrennick commented 2 years ago

@BrianHenryIE Thanks for the follow up. Great that you got it running. I'm working on https://github.com/woocommerce/woocommerce/pull/31260 which should help highlight this type of issue in the future.