From 6307a6ae9b233445ed1e09da1777e86c870cdca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 29 Feb 2024 13:57:21 +0100 Subject: [PATCH 1/5] wip --- package.json | 3 ++- tests/e2e/tsconfig.build.json | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 tests/e2e/tsconfig.build.json diff --git a/package.json b/package.json index 10b4f107aa9d..f70e591537bf 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,8 @@ "gh-actions-unused-styles": "./.github/scripts/findUnusedKeys.sh", "workflow-test": "./workflow_tests/scripts/runWorkflowTests.sh", "workflow-test:generate": "ts-node workflow_tests/utils/preGenerateTest.js", - "setup-https": "mkcert -install && mkcert -cert-file config/webpack/certificate.pem -key-file config/webpack/key.pem dev.new.expensify.com localhost 127.0.0.1" + "setup-https": "mkcert -install && mkcert -cert-file config/webpack/certificate.pem -key-file config/webpack/key.pem dev.new.expensify.com localhost 127.0.0.1", + "e2e-test-runner-build": "tsc -p tests/e2e/tsconfig.build.json" }, "dependencies": { "@dotlottie/react-player": "^1.6.3", diff --git a/tests/e2e/tsconfig.build.json b/tests/e2e/tsconfig.build.json new file mode 100644 index 000000000000..bd445813d52b --- /dev/null +++ b/tests/e2e/tsconfig.build.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "noEmit": false, + "esModuleInterop": true, + "outDir": "dist", + "rootDir": "." + }, + "exclude": [".github/**/*"] +} From 40b51e260874b6619978a919c48f4e79f3dd1df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 29 Feb 2024 15:07:23 +0100 Subject: [PATCH 2/5] build e2e tests with ncc --- .github/workflows/e2ePerformanceTests.yml | 20 ++++---------------- package.json | 2 +- tests/e2e/TestSpec.yml | 3 +-- tests/e2e/tsconfig.build.json | 10 ---------- 4 files changed, 6 insertions(+), 29 deletions(-) delete mode 100644 tests/e2e/tsconfig.build.json diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 338cb8313465..48bfb21e27a2 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -175,23 +175,11 @@ jobs: - name: Rename delta APK run: mv "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2edelta-release.apk" "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2edeltaRelease.apk" - - name: Copy e2e code into zip folder - run: cp -r tests/e2e zip + - name: Compile test runner to be executable in a nodeJS environment + run: npm run e2e-test-runner-build - # Note: we can't reuse the apps tsconfig, as it depends on modules that aren't available in the AWS Device Farm environment - - name: Write tsconfig.json to zip folder - run: | - echo '{ - "compilerOptions": { - "target": "ESNext", - "module": "commonjs", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "allowJs": true, - } - }' > zip/tsconfig.json + - name: Copy e2e code into zip folder + run: cp tests/e2e/dist/index.js zip/testRunner.js - name: Zip everything in the zip directory up run: zip -qr App.zip ./zip diff --git a/package.json b/package.json index f70e591537bf..f489f013788f 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "workflow-test": "./workflow_tests/scripts/runWorkflowTests.sh", "workflow-test:generate": "ts-node workflow_tests/utils/preGenerateTest.js", "setup-https": "mkcert -install && mkcert -cert-file config/webpack/certificate.pem -key-file config/webpack/key.pem dev.new.expensify.com localhost 127.0.0.1", - "e2e-test-runner-build": "tsc -p tests/e2e/tsconfig.build.json" + "e2e-test-runner-build": "ncc build tests/e2e/testRunner.js -o tests/e2e/dist/" }, "dependencies": { "@dotlottie/react-player": "^1.6.3", diff --git a/tests/e2e/TestSpec.yml b/tests/e2e/TestSpec.yml index e0dcd2b9b66d..333d3af7d03d 100644 --- a/tests/e2e/TestSpec.yml +++ b/tests/e2e/TestSpec.yml @@ -21,8 +21,7 @@ phases: test: commands: - cd zip - - npm install underscore ts-node typescript - - npx ts-node e2e/testRunner.js -- --mainAppPath app-e2eRelease.apk --deltaAppPath app-e2edeltaRelease.apk + - node testRunner.js -- --mainAppPath app-e2eRelease.apk --deltaAppPath app-e2edeltaRelease.apk artifacts: - $WORKING_DIRECTORY diff --git a/tests/e2e/tsconfig.build.json b/tests/e2e/tsconfig.build.json deleted file mode 100644 index bd445813d52b..000000000000 --- a/tests/e2e/tsconfig.build.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "noEmit": false, - "esModuleInterop": true, - "outDir": "dist", - "rootDir": "." - }, - "exclude": [".github/**/*"] -} From 0762d2c005d44800726cf2e85ed2be3541d8d47f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 29 Feb 2024 15:12:25 +0100 Subject: [PATCH 3/5] add workflow for verifying th ee2e test runner is buildable --- .github/workflows/checkE2ETestCode.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/checkE2ETestCode.yml diff --git a/.github/workflows/checkE2ETestCode.yml b/.github/workflows/checkE2ETestCode.yml new file mode 100644 index 000000000000..9a22c5a43df0 --- /dev/null +++ b/.github/workflows/checkE2ETestCode.yml @@ -0,0 +1,23 @@ +name: Check e2e test code + +on: + workflow_call: + pull_request: + types: [opened, synchronize] + paths: + - 'tests/e2e/**' + - 'src/libs/E2E/**' + +jobs: + lint: + if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: ./.github/actions/composite/setupNode + + - name: Compile e2e test runner + run: npm run e2e-test-runner-build \ No newline at end of file From 04b561f06eb8e85aa16a173afb16025c1491f0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 29 Feb 2024 20:09:39 +0100 Subject: [PATCH 4/5] Update .github/workflows/checkE2ETestCode.yml Co-authored-by: Andrew Gable --- .github/workflows/checkE2ETestCode.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checkE2ETestCode.yml b/.github/workflows/checkE2ETestCode.yml index 9a22c5a43df0..77c40336bf4f 100644 --- a/.github/workflows/checkE2ETestCode.yml +++ b/.github/workflows/checkE2ETestCode.yml @@ -1,4 +1,4 @@ -name: Check e2e test code +name: Check e2e test code builds correctly on: workflow_call: From 682c359ebdc05dbc79e0af69451123e2136f5b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 29 Feb 2024 20:09:48 +0100 Subject: [PATCH 5/5] Update .github/workflows/checkE2ETestCode.yml Co-authored-by: Andrew Gable --- .github/workflows/checkE2ETestCode.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checkE2ETestCode.yml b/.github/workflows/checkE2ETestCode.yml index 77c40336bf4f..090b7a7f23e4 100644 --- a/.github/workflows/checkE2ETestCode.yml +++ b/.github/workflows/checkE2ETestCode.yml @@ -19,5 +19,5 @@ jobs: - name: Setup Node uses: ./.github/actions/composite/setupNode - - name: Compile e2e test runner + - name: Verify e2e tests compile correctly run: npm run e2e-test-runner-build \ No newline at end of file