From 0b9521278a34344f8bfe63f3127601a2006bf03c Mon Sep 17 00:00:00 2001 From: Ankit Singh <2501.ankit@gmail.com> Date: Tue, 18 Feb 2025 11:36:51 +0530 Subject: [PATCH 1/3] add: handling for different folder structure turboscale --- bin/helpers/utils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/helpers/utils.js b/bin/helpers/utils.js index 095ebab1..1edfd3f9 100644 --- a/bin/helpers/utils.js +++ b/bin/helpers/utils.js @@ -1112,6 +1112,13 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession if (bsConfig.run_settings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) { defaultSpecFolder = Constants.DEFAULT_CYPRESS_10_SPEC_PATH testFolderPath = defaultSpecFolder + if (turboScaleSession) { + testFolderPath = + cypressConfig.integrationFolder && + cypressConfig.integrationFolder !== '.' + ? cypressConfig.integrationFolder + : defaultSpecFolder; + } // Read cypress config if enforce_settings is not present if(this.isUndefinedOrFalse(bsConfig.run_settings.enforce_settings) && !this.isUndefined(cypressConfig) && !this.isUndefined(cypressConfig.e2e)) { if(!this.isUndefined(cypressConfig.e2e.specPattern)) { From 69ea1cd00d9a9d6dcc46116b253618c3c5f2a4b4 Mon Sep 17 00:00:00 2001 From: Ankit Singh <2501.ankit@gmail.com> Date: Tue, 18 Feb 2025 12:21:20 +0530 Subject: [PATCH 2/3] add: handling for different folder structure turboscale --- bin/helpers/utils.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/helpers/utils.js b/bin/helpers/utils.js index 1edfd3f9..c90f1429 100644 --- a/bin/helpers/utils.js +++ b/bin/helpers/utils.js @@ -1112,13 +1112,6 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession if (bsConfig.run_settings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) { defaultSpecFolder = Constants.DEFAULT_CYPRESS_10_SPEC_PATH testFolderPath = defaultSpecFolder - if (turboScaleSession) { - testFolderPath = - cypressConfig.integrationFolder && - cypressConfig.integrationFolder !== '.' - ? cypressConfig.integrationFolder - : defaultSpecFolder; - } // Read cypress config if enforce_settings is not present if(this.isUndefinedOrFalse(bsConfig.run_settings.enforce_settings) && !this.isUndefined(cypressConfig) && !this.isUndefined(cypressConfig.e2e)) { if(!this.isUndefined(cypressConfig.e2e.specPattern)) { @@ -1186,6 +1179,11 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession logger.debug(`${files ? files.length : 0} spec files found`); if (turboScaleSession) { + if (bsConfig.run_settings.turboScaleOptions && bsConfig.run_settings.turboScaleOptions.integrationFolder) { + // this is in case the user's project does not use the default path 'cypress/e2e' + // add integrationFolder in turboScaleOptions in browserstack.json + testFolderPath = bsConfig.run_settings.turboScaleOptions.integrationFolder; + } // remove unwanted path prefix for turboscale files = files.map((x) => { return path.join(testFolderPath, x.split(testFolderPath)[1]) }) // setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI From 399622f6e47716b83a97c4586a68093b5bc5f931 Mon Sep 17 00:00:00 2001 From: Ankit Singh <2501.ankit@gmail.com> Date: Tue, 18 Feb 2025 18:21:29 +0530 Subject: [PATCH 3/3] add: handling for different folder structure turboscale --- bin/helpers/utils.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/bin/helpers/utils.js b/bin/helpers/utils.js index c90f1429..385cb31c 100644 --- a/bin/helpers/utils.js +++ b/bin/helpers/utils.js @@ -1179,15 +1179,17 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession logger.debug(`${files ? files.length : 0} spec files found`); if (turboScaleSession) { - if (bsConfig.run_settings.turboScaleOptions && bsConfig.run_settings.turboScaleOptions.integrationFolder) { - // this is in case the user's project does not use the default path 'cypress/e2e' - // add integrationFolder in turboScaleOptions in browserstack.json - testFolderPath = bsConfig.run_settings.turboScaleOptions.integrationFolder; + if (bsConfig.run_settings.cypress_config_file && bsConfig.run_settings.cypress_config_filename !== 'false') { + const configFilePath = path.resolve(bsConfig.run_settings.cypressConfigFilePath); + const directory = path.join(path.dirname(configFilePath), '/'); + // remove unwanted path prefix for turboscale + files = files.map((x) => { return path.join('', x.split(directory)[1]) }) + // setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI + bsConfig.run_settings.specs = files; + } else { + files = files.map((x) => { return path.join(testFolderPath, x.split(testFolderPath)[1]) }) + bsConfig.run_settings.specs = files; } - // remove unwanted path prefix for turboscale - files = files.map((x) => { return path.join(testFolderPath, x.split(testFolderPath)[1]) }) - // setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI - bsConfig.run_settings.specs = files; } return files; };