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

Create test suite files to be directly imported to jest, w/o scaffolding #33852

Closed
wants to merge 4 commits into from

Conversation

tomalec
Copy link
Member

@tomalec tomalec commented Jul 13, 2022

⚠️ This PR is based on #33828, as it is required to test it

All Submissions:

Changes proposed in this Pull Request:

Create test suite files to be directly imported by external packages/extensions directly via Jest config.
Without scaffolding, helpers, and the need to replicate file structure.

How to test the changes in this Pull Request:

  1. Take a repo that has e2e env set up already Add @woocommerce/admin-e2e-tests and execute them directly. google-listings-and-ads#1593
  2. Install/link this version of the packages in your repo (or follow Update config@3.3.7 (from 3.3.3) #33828, and copy admin-e2e-tests content directly to your repo node_modules
  3. Add following settings to your jest.config.js:
    // …
	roots: [
		// Your regular roots like:
        // path.resolve( __dirname, '../specs' ),
		// Execute `admin-e2e-tests` directly from node_modules.
		path.resolve(
			__dirname,
			'../../../node_modules/@woocommerce/admin-e2e-tests'
		),
	],
    // Include `node_modules`
	haste: {
		retainAllFiles: true,
	},
    // Ignore all other `node_modules/*` except  `node_modules/@woocommerce/admin-e2e-tests`
	transformIgnorePatterns: [
		'node_modules/(?!@woocommerce/admin-e2e-tests/.*)',
	],
	testPathIgnorePatterns: [
		'node_modules/(?!@woocommerce/admin-e2e-tests/.*)',
	],
  1. Run your e2e tests npm run test:e2e

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
    No, I tried building it locally, but pnpm -- turbo run build --filter=@woocommerce/admin-e2e-tests throws with:
 ERROR  workspace configuration error: package.json: no workspaces found. Turborepo requires npm workspaces to be defined in the root package.json
  • Have you created a changelog file for each project being changed, ie pnpm changelog add --filter=<project>?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

to be albe to run with jest 28.
to avoid `ReferenceError: node_env_var_name is not defined` when external extension imports and transforms the `admin-e2e-tests` directly from `node_modules`.

Include node-config/node-config#642
to make it possible to impor them locally.
so thay could be imported by external packages, and tested directyl, without the need of scafolding and calling helpers.
@github-actions github-actions bot added the package: @woocommerce/admin-e2e-tests issues related to @woocommerce/admin-e2e-tests label Jul 13, 2022
@github-actions
Copy link
Contributor

Test Results Summary

Commit SHA: 8bd8eec

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests11500201170m 52s
E2E Tests7574775018658m 32s
To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard

@samueljseay
Copy link
Contributor

We are closing this pull request, as it would need significant rework in its current state and the last activity has been quite some time ago. If you are still interested or feel this is a mistake, please open another PR based on a recent version of the trunk branch. Thanks!

@samueljseay samueljseay closed this May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: @woocommerce/admin-e2e-tests issues related to @woocommerce/admin-e2e-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants