Repository navigation
feat: Spec getExperimentFlag under local evaluation #21
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| @local-evaluation @events | ||
| Feature: Get an experiment flag with local evaluation | ||
| A server-side SDK resolves a feature for an identity against the environment document, and | ||
| records the exposure as it would with remote evaluation. | ||
|
|
||
| Background: | ||
| Given a Flagsmith environment | ||
| And the SDK evaluates flags locally | ||
| And the SDK sends events to Flagsmith | ||
|
|
||
| Scenario: An identity in a running experiment is exposed to the variant it was served | ||
| Given the environment has the following features: | ||
| | feature | enabled | value | | ||
| | checkout | true | "control" | | ||
| And a running experiment on feature "checkout" enrolling 100% of identities, serving variant "treatment" with value "new checkout" to 100% of them | ||
| When the application gets the experiment flag "checkout" for identity "user_123" with traits: | ||
| | trait | value | | ||
| | plan | "premium" | | ||
| Then the application receives the following flags: | ||
| | feature | enabled | value | | ||
| | checkout | true | "new checkout" | | ||
| And Flagsmith has received the following events: | ||
| | event | feature | identifier | value | traits | metadata | | ||
| | $flag_exposure | checkout | user_123 | "treatment" | {"plan": "premium"} | {"experiment_id": "<experiment>"} | | ||
|
|
||
| Scenario: An identity in a running experiment served no variant is exposed to control | ||
| Given the environment has the following features: | ||
| | feature | enabled | value | | ||
| | checkout | true | "control" | | ||
| And a running experiment on feature "checkout" enrolling 100% of identities, serving variant "treatment" with value "new checkout" to 0% of them | ||
| When the application gets the experiment flag "checkout" for identity "user_123" with traits: | ||
| | trait | value | | ||
| | plan | "premium" | | ||
| Then the application receives the following flags: | ||
| | feature | enabled | value | | ||
| | checkout | true | "control" | | ||
| And Flagsmith has received the following events: | ||
| | event | feature | identifier | value | traits | metadata | | ||
| | $flag_exposure | checkout | user_123 | "control" | {"plan": "premium"} | {"experiment_id": "<experiment>"} | | ||
|
|
||
| Scenario: An identity a running experiment does not enroll is not exposed | ||
| Given the environment has the following features: | ||
| | feature | enabled | value | | ||
| | checkout | true | "control" | | ||
| And a running experiment on feature "checkout" enrolling 0% of identities, serving variant "treatment" with value "new checkout" to 100% of them | ||
| When the application gets the experiment flag "checkout" for identity "user_123" with traits: | ||
| | trait | value | | ||
| | plan | "premium" | | ||
| Then the application receives the following flags: | ||
| | feature | enabled | value | | ||
| | checkout | true | "control" | | ||
| And Flagsmith has received no events | ||
|
|
||
| Scenario: An identity outside a running experiment is not exposed | ||
| Given the environment has the following features: | ||
| | feature | enabled | value | | ||
| | checkout | true | "control" | | ||
| When the application gets the experiment flag "checkout" for identity "user_123" with traits: | ||
| | trait | value | | ||
| | plan | "premium" | | ||
| Then the application receives the following flags: | ||
| | feature | enabled | value | | ||
| | checkout | true | "control" | | ||
| And Flagsmith has received no events | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.