Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Dockerfile for running tauri e2e tests ono mac #4643

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
node_modules
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ generated-do-not-edit/

.sentryclirc
.DS_Store
**/e2e/screenshots
**/e2e/videos

.env
.env.*
Expand Down
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
16 changes: 12 additions & 4 deletions apps/desktop/wdio.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}
}
],
Expand All @@ -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) {
Expand Down