diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..aec67d3817 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +target +node_modules diff --git a/.gitignore b/.gitignore index ba04df6dbf..7931417144 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ generated-do-not-edit/ .sentryclirc .DS_Store +**/e2e/screenshots +**/e2e/videos .env .env.* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..72e8e2a099 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM ivangabriele/tauri:debian-bullseye-18 + +ENV DOCKER 1 +WORKDIR /build + +# Copy source code into container +COPY . /build + +# Install specific node version from our .nvmrc +RUN curl -sfLS "https://install-node.vercel.app/$(cat .nvmrc)" | bash -s -- --force + +# Enable and use our defined `packageManager` version of pnpm +RUN corepack enable pnpm \ + && corepack install \ + && pnpm install + +# Build a binary of the application +RUN pnpm build:test + +# CMD xvfb-run pnpm test:e2e +CMD /bin/bash diff --git a/apps/desktop/wdio.conf.ts b/apps/desktop/wdio.conf.ts index 53c31dd8db..bbbaa13d9b 100644 --- a/apps/desktop/wdio.conf.ts +++ b/apps/desktop/wdio.conf.ts @@ -6,6 +6,10 @@ import type { Options } from '@wdio/types'; let tauriDriver: ChildProcess; +const appBinaryPath = process.env.DOCKER + ? '/build/target/release/git-butler-dev' + : '../../target/release/git-butler-dev'; + export const config: Options.WebdriverIO = { hostname: '127.0.0.1', port: 4444, @@ -15,7 +19,7 @@ export const config: Options.WebdriverIO = { { // @ts-expect-error custom tauri capabilities 'tauri:options': { - application: '../../target/release/git-butler-dev' + application: appBinaryPath } } ], @@ -38,10 +42,14 @@ export const config: Options.WebdriverIO = { connectionRetryCount: 3, // ensure we are running `tauri-driver` before the session starts so that we can proxy the webdriver requests - beforeSession: () => - (tauriDriver = spawn(path.resolve(os.homedir(), '.cargo', 'bin', 'tauri-driver'), [], { + beforeSession: () => { + const tauriDriverPath = process.env.DOCKER + ? 'tauri-driver' + : path.resolve(os.homedir(), '.cargo', 'bin', 'tauri-driver'); + tauriDriver = spawn(tauriDriverPath, [], { stdio: [null, process.stdout, process.stderr] - })), + }); + }, afterTest: function ({ error }: { error: Error }) { if (error) {