Skip to content

test(e2e): Make E2E test org and project configurable via env variables #6509

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

Merged
merged 2 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ jobs:
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks'
E2E_TEST_SENTRY_TEST_PROJECT: 'sentry-javascript-e2e-tests'
run: |
cd packages/e2e-tests
yarn test:e2e
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks'
E2E_TEST_SENTRY_TEST_PROJECT: 'sentry-javascript-e2e-tests'
CANARY_E2E_TEST: 'yes'
run: |
cd packages/e2e-tests
Expand Down
2 changes: 2 additions & 0 deletions packages/e2e-tests/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
E2E_TEST_AUTH_TOKEN=
E2E_TEST_DSN=
E2E_TEST_SENTRY_ORG_SLUG=
E2E_TEST_SENTRY_TEST_PROJECT=
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { test, expect } from '@playwright/test';
import axios, { AxiosError } from 'axios';

const SENTRY_TEST_ORG_SLUG = 'sentry-sdks';
const SENTRY_TEST_PROJECT = 'sentry-javascript-e2e-tests';

const EVENT_POLLING_TIMEOUT = 30_000;

const authToken = process.env.E2E_TEST_AUTH_TOKEN;
const sentryTestOrgSlug = process.env.E2E_TEST_SENTRY_ORG_SLUG;
const sentryTestProject = process.env.E2E_TEST_SENTRY_TEST_PROJECT;

test('Sends an exception to Sentry', async ({ page }) => {
await page.goto('/');
Expand All @@ -24,7 +23,7 @@ test('Sends an exception to Sentry', async ({ page }) => {
async () => {
try {
const response = await axios.get(
`https://sentry.io/api/0/projects/${SENTRY_TEST_ORG_SLUG}/${SENTRY_TEST_PROJECT}/events/${exceptionEventId}/`,
`https://sentry.io/api/0/projects/${sentryTestOrgSlug}/${sentryTestProject}/events/${exceptionEventId}/`,
{ headers: { Authorization: `Bearer ${authToken}` } },
);
return response.status;
Expand Down Expand Up @@ -74,7 +73,7 @@ test('Sends a pageload transaction to Sentry', async ({ page }) => {
async () => {
try {
const response = await axios.get(
`https://sentry.io/api/0/projects/${SENTRY_TEST_ORG_SLUG}/${SENTRY_TEST_PROJECT}/events/${transactionEventId}/`,
`https://sentry.io/api/0/projects/${sentryTestOrgSlug}/${sentryTestProject}/events/${transactionEventId}/`,
{ headers: { Authorization: `Bearer ${authToken}` } },
);

Expand Down Expand Up @@ -139,7 +138,7 @@ test('Sends a navigation transaction to Sentry', async ({ page }) => {
async () => {
try {
const response = await axios.get(
`https://sentry.io/api/0/projects/${SENTRY_TEST_ORG_SLUG}/${SENTRY_TEST_PROJECT}/events/${transactionEventId}/`,
`https://sentry.io/api/0/projects/${sentryTestOrgSlug}/${sentryTestProject}/events/${transactionEventId}/`,
{ headers: { Authorization: `Bearer ${authToken}` } },
);

Expand Down