Tests automatically use heartwood binaries from local test folder

It’s not necessary anymore to add the folder with the heartwood test
binaries to `PATH` before running the end-to-end tests.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
This commit is contained in:
Thomas Scholtes
2023-06-29 11:34:53 +02:00
committed by Rūdolfs Ošiņš
parent 4c101c2567
commit 40f2b3e516
6 changed files with 23 additions and 36 deletions
-1
View File
@@ -40,7 +40,6 @@ jobs:
run: |
mkdir -p tests/artifacts;
./scripts/install-binaries;
./scripts/install-binaries --show-path >> $GITHUB_PATH;
- name: Run Playwright tests
run: |
-20
View File
@@ -69,24 +69,4 @@ do
fi
done
RADICLE_HOME=${RAD_HOME:-"${HOME}/.radicle/bin"}
# Add a separator between binaries download and PATH instructions.
echo
if [[ ":$PATH:" != *":$BINARY_PATH:"* ]]; then
if [[ ":$PATH:" == *":$RADICLE_HOME:"* ]]; then
echo "⚠️ You already have a radicle bin folder in your PATH variable."
echo
echo "To ensure you are using the correct test binaries, run the following command:"
else
echo "Before running the tests, make sure your PATH variable is set up correctly by running:"
fi
echo " 👉 export PATH=$BINARY_PATH:\$PATH"
else
echo "✅ $BINARY_PATH is already in your PATH variable."
fi
+2 -7
View File
@@ -5,24 +5,19 @@ import type { PeerManager, RadiclePeer } from "./peerManager.js";
import * as Fs from "node:fs/promises";
import * as FsSync from "node:fs";
import * as Path from "node:path";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { test as base, expect, type ViewportSize } from "@playwright/test";
import * as Process from "./process.js";
import * as issue from "@tests/support/cobs/issue.js";
import * as logLabel from "@tests/support/logLabel.js";
import * as patch from "@tests/support/cobs/patch.js";
import { createOptions } from "@tests/support/support.js";
import { createOptions, supportDir, tmpDir } from "@tests/support/support.js";
import { createPeerManager } from "@tests/support/peerManager.js";
import { createProject } from "@tests/support/project.js";
export { expect };
const filename = fileURLToPath(import.meta.url);
export const supportDir = dirname(filename);
export const tmpDir = Path.resolve(supportDir, "..", "./tmp");
export const fixturesDir = Path.resolve(supportDir, "..", "./fixtures");
const fixturesDir = Path.resolve(supportDir, "..", "./fixtures");
type ViewportTypes = "iPhoneXR" | "Desktop";
+3 -7
View File
@@ -12,10 +12,9 @@ import {
createSourceBrowsingFixture,
gitOptions,
startPalmHttpd,
supportDir,
tmpDir,
} from "@tests/support/fixtures.js";
import { createPeerManager } from "@tests/support/peerManager.js";
import { heartwoodShortSha, tmpDir } from "./support";
const workspacePaths = [Path.join(tmpDir, "peers"), Path.join(tmpDir, "repos")];
@@ -69,13 +68,10 @@ export default async function globalSetup(_config: FullConfig): Promise<void> {
// Assert that the `rad` CLI is installed and has the correct version.
async function assertRadInstalled(): Promise<void> {
const versionConstraint = (
await Fs.readFile(`${supportDir}/heartwood-version`, "utf8")
).substring(0, 7);
const { stdout: version } = await execa("rad", ["--version"]);
if (!version.includes(versionConstraint)) {
if (!version.includes(heartwoodShortSha)) {
throw new Error(
`rad version ${version} does not satisfy ${versionConstraint}`,
`rad version ${version} does not satisfy ${heartwoodShortSha}`,
);
}
}
+17
View File
@@ -1,5 +1,8 @@
import type { Options } from "execa";
import * as Crypto from "node:crypto";
import { fileURLToPath } from "node:url";
import * as Path from "node:path";
import * as Fs from "node:fs/promises";
// Generate string of 12 random characters with 8 bits of entropy.
export function randomTag(): string {
@@ -13,3 +16,17 @@ export function createOptions(projectFolder: string, days: number): Options {
env: { RAD_COMMIT_TIME: (1671211684 + days * 86400).toString() },
};
}
const filename = fileURLToPath(import.meta.url);
export const supportDir = Path.dirname(filename);
export const tmpDir = Path.resolve(supportDir, "..", "./tmp");
export const fixturesDir = Path.resolve(supportDir, "..", "./fixtures");
export const heartwoodShortSha = (
await Fs.readFile(`${supportDir}/heartwood-version`, "utf8")
).substring(0, 7);
process.env.PATH = [
Path.join(tmpDir, "bin", heartwoodShortSha),
process.env.PATH,
].join(Path.delimiter);
+1 -1
View File
@@ -4,7 +4,7 @@
"exclude": ["node_modules/*"],
"compilerOptions": {
"target": "es2020",
"module": "es2020",
"module": "es2022",
"types": ["vite/client"],
"sourceMap": true,
"baseUrl": "./",