From 775b7614b5c376d550a3a8d84ce3c12ccfb8651f Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Thu, 19 May 2022 22:52:15 +0200 Subject: [PATCH 1/3] add e2e pipline --- .drone.env | 5 +- .drone.star | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index ec3d6f948d1..cd7dc7d4945 100644 --- a/.drone.env +++ b/.drone.env @@ -3,5 +3,8 @@ CORE_COMMITID=8b15ef46e68cf73ea861d4f180ed1f6bff5096a8 CORE_BRANCH=master # The test runner source for UI tests -WEB_COMMITID=0bb33e791f10f1afebfde4ea4da356e46ecdc201 +WEB_COMMITID=7747d8385ef7ddc81a86e97ae233ee946190973b WEB_BRANCH=master + +# e2e tests use the latest stable version on web +WEB_ASSETS_VERSION=v5.7.0-rc.5 \ No newline at end of file diff --git a/.drone.star b/.drone.star index 4ce8ab9d135..8c917878efd 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, @@ -372,6 +376,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 +842,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": [ + ". /drone/src/.drone.env", + "git clone -b $WEB_ASSETS_VERSION --single-branch --no-tags https://github.com/owncloud/web.git e2eTests", + "cd e2eTests", + "retry -t 3 'yarn install --immutable'", + "sleep 10 && yarn test:e2e:cucumber tests/e2e/cucumber/**/*[!.oc10].feature", + ], + }] + + e2eTestsSteps = \ + restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + \ + 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": "e2eTests/reports/e2e/playwright/tracing/**/*", + "strip_prefix": "e2eTests/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 e2eTests/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", + ], + }, + }] + def settingsUITests(ctx, storage = "ocis", accounts_hash_difficulty = 4): early_fail = config["settingsUITests"]["earlyFail"] if "earlyFail" in config["settingsUITests"] else False From ccc07597b67729470e5084c07bcbdc87476bfef2 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Mon, 1 Aug 2022 00:08:14 +0200 Subject: [PATCH 2/3] gave web commit back --- .drone.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index cd7dc7d4945..ea6674eda3b 100644 --- a/.drone.env +++ b/.drone.env @@ -3,7 +3,7 @@ CORE_COMMITID=8b15ef46e68cf73ea861d4f180ed1f6bff5096a8 CORE_BRANCH=master # The test runner source for UI tests -WEB_COMMITID=7747d8385ef7ddc81a86e97ae233ee946190973b +WEB_COMMITID=0bb33e791f10f1afebfde4ea4da356e46ecdc201 WEB_BRANCH=master # e2e tests use the latest stable version on web From 6ae1b56976139a78c8e3f35bc7038cba40181cc5 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Tue, 2 Aug 2022 13:32:21 +0200 Subject: [PATCH 3/3] try run test in webTestRunner --- .drone.env | 8 +++----- .drone.star | 26 +++++++++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.drone.env b/.drone.env index ea6674eda3b..d01d93d7d53 100644 --- a/.drone.env +++ b/.drone.env @@ -2,9 +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 - -# e2e tests use the latest stable version on web -WEB_ASSETS_VERSION=v5.7.0-rc.5 \ No newline at end of file +WEB_BRANCH=master \ No newline at end of file diff --git a/.drone.star b/.drone.star index 8c917878efd..d5b75693e5a 100644 --- a/.drone.star +++ b/.drone.star @@ -321,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"]: @@ -874,16 +886,15 @@ def e2eTests(ctx): "LOCAL_UPLOAD_DIR": "/uploads", }, "commands": [ - ". /drone/src/.drone.env", - "git clone -b $WEB_ASSETS_VERSION --single-branch --no-tags https://github.com/owncloud/web.git e2eTests", - "cd e2eTests", - "retry -t 3 'yarn install --immutable'", + "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) + \ @@ -914,8 +925,8 @@ def uploadTracingResult(ctx): "from_secret": "cache_public_s3_server", }, "path_style": True, - "source": "e2eTests/reports/e2e/playwright/tracing/**/*", - "strip_prefix": "e2eTests/reports/e2e/playwright/tracing", + "source": "webTestRunner/reports/e2e/playwright/tracing/**/*", + "strip_prefix": "webTestRunner/reports/e2e/playwright/tracing", "target": "${DRONE_BUILD_NUMBER}/tracing", }, "environment": { @@ -942,7 +953,7 @@ def publishTracingResult(ctx, suite): "name": "publish-tracing-result", "image": OC_UBUNTU, "commands": [ - "cd e2eTests/reports/e2e/playwright/tracing/", + "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', @@ -963,6 +974,7 @@ def publishTracingResult(ctx, suite): ], "event": [ "pull_request", + "cron", ], }, }]