From 2e6f4b63fde35901692fbeff1b4a6e89cb1f1e0a Mon Sep 17 00:00:00 2001 From: Oskar Date: Tue, 5 Nov 2024 09:07:25 +0100 Subject: [PATCH] Update script and code references to gui-directory --- build.sh | 2 +- building/Dockerfile | 2 +- ci/buildserver-build.sh | 3 ++- desktop/packages/mullvad-vpn/scripts/build-proto.sh | 4 ++-- .../mullvad-vpn/scripts/build-test-executable.sh | 7 +++++-- .../packages/mullvad-vpn/standalone-tests.pkg.json | 13 ------------- desktop/packages/mullvad-vpn/standalone-tests.ts | 2 +- desktop/packages/mullvad-vpn/tasks/assets.js | 2 +- desktop/packages/mullvad-vpn/tasks/distribution.js | 6 +++--- prepare-release.sh | 5 +++-- test/docs/BUILD_OS_IMAGE.md | 2 +- test/test-manager/README.md | 4 ++-- test/test-manager/src/tests/ui.rs | 6 ++++-- 13 files changed, 26 insertions(+), 32 deletions(-) delete mode 100644 desktop/packages/mullvad-vpn/standalone-tests.pkg.json diff --git a/build.sh b/build.sh index ea26362103e9..ffa371f56088 100755 --- a/build.sh +++ b/build.sh @@ -356,7 +356,7 @@ cargo run --bin relay_list "${CARGO_ARGS[@]}" > build/relays.json log_header "Installing JavaScript dependencies" -pushd gui +pushd desktop/packages/mullvad-vpn npm ci log_header "Packing Mullvad VPN $PRODUCT_VERSION artifact(s)" diff --git a/building/Dockerfile b/building/Dockerfile index 9df2f063d174..5fd58233c969 100644 --- a/building/Dockerfile +++ b/building/Dockerfile @@ -101,7 +101,7 @@ RUN apt-get update -y && \ ENV PATH=/root/.volta/bin:$PATH # volta seemingly does not have a way to explicitly install the toolchain # versions from package.json, but `node --version` triggers an install -COPY gui/package.json . +COPY desktop/packages/mullvad-vpn/package.json . RUN curl https://get.volta.sh | bash && node --version && rm package.json # === Golang === diff --git a/ci/buildserver-build.sh b/ci/buildserver-build.sh index 055e3ad5bee4..9e63db6a3bd5 100755 --- a/ci/buildserver-build.sh +++ b/ci/buildserver-build.sh @@ -132,7 +132,8 @@ function build { fi mv dist/*.{deb,rpm,exe,pkg} "$artifact_dir" || return 1 - (run_in_build_env gui/scripts/build-test-executable.sh "$target" && \ + (run_in_build_env desktop/packages/mullvad-vpn/scripts/build-test-executable.sh \ + "$target" && \ mv "dist/app-e2e-tests-$version"* "$artifact_dir") || \ true } diff --git a/desktop/packages/mullvad-vpn/scripts/build-proto.sh b/desktop/packages/mullvad-vpn/scripts/build-proto.sh index 8861eb57302d..69023b72ce0e 100755 --- a/desktop/packages/mullvad-vpn/scripts/build-proto.sh +++ b/desktop/packages/mullvad-vpn/scripts/build-proto.sh @@ -8,8 +8,8 @@ cd "$SCRIPT_DIR" ARCH="$(uname -m)" PLATFORM="$(uname -s)" MANAGEMENT_INTERFACE_PROTO_BUILD_DIR=${MANAGEMENT_INTERFACE_PROTO_BUILD_DIR:-} -NODE_MODULES_DIR="$(cd ../node_modules/.bin && pwd)" -PROTO_DIR="../../mullvad-management-interface/proto" +NODE_MODULES_DIR="$(cd ../../../node_modules/.bin && pwd)" +PROTO_DIR="../../../../mullvad-management-interface/proto" PROTO_FILENAME="management_interface.proto" DESTINATION_DIR="../build/src/main/management_interface" TYPES_DESTINATION_DIR="../src/main/management_interface" diff --git a/desktop/packages/mullvad-vpn/scripts/build-test-executable.sh b/desktop/packages/mullvad-vpn/scripts/build-test-executable.sh index dd2758ebc3b5..9e79adf91b7c 100755 --- a/desktop/packages/mullvad-vpn/scripts/build-test-executable.sh +++ b/desktop/packages/mullvad-vpn/scripts/build-test-executable.sh @@ -15,6 +15,9 @@ ASSETS=( "build/test/e2e/shared/*.js" "build/test/e2e/installed/*.js" "build/test/e2e/installed/**/*.js" +) + +NODE_MODULES=( "node_modules/.bin/playwright" "node_modules/playwright" "node_modules/playwright-core" @@ -27,7 +30,7 @@ function build_test_executable { local temp_dir temp_dir="$(mktemp -d)" local temp_executable="$temp_dir/temp-test-executable$bin_suffix" - local output="../dist/app-e2e-tests-$PRODUCT_VERSION-$TARGET$bin_suffix" + local output="../../../dist/app-e2e-tests-$PRODUCT_VERSION-$TARGET$bin_suffix" local node_copy_path="$temp_dir/node$bin_suffix" local node_path node_path="$(volta which node || which node)" @@ -35,7 +38,7 @@ function build_test_executable { # pack assets cp "$node_path" "$node_copy_path" # shellcheck disable=SC2068 - tar -czf ./build/test/assets.tar.gz ${ASSETS[@]} + tar -czf ./build/test/assets.tar.gz ${ASSETS[@]} -C ../../ ${NODE_MODULES[@]} cp "$node_copy_path" "$temp_executable" node --experimental-sea-config standalone-tests.sea.json diff --git a/desktop/packages/mullvad-vpn/standalone-tests.pkg.json b/desktop/packages/mullvad-vpn/standalone-tests.pkg.json deleted file mode 100644 index 8be6b53d5aa8..000000000000 --- a/desktop/packages/mullvad-vpn/standalone-tests.pkg.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "assets": [ - "build/src/config.json", - "build/src/renderer/lib/routes.js", - "build/test/e2e/utils.js", - "build/test/e2e/shared/*.js", - "build/test/e2e/installed/**/*.js", - "node_modules/.bin/playwright", - "node_modules/playwright", - "node_modules/playwright-core", - "node_modules/@playwright/test" - ] -} diff --git a/desktop/packages/mullvad-vpn/standalone-tests.ts b/desktop/packages/mullvad-vpn/standalone-tests.ts index 176711b1d515..ddba27fb6fee 100644 --- a/desktop/packages/mullvad-vpn/standalone-tests.ts +++ b/desktop/packages/mullvad-vpn/standalone-tests.ts @@ -7,7 +7,7 @@ import path from 'path'; // This file is bundled into a standalone executable able to run e2e tests against an installed // version of the app. This file is the entrypoint in the executable and extracts the required -// assets and performs the tests. More info in /gui/README.md. +// assets and performs the tests. More info in /desktop/packages/mullvad-vpn/README.md. const tmpDir = path.join(os.tmpdir(), 'mullvad-standalone-tests'); diff --git a/desktop/packages/mullvad-vpn/tasks/assets.js b/desktop/packages/mullvad-vpn/tasks/assets.js index 802812418042..686b969e7014 100644 --- a/desktop/packages/mullvad-vpn/tasks/assets.js +++ b/desktop/packages/mullvad-vpn/tasks/assets.js @@ -21,7 +21,7 @@ function copyLocales() { } function copyGeoData() { - return src('../dist-assets/geo/*.gl').pipe(dest('build/assets/geo')); + return src('../../../dist-assets/geo/*.gl').pipe(dest('build/assets/geo')); } copyStaticAssets.displayName = 'copy-static-assets'; diff --git a/desktop/packages/mullvad-vpn/tasks/distribution.js b/desktop/packages/mullvad-vpn/tasks/distribution.js index 79e43817e235..81ba0da267b0 100644 --- a/desktop/packages/mullvad-vpn/tasks/distribution.js +++ b/desktop/packages/mullvad-vpn/tasks/distribution.js @@ -434,15 +434,15 @@ function packLinux() { } function buildAssets(relativePath) { - return path.join(path.resolve(__dirname, '../../build'), relativePath); + return root(path.join('build', relativePath)); } function distAssets(relativePath) { - return path.join(path.resolve(__dirname, '../../dist-assets'), relativePath); + return root(path.join('dist-assets', relativePath)); } function root(relativePath) { - return path.join(path.resolve(__dirname, '../../'), relativePath); + return path.join(path.resolve(__dirname, '../../../../'), relativePath); } function getWindowsDistSubdir() { diff --git a/prepare-release.sh b/prepare-release.sh index 91829b142a98..21627daec5c9 100755 --- a/prepare-release.sh +++ b/prepare-release.sh @@ -45,8 +45,9 @@ if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then exit 1 fi -if [[ $DESKTOP == "true" && $(grep "CHANGE THIS BEFORE A RELEASE" gui/changes.txt) != "" ]]; then - echo "It looks like you did not update gui/changes.txt" +desktop_changes_path=desktop/packages/mullvad-vpn/changes.txt +if [[ $DESKTOP == "true" && $(grep "CHANGE THIS BEFORE A RELEASE" $desktop_changes_path) != "" ]]; then + echo "It looks like you did not update $desktop_changes_path" exit 1 fi diff --git a/test/docs/BUILD_OS_IMAGE.md b/test/docs/BUILD_OS_IMAGE.md index 87e2c88e58f9..659eb7d55eaa 100644 --- a/test/docs/BUILD_OS_IMAGE.md +++ b/test/docs/BUILD_OS_IMAGE.md @@ -211,7 +211,7 @@ This can be achieved as follows: ## Windows Security -Windows Defender ocasionally kills the `test-runner` because it believes it to be a trojan. This can be worked around by excluding `E:` and [the folder containing the standalone e2e GUI test executable](../../gui/README.md) following this guide: https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26. +Windows Defender ocasionally kills the `test-runner` because it believes it to be a trojan. This can be worked around by excluding `E:` and [the folder containing the standalone e2e GUI test executable](../../desktop/packages/mullvad-vpn/README.md) following this guide: https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26. ## Finishing setup diff --git a/test/test-manager/README.md b/test/test-manager/README.md index c35e7c5ba7d8..3d69a666ae2e 100644 --- a/test/test-manager/README.md +++ b/test/test-manager/README.md @@ -32,8 +32,8 @@ If a new module is created, make sure to add it in It is possible to write tests for asserting graphical properties in the app, but this is a slightly more involved process. GUI tests are written in `Typescript`, -and reside in the `gui/test/e2e` folder in the app repository. Packaging of -these tests is also done from the `gui/` folder. +and reside in the `desktop/packages/mullvad-vpn/test/e2e` folder in the app repository. +Packaging of these tests is also done from the `desktop/packages/mullvad-vpn/` folder. Assuming that a graphical test `gui-test.spec` has been bundled correctly, it can be invoked from any Rust function by calling diff --git a/test/test-manager/src/tests/ui.rs b/test/test-manager/src/tests/ui.rs index 266624cc68ed..53c769a7cca6 100644 --- a/test/test-manager/src/tests/ui.rs +++ b/test/test-manager/src/tests/ui.rs @@ -154,7 +154,8 @@ async fn test_custom_access_methods_gui( // * SHADOWSOCKS_SERVER_CIPHER // * SHADOWSOCKS_SERVER_PASSWORD // - // See `gui/test/e2e/installed/state-dependent/api-access-methods.spec.ts` + // See + // `desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/api-access-methods.spec.ts` // for details. The setup should be the same as in // `test_manager::tests::access_methods::test_shadowsocks`. // @@ -223,7 +224,8 @@ async fn test_custom_bridge_gui( // * SHADOWSOCKS_SERVER_CIPHER // * SHADOWSOCKS_SERVER_PASSWORD // - // See `gui/test/e2e/installed/state-dependent/custom-bridge.spec.ts` + // See + // `desktop/packages/mullvad-vpn/test/e2e/installed/state-dependent/custom-bridge.spec.ts` // for details. The setup should be the same as in // `test_manager::tests::access_methods::test_shadowsocks`.