diff --git a/.gitignore b/.gitignore index e34d4ed2..220d374d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,7 @@ internal/api/pacts/ dist/ node_modules/ + +internal/runner/testdata/jest/jest-result.json + +internal/runner/testdata/rspec/rspec-result.json diff --git a/bin/e2e b/bin/e2e new file mode 100755 index 00000000..15cc7297 --- /dev/null +++ b/bin/e2e @@ -0,0 +1,34 @@ +#!/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/ +# +# Usage: ./bin/e2e +# +# 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=${2:-0} +export BUILDKITE_PARALLEL_JOB_COUNT=2 +export BUILDKITE_STEP_ID=$BUILDKITE_TEST_ENGINE_TEST_RUNNER +export BUILDKITE_TEST_ENGINE_RESULT_PATH="${BUILDKITE_TEST_ENGINE_TEST_RUNNER}-result.json" +export BUILDKITE_TEST_ENGINE_TEST_RUNNER=${1:-rspec} + +# Override the following variables to the default value, in case they are set somewhere else +export BUILDKITE_TEST_ENGINE_TEST_CMD="" +export BUILDKITE_TEST_ENGINE_TEST_FILE_PATTERN="" + +# Extra configuration for playwright +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" + # error.spec.js will prevent other tests from running, so we exclude it + 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 diff --git a/internal/runner/testdata/rspec/Gemfile b/internal/runner/testdata/rspec/Gemfile new file mode 100644 index 00000000..3bd66e01 --- /dev/null +++ b/internal/runner/testdata/rspec/Gemfile @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "rspec" diff --git a/internal/runner/testdata/rspec/Gemfile.lock b/internal/runner/testdata/rspec/Gemfile.lock new file mode 100644 index 00000000..e65f9b83 --- /dev/null +++ b/internal/runner/testdata/rspec/Gemfile.lock @@ -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