diff --git a/.drone.env b/.drone.env index ec3d6f948d1..d01d93d7d53 100644 --- a/.drone.env +++ b/.drone.env @@ -2,6 +2,7 @@ CORE_COMMITID=8b15ef46e68cf73ea861d4f180ed1f6bff5096a8 CORE_BRANCH=master -# The test runner source for UI tests +# The test runner source for UI tests +# Matches the latest stable version on the web: v5.7.0-rc.5 WEB_COMMITID=0bb33e791f10f1afebfde4ea4da356e46ecdc201 -WEB_BRANCH=master +WEB_BRANCH=master \ No newline at end of file diff --git a/.drone.star b/.drone.star index 4ce8ab9d135..d5b75693e5a 100644 --- a/.drone.star +++ b/.drone.star @@ -103,6 +103,10 @@ config = { "skipExceptParts": [], "earlyFail": True, }, + "e2eTests": { + "skip": False, + "earlyFail": True, + }, "settingsUITests": { "skip": False, "earlyFail": True, @@ -317,6 +321,18 @@ def yarnInstallUITests(): ], }] +def yarnInstallE2eTests(): + return [{ + "name": "yarn-install-e2e", + "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, + "commands": [ + ". /drone/src/.drone.env", + "cd webTestRunner", + "git checkout $WEB_COMMITID", + "retry -t 3 'yarn install --immutable'", + ], + }] + def testOcisModules(ctx): pipelines = [] for module in config["modules"]: @@ -372,6 +388,9 @@ def testPipelines(ctx): if "skip" not in config["uiTests"] or not config["uiTests"]["skip"]: pipelines += uiTests(ctx) + if "skip" not in config["e2eTests"] or not config["e2eTests"]["skip"]: + pipelines += e2eTests(ctx) + if "skip" not in config["settingsUITests"] or not config["settingsUITests"]["skip"]: pipelines.append(settingsUITests(ctx)) @@ -835,6 +854,131 @@ def uiTestPipeline(ctx, filterTags, early_fail, runPart = 1, numberOfParts = 1, }, } +def e2eTests(ctx): + e2e_trigger = { + "ref": [ + "refs/heads/master", + "refs/tags/**", + "refs/pull/**", + ], + } + + e2e_volumes = [{ + "name": "uploads", + "temp": {}, + }, { + "name": "configs", + "temp": {}, + }, { + "name": "gopath", + "temp": {}, + }] + + e2e_test_ocis = [{ + "name": "e2e-tests", + "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, + "environment": { + "BASE_URL_OCIS": "ocis-server:9200", + "HEADLESS": "true", + "OCIS": "true", + "RETRY": "1", + "WEB_UI_CONFIG": "/drone/src/tests/config/drone/ocis-config.json", + "LOCAL_UPLOAD_DIR": "/uploads", + }, + "commands": [ + "cd webTestRunner", + "sleep 10 && yarn test:e2e:cucumber tests/e2e/cucumber/**/*[!.oc10].feature", + ], + }] + + e2eTestsSteps = \ + restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + \ + restoreBuildArtifactCache(ctx, "web-dist", "webTestRunner") + \ + yarnInstallE2eTests() + \ + ocisServer("ocis", 4, []) + \ + e2e_test_ocis + \ + uploadTracingResult(ctx) + \ + publishTracingResult(ctx, "e2e test") + + if ("full-ci" in ctx.build.title.lower() or ctx.build.event == "cron"): + return [{ + "kind": "pipeline", + "type": "docker", + "name": "e2e-tests", + "steps": e2eTestsSteps, + "depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]), + "trigger": e2e_trigger, + "volumes": e2e_volumes, + }] + return [] + +def uploadTracingResult(ctx): + return [{ + "name": "upload-tracing-result", + "image": PLUGINS_S3, + "pull": "if-not-exists", + "settings": { + "bucket": { + "from_secret": "cache_public_s3_bucket", + }, + "endpoint": { + "from_secret": "cache_public_s3_server", + }, + "path_style": True, + "source": "webTestRunner/reports/e2e/playwright/tracing/**/*", + "strip_prefix": "webTestRunner/reports/e2e/playwright/tracing", + "target": "${DRONE_BUILD_NUMBER}/tracing", + }, + "environment": { + "AWS_ACCESS_KEY_ID": { + "from_secret": "cache_public_s3_access_key", + }, + "AWS_SECRET_ACCESS_KEY": { + "from_secret": "cache_public_s3_secret_key", + }, + }, + "when": { + "status": [ + "failure", + ], + "event": [ + "pull_request", + "cron", + ], + }, + }] + +def publishTracingResult(ctx, suite): + return [{ + "name": "publish-tracing-result", + "image": OC_UBUNTU, + "commands": [ + "cd webTestRunner/reports/e2e/playwright/tracing/", + 'echo "
:boom: To see the trace, please open the link in the console ...\\n\\n

\\n\\n" >> comments.file', + 'for f in *.zip; do echo "#### npx playwright show-trace $CACHE_ENDPOINT/$CACHE_BUCKET/${DRONE_BUILD_NUMBER}/tracing/$f \n" >> comments.file; done', + 'echo "\n

" >> comments.file', + "more comments.file", + ], + "environment": { + "TEST_CONTEXT": suite, + "CACHE_ENDPOINT": { + "from_secret": "cache_public_s3_server", + }, + "CACHE_BUCKET": { + "from_secret": "cache_public_s3_bucket", + }, + }, + "when": { + "status": [ + "failure", + ], + "event": [ + "pull_request", + "cron", + ], + }, + }] + def settingsUITests(ctx, storage = "ocis", accounts_hash_difficulty = 4): early_fail = config["settingsUITests"]["earlyFail"] if "earlyFail" in config["settingsUITests"] else False