Skip to content

Commit

Permalink
Write a script to run e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
nprizal committed Dec 10, 2024
1 parent a158e56 commit 93a3c59
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ internal/api/pacts/

dist/
node_modules/

internal/runner/testdata/jest/jest-result.json

internal/runner/testdata/rspec/rspec-result.json
30 changes: 30 additions & 0 deletions bin/e2e
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# This script is used to run bktec against the sample project for the given test runner.
# Sample project can be found in internal/runner/testdata/<test-runner>
#
# Usage: ./bin/e2e <test-runner> <parallel-job>
#
# Note: you need to manually set the following environment variables
# - BUILDKITE_ORGANIZATION_SLUG
# - BUILDKITE_TEST_ENGINE_API_ACCESS_TOKEN
# - BUILDKITE_TEST_ENGINE_SUITE_SLUG


export BUILDKITE_BUILD_ID=$(uuidgen)
export BUILDKITE_PARALLEL_JOB_COUNT=2
export BUILDKITE_PARALLEL_JOB=${2:-0}
export BUILDKITE_TEST_ENGINE_TEST_RUNNER=${1:-rspec}
export BUILDKITE_TEST_ENGINE_TEST_CMD=""
export BUILDKITE_STEP_ID=$BUILDKITE_TEST_ENGINE_TEST_RUNNER
export BUILDKITE_TEST_ENGINE_RESULT_PATH="${BUILDKITE_TEST_ENGINE_TEST_RUNNER}-result.json"

if [ "$BUILDKITE_TEST_ENGINE_TEST_RUNNER" == "playwright" ]; then
# We need to tell bktec to use playwright's result path configured in playwright.config.js
export BUILDKITE_TEST_ENGINE_RESULT_PATH="test-results/results.json"
export BUILDKITE_TEST_ENGINE_TEST_FILE_EXCLUDE_PATTERN="**/*/error.spec.js"
fi

cd ./internal/runner/testdata/$BUILDKITE_TEST_ENGINE_TEST_RUNNER

go run ../../../../main.go
5 changes: 5 additions & 0 deletions internal/runner/testdata/rspec/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem "rspec"
27 changes: 27 additions & 0 deletions internal/runner/testdata/rspec/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.5.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)

PLATFORMS
arm64-darwin-23
ruby

DEPENDENCIES
rspec

BUNDLED WITH
2.5.16

0 comments on commit 93a3c59

Please sign in to comment.