Skip to content
Open
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
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "test-harness"]
path = test-harness
url = https://github.com/open-feature/test-harness.git
[submodule "spec"]
path = spec
url = https://github.com/open-feature/spec.git
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Run tests with `npm test`.

### End-to-End Tests

The continuous integration runs a set of [gherkin e2e tests](https://github.com/open-feature/test-harness/blob/main/features/evaluation.feature) using in-memory provider. These tests run with the "e2e" npm script. If you'd like to run them locally, follow the steps below:
The continuous integration runs a set of [gherkin e2e tests](https://github.com/open-feature/spec/blob/main/specification/assets/gherkin/evaluation.feature) using in-memory provider. These tests run with the "e2e" npm script. If you'd like to run them locally, follow the steps below:

```
npm run e2e-server
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"test": "npm run test:jest && npm run test:angular",
"test:jest": "jest --selectProjects=shared --selectProjects=server --selectProjects=web --selectProjects=react --selectProjects=nest --silent",
"test:angular": "npm run test:coverage --workspace=packages/angular",
"e2e-server": "git submodule update --init --recursive && shx cp test-harness/features/evaluation.feature packages/server/e2e/features && jest --selectProjects=server-e2e --verbose",
"e2e-web": "git submodule update --init --recursive && shx cp test-harness/features/evaluation.feature packages/web/e2e/features && jest --selectProjects=web-e2e --verbose",
"e2e-server": "git submodule update --init --recursive && shx cp spec/specification/assets/gherkin/evaluation.feature packages/server/e2e/features && jest --selectProjects=server-e2e --verbose",
"e2e-web": "git submodule update --init --recursive && shx cp spec/specification/assets/gherkin/evaluation.feature packages/web/e2e/features && jest --selectProjects=web-e2e --verbose",
"e2e": "npm run e2e-server && npm run e2e-web",
Comment thread
MridulTailor marked this conversation as resolved.
"lint": "npm run lint --workspace=packages/shared --workspace=packages/server --workspace=packages/web --workspace=packages/react --workspace=packages/angular --workspace=packages/nest",
"lint:fix": "npm run lint:fix --workspace=packages/shared --workspace=packages/server --workspace=packages/web --workspace=packages/react --workspace=packages/angular --workspace=packages/nest",
Expand Down
36 changes: 17 additions & 19 deletions packages/server/e2e/step-definitions/evaluation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ const feature = loadFeature('packages/server/e2e/features/evaluation.feature');
// get a client (flagd provider registered in setup)
const client = OpenFeature.getClient();

const givenAnOpenfeatureClientIsRegisteredWithCacheDisabled = (
given: (stepMatcher: string, stepDefinitionCallback: () => void) => void,
) => {
given('a provider is registered with cache disabled', () => undefined);
const givenAStableProvider = (given: (stepMatcher: string, stepDefinitionCallback: () => void) => void) => {
given('a stable provider', () => undefined);
};

defineFeature(feature, (test) => {
Expand All @@ -29,7 +27,7 @@ defineFeature(feature, (test) => {
let value: boolean;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a boolean flag with key "(.*)" is evaluated with default value "(.*)"$/,
Expand All @@ -48,7 +46,7 @@ defineFeature(feature, (test) => {
let value: string;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a string flag with key "(.*)" is evaluated with default value "(.*)"$/,
Expand All @@ -67,7 +65,7 @@ defineFeature(feature, (test) => {
let value: number;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^an integer flag with key "(.*)" is evaluated with default value (\d+)$/,
Expand All @@ -86,7 +84,7 @@ defineFeature(feature, (test) => {
let value: number;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a float flag with key "(.*)" is evaluated with default value (\d+\.?\d*)$/,
Expand All @@ -105,7 +103,7 @@ defineFeature(feature, (test) => {
let value: JsonValue;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(/^an object flag with key "(.*)" is evaluated with a null default value$/, async (key: string) => {
flagKey = key;
Expand All @@ -127,7 +125,7 @@ defineFeature(feature, (test) => {
let details: EvaluationDetails<boolean>;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a boolean flag with key "(.*)" is evaluated with details and default value "(.*)"$/,
Expand All @@ -151,7 +149,7 @@ defineFeature(feature, (test) => {
let details: EvaluationDetails<string>;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a string flag with key "(.*)" is evaluated with details and default value "(.*)"$/,
Expand All @@ -175,7 +173,7 @@ defineFeature(feature, (test) => {
let details: EvaluationDetails<number>;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^an integer flag with key "(.*)" is evaluated with details and default value (\d+)$/,
Expand All @@ -199,7 +197,7 @@ defineFeature(feature, (test) => {
let details: EvaluationDetails<number>;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a float flag with key "(.*)" is evaluated with details and default value (\d+\.?\d*)$/,
Expand All @@ -223,7 +221,7 @@ defineFeature(feature, (test) => {
let details: EvaluationDetails<JsonValue>; // update this after merge
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(/^an object flag with key "(.*)" is evaluated with details and a null default value$/, async (key: string) => {
flagKey = key;
Expand Down Expand Up @@ -255,7 +253,7 @@ defineFeature(feature, (test) => {
let value: string;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^context contains keys "(.*)", "(.*)", "(.*)", "(.*)" with values "(.*)", "(.*)", (\d+), "(.*)"$/,
Expand Down Expand Up @@ -299,10 +297,10 @@ defineFeature(feature, (test) => {
let fallbackValue: string;
let details: ResolutionDetails<string>;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a non-existent string flag with key "(.*)" is evaluated with details and a default value "(.*)"$/,
/^a non-existent string flag with key "(.*)" is evaluated with details and a fallback value "(.*)"$/,
async (key: string, defaultValue: string) => {
flagKey = key;
fallbackValue = defaultValue;
Expand All @@ -328,10 +326,10 @@ defineFeature(feature, (test) => {
let fallbackValue: number;
let details: ResolutionDetails<number>;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a string flag with key "(.*)" is evaluated as an integer, with details and a default value (\d+)$/,
/^a string flag with key "(.*)" is evaluated as an integer, with details and a fallback value (\d+)$/,
async (key: string, defaultValue: string) => {
flagKey = key;
fallbackValue = Number.parseInt(defaultValue);
Expand Down
36 changes: 17 additions & 19 deletions packages/web/e2e/step-definitions/evaluation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ const feature = loadFeature('packages/web/e2e/features/evaluation.feature');
// get a client (flagd provider registered in setup)
const client = OpenFeature.getClient();

const givenAnOpenfeatureClientIsRegisteredWithCacheDisabled = (
given: (stepMatcher: string, stepDefinitionCallback: () => void) => void,
) => {
given('a provider is registered with cache disabled', () => undefined);
const givenAStableProvider = (given: (stepMatcher: string, stepDefinitionCallback: () => void) => void) => {
given('a stable provider', () => undefined);
};

defineFeature(feature, (test) => {
Expand All @@ -27,7 +25,7 @@ defineFeature(feature, (test) => {
test('Resolves boolean value', ({ given, when, then }) => {
let value: boolean;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a boolean flag with key "(.*)" is evaluated with default value "(.*)"$/,
Expand All @@ -44,7 +42,7 @@ defineFeature(feature, (test) => {
test('Resolves string value', ({ given, when, then }) => {
let value: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a string flag with key "(.*)" is evaluated with default value "(.*)"$/,
Expand All @@ -61,7 +59,7 @@ defineFeature(feature, (test) => {
test('Resolves integer value', ({ given, when, then }) => {
let value: number;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^an integer flag with key "(.*)" is evaluated with default value (\d+)$/,
Expand All @@ -79,7 +77,7 @@ defineFeature(feature, (test) => {
test('Resolves float value', ({ given, when, then }) => {
let value: number;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a float flag with key "(.*)" is evaluated with default value (\d+\.?\d*)$/,
Expand All @@ -95,7 +93,7 @@ defineFeature(feature, (test) => {

test('Resolves object value', ({ given, when, then }) => {
let value: JsonValue;
givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(/^an object flag with key "(.*)" is evaluated with a null default value$/, (key: string) => {
value = client.getObjectValue<JsonValue>(key, {});
Expand All @@ -114,7 +112,7 @@ defineFeature(feature, (test) => {

test('Resolves boolean details', ({ given, when, then }) => {
let details: EvaluationDetails<boolean>;
givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a boolean flag with key "(.*)" is evaluated with details and default value "(.*)"$/,
Expand All @@ -136,7 +134,7 @@ defineFeature(feature, (test) => {
test('Resolves string details', ({ given, when, then }) => {
let details: EvaluationDetails<string>;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a string flag with key "(.*)" is evaluated with details and default value "(.*)"$/,
Expand All @@ -158,7 +156,7 @@ defineFeature(feature, (test) => {
test('Resolves integer details', ({ given, when, then }) => {
let details: EvaluationDetails<number>;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^an integer flag with key "(.*)" is evaluated with details and default value (\d+)$/,
Expand All @@ -180,7 +178,7 @@ defineFeature(feature, (test) => {
test('Resolves float details', ({ given, when, then }) => {
let details: EvaluationDetails<number>;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a float flag with key "(.*)" is evaluated with details and default value (\d+\.?\d*)$/,
Expand All @@ -202,7 +200,7 @@ defineFeature(feature, (test) => {
test('Resolves object details', ({ given, when, then, and }) => {
let details: EvaluationDetails<JsonValue>; // update this after merge

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(/^an object flag with key "(.*)" is evaluated with details and a null default value$/, (key: string) => {
details = client.getObjectDetails(key, {}); // update this after merge
Expand Down Expand Up @@ -233,7 +231,7 @@ defineFeature(feature, (test) => {
let value: string;
let flagKey: string;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^context contains keys "(.*)", "(.*)", "(.*)", "(.*)" with values "(.*)", "(.*)", (\d+), "(.*)"$/,
Expand Down Expand Up @@ -277,10 +275,10 @@ defineFeature(feature, (test) => {
let fallbackValue: string;
let details: ResolutionDetails<string>;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a non-existent string flag with key "(.*)" is evaluated with details and a default value "(.*)"$/,
/^a non-existent string flag with key "(.*)" is evaluated with details and a fallback value "(.*)"$/,
(key: string, defaultValue: string) => {
flagKey = key;
fallbackValue = defaultValue;
Expand All @@ -306,10 +304,10 @@ defineFeature(feature, (test) => {
let fallbackValue: number;
let details: ResolutionDetails<number>;

givenAnOpenfeatureClientIsRegisteredWithCacheDisabled(given);
givenAStableProvider(given);

when(
/^a string flag with key "(.*)" is evaluated as an integer, with details and a default value (\d+)$/,
/^a string flag with key "(.*)" is evaluated as an integer, with details and a fallback value (\d+)$/,
(key: string, defaultValue: string) => {
flagKey = key;
fallbackValue = Number.parseInt(defaultValue);
Expand Down
1 change: 1 addition & 0 deletions spec
Submodule spec added at eefdf4
1 change: 0 additions & 1 deletion test-harness
Submodule test-harness deleted from 48c56d
Loading