Skip to content

Commit

Permalink
Update script and code references to gui-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
raksooo committed Nov 8, 2024
1 parent 6750025 commit 2e6f4b6
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 32 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
2 changes: 1 addition & 1 deletion building/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ===
Expand Down
3 changes: 2 additions & 1 deletion ci/buildserver-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions desktop/packages/mullvad-vpn/scripts/build-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 5 additions & 2 deletions desktop/packages/mullvad-vpn/scripts/build-test-executable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -27,15 +30,15 @@ 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)"

# 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
Expand Down
13 changes: 0 additions & 13 deletions desktop/packages/mullvad-vpn/standalone-tests.pkg.json

This file was deleted.

2 changes: 1 addition & 1 deletion desktop/packages/mullvad-vpn/standalone-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion desktop/packages/mullvad-vpn/tasks/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 3 additions & 3 deletions desktop/packages/mullvad-vpn/tasks/distribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 3 additions & 2 deletions prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/docs/BUILD_OS_IMAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/test-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/test-manager/src/tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
//
Expand Down Expand Up @@ -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`.

Expand Down

0 comments on commit 2e6f4b6

Please sign in to comment.