From 22944e115fef87fb8a3e3b3cf7b0db690d900b88 Mon Sep 17 00:00:00 2001 From: Denis Berezin <denis.berezin@metabase.com> Date: Tue, 6 Aug 2024 15:55:00 +0300 Subject: [PATCH] feat(sdk): Add storybook docs for embedding SDK e2e tests debug (#46496) --- docs/developers-guide/e2e-tests.md | 8 ++++++++ .../frontend/src/embedding-sdk/README.md | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/developers-guide/e2e-tests.md b/docs/developers-guide/e2e-tests.md index ab99415476a..82d9e1c4cf6 100644 --- a/docs/developers-guide/e2e-tests.md +++ b/docs/developers-guide/e2e-tests.md @@ -173,6 +173,14 @@ Cypress._.times(N, ()=> { }); ``` +### Embedding SDK tests + +Tests located in `e2e/test/scenarios/embedding-sdk` are used to run automated checks for the Embedding SDK. + +Embedding SDK is a library, and not an application. We use Storybook to host public components, and we run tests against it. + +In order to run stories used for tests locally, please check [storybook setup docs](https://github.com/metabase/metabase/blob/master/enterprise/frontend/src/embedding-sdk/README.md#storybook) + ## DB Snapshots At the beginning of each test suite we wipe the backend's db and settings cache. This ensures that the test suite starts in a predictable state. diff --git a/enterprise/frontend/src/embedding-sdk/README.md b/enterprise/frontend/src/embedding-sdk/README.md index 6f7bfad3d07..cbcc89787fb 100644 --- a/enterprise/frontend/src/embedding-sdk/README.md +++ b/enterprise/frontend/src/embedding-sdk/README.md @@ -86,7 +86,7 @@ java -jar metabase.jar You can then use the API key to authenticate with Metabase in your application. Here's an example of how you can authenticate with the API key: -``` +``` const metabaseConfig = { ... apiKey: "YOUR_API_KEY" @@ -1011,6 +1011,22 @@ disclosure [here](https://github.com/metabase/metabase/blob/master/SECURITY.md#r # Development +## Storybook + +You can use storybook to run SDK components during local development. + +When you have Metabase instance running: +```bash +yarn storybook-embedding-sdk +``` + + +### Initial configuration +1. Set JWT secret to be "`0000000000000000000000000000000000000000000000000000000000000000`" in Admin > Authentication > JWT > String used by the JWT signing key +1. Make sure "User Provisioning" setting is set to "`on`". +1. Set Authorized Origins to "`*`" in Admin > Embedding > Interactive embedding + + ## Building locally First you need to build the Metabase Embedding SDK for React locally: -- GitLab