Updated core-tests-root file

This commit is contained in:
Veljko 2021-03-25 18:12:54 +01:00
parent afd39e5866
commit 5b3bc1665d
2 changed files with 12 additions and 8 deletions

View File

@ -6,17 +6,21 @@
const getCoreTestsRoot = () => {
// Figure out where we're installed.
// Typically will be in node_modules/, but WooCommerce
// uses a local file path (tests/e2e/env).
// uses a local file path (tests/e2e/core-tests).
let coreTestsPath = false;
const moduleDir = path.dirname( require.resolve( '@woocommerce/e2e-environment' ) );
const moduleDir = path.dirname( require.resolve( '@woocommerce/e2e-core-tests' ) );
if ( -1 < moduleDir.indexOf( 'node_modules' ) ) {
coreTestsPath = moduleDir.split( 'node_modules' )[ 0 ];
} else if ( -1 < moduleDir.indexOf( 'tests/e2e/env' ) ) {
coreTestsPath = moduleDir.split( 'tests/e2e/env' )[ 0 ];
} else if ( -1 < moduleDir.indexOf( 'tests/e2e/core-tests' ) ) {
coreTestsPath = moduleDir.split( 'tests/e2e/core-tests' )[ 0 ];
}
return coreTestsPath;
return {
appRoot: coreTestsPath,
packageRoot: moduleDir,
};
};
module.exports = getCoreTestsRoot;
module.exports = getCoreTestsRoot;

View File

@ -19,8 +19,8 @@ const {
const path = require( 'path' );
const coreTestsPath = getCoreTestsRoot();
const filePath = path.resolve( coreTestsPath, 'sample-data/sample_products.csv' );
const filePathOverride = path.resolve( coreTestsPath, 'tests/e2e/core-tests/test-data/sample_products_override.csv' );
const filePath = path.resolve( coreTestsPath.appRoot, 'sample-data/sample_products.csv' );
const filePathOverride = path.resolve( coreTestsPath.packageRoot, 'test-data/sample_products_override.csv' );
const productNames = ["V-Neck T-Shirt", "Hoodie", "Hoodie with Logo", "T-Shirt", "Beanie",
"Belt", "Cap", "Sunglasses", "Hoodie with Pocket", "Hoodie with Zipper", "Long Sleeve Tee", "Polo", "Album",
"Single", "T-Shirt with Logo", "Beanie with Logo", "Logo Collection", "WordPress Pennant"];