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(flags): Add OpenFeature integration #14326

Merged
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
Prev Previous commit
Next Next commit
update tests to use shouldSkipFeatureFlagsTest and getLocalTestUrl
  • Loading branch information
billyvg committed Nov 20, 2024
commit 1e1d734c3cbba2cb5a64c12f97a251a88a0ed208
Original file line number Diff line number Diff line change
@@ -2,12 +2,12 @@ import { expect } from '@playwright/test';

import { sentryTest } from '../../../../../utils/fixtures';

import { envelopeRequestParser, shouldSkipOpenFeatureTest, waitForErrorRequest } from '../../../../../utils/helpers';
import { envelopeRequestParser, shouldSkipFeatureFlagsTest, waitForErrorRequest } from '../../../../../utils/helpers';

const FLAG_BUFFER_SIZE = 100; // Corresponds to constant in featureFlags.ts, in browser utils.

sentryTest('Basic test with eviction, update, and no async tasks', async ({ getLocalTestPath, page }) => {
if (shouldSkipOpenFeatureTest()) {
sentryTest('Basic test with eviction, update, and no async tasks', async ({ getLocalTestUrl, page }) => {
if (shouldSkipFeatureFlagsTest()) {
sentryTest.skip();
}

@@ -19,7 +19,7 @@ sentryTest('Basic test with eviction, update, and no async tasks', async ({ getL
});
});

const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true });
const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true });
await page.goto(url);

await page.waitForFunction(bufferSize => {
Original file line number Diff line number Diff line change
@@ -2,12 +2,12 @@ import { expect } from '@playwright/test';

import { sentryTest } from '../../../../../utils/fixtures';

import { envelopeRequestParser, shouldSkipOpenFeatureTest, waitForErrorRequest } from '../../../../../utils/helpers';
import { envelopeRequestParser, shouldSkipFeatureFlagsTest, waitForErrorRequest } from '../../../../../utils/helpers';

import type { Scope } from '@sentry/browser';

sentryTest('Flag evaluations in forked scopes are stored separately.', async ({ getLocalTestPath, page }) => {
if (shouldSkipOpenFeatureTest()) {
sentryTest('Flag evaluations in forked scopes are stored separately.', async ({ getLocalTestUrl, page }) => {
if (shouldSkipFeatureFlagsTest()) {
sentryTest.skip();
}

@@ -19,7 +19,7 @@ sentryTest('Flag evaluations in forked scopes are stored separately.', async ({
});
});

const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true });
const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true });
await page.goto(url);

const forkedReqPromise = waitForErrorRequest(page, event => !!event.tags && event.tags.isForked === true);
12 changes: 0 additions & 12 deletions dev-packages/browser-integration-tests/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -285,18 +285,6 @@ export function shouldSkipFeatureFlagsTest(): boolean {
return bundle != null && !bundle.includes('esm') && !bundle.includes('cjs');
}

/**
* We can only test the openFeature browser integration in certain bundles/packages:
* - NPM (ESM, CJS)
* - Not CDNs.
*
* @returns `true` if we should skip the openFeature test
*/
export function shouldSkipOpenFeatureTest(): boolean {
const bundle = process.env.PW_BUNDLE as string | undefined;
return bundle != null && !bundle.includes('esm') && !bundle.includes('cjs');
}

/**
* Waits until a number of requests matching urlRgx at the given URL arrive.
* If the timeout option is configured, this function will abort waiting, even if it hasn't received the configured