From 39ecbce3f549b74a383d10ffb46196c5a02da151 Mon Sep 17 00:00:00 2001 From: Ruslan Gagarin Date: Wed, 22 Jan 2025 11:13:54 -0800 Subject: [PATCH] Integrate e2e-test-cycloud job with Buildmaster Issue: FEI-6125 --- jobs/e2e-test-cycloud.groovy | 22 ++++++++++++++++------ jobs/e2e-test.groovy | 27 ++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/jobs/e2e-test-cycloud.groovy b/jobs/e2e-test-cycloud.groovy index 9c4ea45..09562e9 100644 --- a/jobs/e2e-test-cycloud.groovy +++ b/jobs/e2e-test-cycloud.groovy @@ -166,15 +166,25 @@ def runAllTestClients() { def runE2ETests(workerId) { echo("Starting e2e tests for worker ${workerId}"); - // Determine which environment we're running against, so we can provide a tag - // in the LambdaTest build. + // Define which environment we're running against, and setting up junit report def e2eEnv = E2E_URL == "https://www.khanacademy.org" ? "prod" : "preprod"; - - // NOTE: We hard-code the values here as it is an experiment that will be - // removed soon. - def runE2ETestsArgs = ["env", "CYPRESS_PROJECT_ID=2c1iwj", "CYPRESS_RECORD_KEY=4c530cf3-79e5-44b5-aedb-f6f017f38cb5", "./dev/cypress/e2e/tools/start-cypress-cloud-run.ts"]; + def resultsDir = "results"; // Directory to store results + def junitFile = "${resultsDir}/junit-${workerId}.xml"; + + // Ensure the results directory exists + sh("mkdir -p ${resultsDir}"); + + def runE2ETestsArgs = [ + "./dev/cypress/e2e/tools/start-cypress-cloud-run.ts", + "--cyConfig baseUrl=\"${E2E_URL}\"", + "--reporter mocha-junit-reporter", + "--reporter-options mochaFile=${junitFile}" + ]; dir('webapp/services/static') { + // We build the secrets first, so that we can create test users in our + // tests. + sh("yarn cypress:secrets"); exec(runE2ETestsArgs); } } diff --git a/jobs/e2e-test.groovy b/jobs/e2e-test.groovy index a22b6c3..3771c74 100644 --- a/jobs/e2e-test.groovy +++ b/jobs/e2e-test.groovy @@ -217,6 +217,27 @@ def runLambdaTest() { } } +def runCypressCloud(){ + build(job: 'e2e-test-cycloud', + parameters: [ + string(name: 'SLACK_CHANNEL', value: "#cypress-testing"), + string(name: 'REVISION_DESCRIPTION', value: REVISION_DESCRIPTION), + string(name: 'DEPLOYER_USERNAME', value: params.DEPLOYER_USERNAME), + string(name: 'URL', value: E2E_URL), + string(name: 'NUM_WORKER_MACHINES', value: params.NUM_WORKER_MACHINES), + string(name: 'TEST_RETRIES', value: "1"), + // It takes about 5 minutes to run all the Cypress e2e tests when + // using the default of 20 workers. This build is running in parallel + // with runTests(). During this test run we don't want to disturb our + // mainstream e2e pipeline, so set propagate to false. + ], + propagate: false, + // The pipeline will NOT wait for this job to complete to avoid + // blocking the main pipeline (runLambdaTest). + wait: false, + ); +} + // This method filters a common 'DEPLOYER_USERNAME' into a series of comma // seperated slack user id's. For Example: // DEPLOYER_USERNAME: <@UMZGEUH09> (cc <@UN5UC0EM6>) @@ -338,7 +359,11 @@ onWorker(WORKER_TYPE, '5h') { // timeout // tests failed. That is, this will succeed as long as there // are no lambdatest framework errors; it's up to use to look // for actual smoketest-code errors in analyzeResults(), below. - runLambdaTest(); + parallel([ + "run-lambdatest": { runLambdaTest(); }, + "test-cycloud": { runCypressCloud(); }, + ]); + // runLambdaTest(); } stage("Analyzing results") {