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

provide better example for async snapshot testing #7745

Closed
macrozone opened this issue Aug 12, 2019 · 61 comments
Closed

provide better example for async snapshot testing #7745

macrozone opened this issue Aug 12, 2019 · 61 comments

Comments

@macrozone
Copy link
Contributor

Is your feature request related to a problem? Please describe.

the readme of storyshots mentions a way to do async snapshot testing, e.g. if you use apollo or siilar: https://github.com/storybookjs/storybook/tree/master/addons/storyshots/storyshots-core#storyshots-for-async-rendered-components

There are two problems with that example:

  • it uses enzyme, while default storybook uses react-test-renderer. If you just migrate to that solution, all your snapshot will be different
  • enzyme-to-json will render all properties (at least im my case). This is not what you want, you want to diff the resulting html. it also seems to run out of memory on larger stories. I think this is because i use a decorator that provides the apolloclient

Describe the solution you'd like

I'd like to see a way to configure this async rendering with the default storybook renderer

Describe alternatives you've considered

Houff... i tried many things... Best solution so far is this (using diffable-html and enzym's html())

import initStoryshots, { Stories2SnapsConverter } from "@storybook/addon-storyshots";
import { shallow, mount } from "enzyme";
import { act } from "react-dom/test-utils";
import "jest-styled-components";
import toDiffableHtml from "diffable-html";
import preloadAll from "jest-next-dynamic";

beforeAll(async () => {
  await preloadAll();
});

const waitForNextTick = () => new Promise((resolve) => setTimeout(resolve));

initStoryshots({
  asyncJest: true,
  test: async ({ story, context, done }) => {
    const converter = new Stories2SnapsConverter();
    const snapshotFilename = converter.getSnapshotFileName(context);
    const storyElement = story.render();
    const tree = mount(storyElement);
    await act(async () => {
      await waitForNextTick();
    });
    tree.update();
    if (snapshotFilename) {
      expect(toDiffableHtml(tree.html())).toMatchSpecificSnapshot(snapshotFilename);
    }
    done();
  },
});

I hope that if async rendering lands in react, these problems will be solved...

Are you able to assist bring the feature to reality?

yes, but i want to gather better solutions here (if any) first.

@stale
Copy link

stale bot commented Sep 2, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Sep 2, 2019
@krishnaglick
Copy link

Would love a better solution for this!

@stale stale bot removed the inactive label Sep 4, 2019
@stale
Copy link

stale bot commented Sep 25, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Sep 25, 2019
@macrozone
Copy link
Contributor Author

no! bad stale-bot!

...

ok, you are just doing your job... but... has no one in the whole storybook-comunity found a better way for asyns snaphost testing? :-/

@stale stale bot removed the inactive label Sep 25, 2019
@stale
Copy link

stale bot commented Oct 16, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Oct 16, 2019
@krishnaglick
Copy link

Bumping this, bloody stalebot.

@stale stale bot removed the inactive label Oct 17, 2019
@stale
Copy link

stale bot commented Nov 7, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Nov 7, 2019
@macrozone
Copy link
Contributor Author

no! stalebot! we are not done here!

@stale stale bot removed the inactive label Nov 7, 2019
@macrozone
Copy link
Contributor Author

i want to bump this because i can't believe that there is no better way. I am looking for a solution for over a year now and i am very astonished that no one came up with a solution.

my workaround has a lot of downsides, e.g. jest-styled-components does not work with it and the diff is slow and hard to parse.

@krishnaglick
Copy link

https://github.com/storybookjs/storybook/tree/master/addons/storyshots/storyshots-puppeteer
Looks like this could work for it. I spent a little bit of time trying to but ran into trouble. May revisit when I've got more time.

@stale
Copy link

stale bot commented Dec 16, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Dec 16, 2019
@krishnaglick
Copy link

Bump

@stale stale bot removed the inactive label Dec 16, 2019
@stale
Copy link

stale bot commented Jan 7, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jan 7, 2020
@macrozone
Copy link
Contributor Author

shoo stale bot

@stale stale bot removed the inactive label Jan 7, 2020
@stale
Copy link

stale bot commented Jan 28, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jan 28, 2020
@rodgoeliz
Copy link

Does this seem reasonable?

import initStoryshots, { Stories2SnapsConverter } from '@storybook/addon-storyshots'
import { act, create } from 'react-test-renderer'

const converter = new Stories2SnapsConverter()

initStoryshots({
  asyncJest: true,
  test: async ({ story, context, done }) => {
    const filename = converter.getSnapshotFileName(context)

    if (!filename) {
      return
    }

    // render the component
    const renderer = create(story.render())

    // wait for state changes, wrapped in act
    await act(() => new Promise((resolve) => setTimeout(resolve)))

    expect(renderer.toJSON()).toMatchSpecificSnapshot(filename)

    renderer.unmount()

    done()
  },
})

Seems okey by me, thank you. you are awesome.
I think these are the types.

import initStoryshots, { Stories2SnapsConverter } from '@storybook/addon-storyshots';
import { StoryContext } from '@storybook/react/types-6-0';
import { act, create, ReactTestRenderer } from 'react-test-renderer';

const wait = () => act(() => new Promise((resolve) => setTimeout(resolve, 10)));

const converter = new Stories2SnapsConverter();

const runTest = async (story: StoryContext, context: StoryContext) => {
  const filename = converter.getSnapshotFileName(context);

  if (!filename) return;

  const storyElement = story.render();
  let tree: ReactTestRenderer | undefined;
  act(() => {
    tree = create(storyElement) as ReactTestRenderer;
  });

  await wait();

  expect(tree?.toJSON()).toMatchSpecificSnapshot(filename);
  tree?.unmount();
};

initStoryshots({
  asyncJest: true,
  test: ({ story, context, done }) => {
    runTest(story, context).then(done);
  },
});

@macrozone
Copy link
Contributor Author

problem is, that toJSON is not a good idea as it may contain also code from the decorator of the story (and in my case completly breaks because of memory problem).

the default does not seem to use toJSON, i could not figure out how the default works. We just need to have the default snapshot mechanism with the additional wait()

@stale
Copy link

stale bot commented Dec 25, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Dec 25, 2020
@corbinasapp
Copy link

Stalebot no!

@Nerlin
Copy link

Nerlin commented Mar 18, 2021

In case someone will need it, here's an example how we run async snapshot tests in our project using react-testing-library and msw:

import initStoryshots from "@storybook/addon-storyshots";
import { act, render } from "@testing-library/react";
import { setupServer } from "msw/node";

initStoryshots({
  asyncJest: true,
  test: async ({ story, context, done }) => {
    const endpoints = context.parameters.msw ?? [];
    const server = setupServer(...endpoints);
    server.listen();

    try {
      const jsx = story.render();
      const { unmount, rerender, container } = await render(jsx);

      // wait for state changes
      await act(() => new Promise((resolve) => setTimeout(resolve)));

      await rerender(jsx);
      expect(container).toMatchSnapshot();

      unmount();
      done!();
    } finally {
      server.close();
    }
  },
});

@macrozone
Copy link
Contributor Author

In case someone will need it, here's an example how we run async snapshot tests in our project using react-testing-library and msw:

import initStoryshots from "@storybook/addon-storyshots";
import { act, render } from "@testing-library/react";
import { setupServer } from "msw/node";

initStoryshots({
  asyncJest: true,
  test: async ({ story, context, done }) => {
    const endpoints = context.parameters.msw ?? [];
    const server = setupServer(...endpoints);
    server.listen();

    try {
      const jsx = story.render();
      const { unmount, rerender, container } = await render(jsx);

      // wait for state changes
      await act(() => new Promise((resolve) => setTimeout(resolve)));

      await rerender(jsx);
      expect(container).toMatchSnapshot();

      unmount();
      done!();
    } finally {
      server.close();
    }
  },
});

wow that actually works much better and only takes a litte more then half the time of my previous implementation, thank you very much!

@millermedeiros
Copy link

millermedeiros commented Mar 25, 2021

since none of the solutions above worked for my repository — React.createElement is required for hooks to work as expected, can't call story.render() directly — I wrote these two solutions:

import React from 'react';
import { create, act } from 'react-test-renderer';
import initStoryshots from '@storybook/addon-storyshots';
import wait from 'waait';

initStoryshots({
  asyncJest: true,
  test: async ({ story, done }) => {
    let renderer;
    act(() => {
      // React.createElement() is important because of hooks [shouldn't call story.render() directly]
      renderer = create(React.createElement(story.render));
    });

    // Let one render cycle pass before rendering snapshot
    await act(() => wait(0));

    // save all snapshots to the same file (similar to "snapshotWithOptions")
    expect(renderer).toMatchSnapshot();

    done();
  }
});

Or if you want to save the snapshots to multiple files (similar to multiSnapshotWithOptions):

import React from 'react';
import { create, act } from 'react-test-renderer';
import initStoryshots, { Stories2SnapsConverter } from '@storybook/addon-storyshots';
import wait from 'waait';

const converter = new Stories2SnapsConverter();

initStoryshots({
  asyncJest: true,
  test: async ({ story, context, done }) => {
    let renderer;
    act(() => {
      // React.createElement() is important because of hooks [shouldn't call story.render() directly]
      renderer = create(React.createElement(story.render));
    });

    // Let one render cycle pass before rendering snapshot
    await act(() => wait(0));

    // save each snapshot to a different file (similar to "multiSnapshotWithOptions")
    const snapshotFileName = converter.getSnapshotFileName(context);
    expect(renderer).toMatchSpecificSnapshot(snapshotFileName);

    done();
  }
});

PS: tested this on @storybook/react@6.1.18 and @storybook/addon-storyshots@6.1.18; some components using @apollo/react-hooks@4.0.0 and @apollo/react-testing@4.0.0 MockedProvider; and some components using regular hooks like useState, useEffect and useContext.

@froleo
Copy link

froleo commented Apr 1, 2021

@millermedeiros Thank you! This helped me enable async testing and get rid of "Component is not wrapped in act" errors from my tests.

@annaloukianova I was using createNodeMock to fix Material UI Dialog related warnings in my previous setup,
this solution works for me in combination with async testing:

import React from "react";
import ReactDOM from "react-dom";
import initStoryshots, {
  Stories2SnapsConverter,
} from "@storybook/addon-storyshots";
import { create, act } from "react-test-renderer";
import wait from "waait";
import "regenerator-runtime/runtime";

// Mock fetch
require("jest-fetch-mock").enableMocks();

//Fix portal / fade related issues
ReactDOM.createPortal = jest.fn((element, node) => {
  if (!element.style) {
    return React.cloneElement(element, { style: { webkitTransition: "" } });
  }
  return element;
});

jest.mock("@material-ui/core/Fade");
jest.mock("@material-ui/core/Zoom");

const converter = new Stories2SnapsConverter();

initStoryshots({
  asyncJest: true,
  test: async ({ story, context, done }) => {
    let renderer;
    act(() => {
      // React.createElement() is important because of hooks [shouldn't call story.render() directly]
      renderer = create(React.createElement(story.render), {
        // Fix Portal / MUI Dialog issues
        createNodeMock: (node) => document.createElement(node.type),
      });
    });

    // Let one render cycle pass before rendering snapshot
    await act(() => wait(0));

    // save each snapshot to a different file (similar to "multiSnapshotWithOptions")
    const snapshotFileName = converter.getSnapshotFileName(context);
    expect(renderer).toMatchSpecificSnapshot(snapshotFileName);

    done();
  },
});

Kuznietsov added a commit to Kuznietsov/kibana that referenced this issue Jun 23, 2021
Written current code, based on storybookjs/storybook#7745
@armordog
Copy link

armordog commented Jun 30, 2021

It's been a couple of years now.
Is Storyshots deprecated?
Or am I just supposed to avoid using it with anything that has state?

Edit: Sorry for my bitchy tone.
I know this problem isn't on purpose and I appreciate the work everyone has put into storybook and storyshots.

@shilman
Copy link
Member

shilman commented Jun 30, 2021

@armordog we're planning an overhaul of storyshots as part of the 6.x/7.0 cycle

Kuznietsov added a commit to Kuznietsov/kibana that referenced this issue Jul 2, 2021
Written current code, based on storybookjs/storybook#7745
@chris-jalon
Copy link

thank you to contributors in this thread.
@froleo much appreciated! this is needed to run storybook tests on components with state that use material ui.

also,
await act(() => wait(0));
can be replaced with:
await act(async () => {});
removing the need for the waait dependency.

@shilman is the intent to remove needless boilerplate like that posted above? specifically createNodeMock: (node) => document.createElement(node.type) which seems essential for Material-UI and use of act to prevent React lifecycle errors?

@shilman
Copy link
Member

shilman commented Jul 9, 2021

the focus of the overhaul is to make global test running more efficient and transparent.

we have a jest transform that converts a story file into a jest file with one test per story. the contents of each test is specified globally by the user, as is done today. the difference is that you can run jest tests (1) in parallel, (2) on a filtered set of files from the CLI, (3) only on changes since the last commit, etc.: all the stuff that jest is great at.

what goes inside the test function? we don't have any plans to automagically fix any of the issues above. however, with the renewed focus on testing we'll provide a set of zero-config best practices and recipes for common tasks, and you can expect more to come as we develop this neglected area of storybook.

@macrozone
Copy link
Contributor Author

the focus of the overhaul is to make global test running more efficient and transparent.

we have a jest transform that converts a story file into a jest file with one test per story. the contents of each test is specified globally by the user, as is done today. the difference is that you can run jest tests (1) in parallel, (2) on a filtered set of files from the CLI, (3) only on changes since the last commit, etc.: all the stuff that jest is great at.

what goes inside the test function? we don't have any plans to automagically fix any of the issues above. however, with the renewed focus on testing we'll provide a set of zero-config best practices and recipes for common tasks, and you can expect more to come as we develop this neglected area of storybook.

that sounds really promising!

Kuznietsov added a commit to elastic/kibana that referenced this issue Jul 15, 2021
* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Moved related components from canvas.

* Changed imports of components.

* Fixed renderer and storybook.

* Fixed types errors.

* Added limits.

* Removed useless translations and fixed .i18nrc.json

* added `done` handler call.

* Added more fixes fo i18nc.

* Added docs.

* More fixes of i18nrc.

* Fixed async functions.

Written current code, based on storybookjs/storybook#7745

* Fixed one test with Expression input.

After changing the way of rendering in stories, all elements are mounting and componentDidMount is involved. The previous snapshot was without
mounted `monaco` editor.

* Fixed storybook error.

* More fixes.

* removed unused translations.

* Removed handlers and changed the way of handling `resize` and calling `done`.

* Fixed i18n error.

* Fixed storybook.

* Replaced Popover with EuiPopover.

* Moved `Popover` back to `canvas`

* Removed `Popover` export from presentation_utils components.

* Moved error_component and debug_component from presentation_util to expression_error.

* Fixed translations and imports.

* Moved `debug renderer` to `expression_error` plugin.

* Fixed error.

* Fixed lazy exports.

* Fixed imports

* Fixed storybook snapshot.

* Removed `.i18nrc.json`.

* Fixed color of `error`.

* Exported concrete elements from popover.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Kuznietsov added a commit to Kuznietsov/kibana that referenced this issue Jul 15, 2021
* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Moved related components from canvas.

* Changed imports of components.

* Fixed renderer and storybook.

* Fixed types errors.

* Added limits.

* Removed useless translations and fixed .i18nrc.json

* added `done` handler call.

* Added more fixes fo i18nc.

* Added docs.

* More fixes of i18nrc.

* Fixed async functions.

Written current code, based on storybookjs/storybook#7745

* Fixed one test with Expression input.

After changing the way of rendering in stories, all elements are mounting and componentDidMount is involved. The previous snapshot was without
mounted `monaco` editor.

* Fixed storybook error.

* More fixes.

* removed unused translations.

* Removed handlers and changed the way of handling `resize` and calling `done`.

* Fixed i18n error.

* Fixed storybook.

* Replaced Popover with EuiPopover.

* Moved `Popover` back to `canvas`

* Removed `Popover` export from presentation_utils components.

* Moved error_component and debug_component from presentation_util to expression_error.

* Fixed translations and imports.

* Moved `debug renderer` to `expression_error` plugin.

* Fixed error.

* Fixed lazy exports.

* Fixed imports

* Fixed storybook snapshot.

* Removed `.i18nrc.json`.

* Fixed color of `error`.

* Exported concrete elements from popover.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	packages/kbn-optimizer/limits.yml
#	src/plugins/expression_error/public/components/debug/debug.tsx
Kuznietsov added a commit to elastic/kibana that referenced this issue Jul 15, 2021
* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Moved related components from canvas.

* Changed imports of components.

* Fixed renderer and storybook.

* Fixed types errors.

* Added limits.

* Removed useless translations and fixed .i18nrc.json

* added `done` handler call.

* Added more fixes fo i18nc.

* Added docs.

* More fixes of i18nrc.

* Fixed async functions.

Written current code, based on storybookjs/storybook#7745

* Fixed one test with Expression input.

After changing the way of rendering in stories, all elements are mounting and componentDidMount is involved. The previous snapshot was without
mounted `monaco` editor.

* Fixed storybook error.

* More fixes.

* removed unused translations.

* Removed handlers and changed the way of handling `resize` and calling `done`.

* Fixed i18n error.

* Fixed storybook.

* Replaced Popover with EuiPopover.

* Moved `Popover` back to `canvas`

* Removed `Popover` export from presentation_utils components.

* Moved error_component and debug_component from presentation_util to expression_error.

* Fixed translations and imports.

* Moved `debug renderer` to `expression_error` plugin.

* Fixed error.

* Fixed lazy exports.

* Fixed imports

* Fixed storybook snapshot.

* Removed `.i18nrc.json`.

* Fixed color of `error`.

* Exported concrete elements from popover.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	packages/kbn-optimizer/limits.yml
#	src/plugins/expression_error/public/components/debug/debug.tsx
Kuznietsov added a commit to Kuznietsov/kibana that referenced this issue Jul 15, 2021
Written current code, based on storybookjs/storybook#7745
Kuznietsov added a commit to elastic/kibana that referenced this issue Jul 21, 2021
* expression_reveal_image skeleton.

* expression_functions added.

* expression_renderers added.

* Backup of daily work.

* Fixed errors.

* Added legacy support. Added button for legacy.

* Added storybook.

* Removed revealImage from canvas.

* Types fixed.

* Fixed test suite error.

* Fixed eslint error.

* Moved UI and elements, related to expressionRevealImage from canvas.

* Fixed unused translations errors.

* Moved type of element to types.

* Fixed types and added service for representing elements, ui and supported renderers to canvas.

* Added expression registration to canvas.

* Fixed

* Fixed mutiple call of the function.

* Removed support of a legacy lib for revealImage chart.

* Removed legacy presentation_utils plugin import.

* Removed useless translations and tried to fix error.

* One more fix.

* Small imports fix.

* Fixed translations.

* Made fixes based on nits.

* Removed useless params.

* fix.

* Fixed errors, related to jest and __mocks__.

* Removed useless type definition.

* Replaced RendererHandlers with IInterpreterRendererHandlers.

* fixed supported_shareable.

* Moved elements back to canvas.

* Moved views to canvas, removed expression service and imported renderer to canvas.

* Fixed translations.

* Moved libs to presentation utils.

* Fixed types and removed function_wrapper.ts

* Fixed types of test helpers.

* Fixed imports.

* One more fix.

* Fixed public API.

* Moved css to component.

* Fixed spaces at element.

* Removed unused plugin.

* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Moved related components from canvas.

* Changed imports of components.

* Removed useless translations and fixed .i18nrc.json

* More fixes of i18nrc.

* Fixed async functions.

Written current code, based on storybookjs/storybook#7745

* Fixed one test with Expression input.

After changing the way of rendering in stories, all elements are mounting and componentDidMount is involved. The previous snapshot was without
mounted `monaco` editor.

* generated plugin and copied code from expression_reveal_image

* fixed double import after merge.

* Changed all names from reveal_image to shape.

* moved shape to plugin and added all necessary configs

* Fixed translations, fixed all imports and debug of svg.

* `function` moved to `server`.

* One shape is rewritten to `React` and rendering is written with passing necessary props.

* changed default width and heigth.

* Added `ShapeHOC`.

* Shapes changed.

* small refactor.

* Removed useless import.

* one more refactor.

* Refactor + fix errors + updated limits.

* Changed ShapePreview from pure js to react and removed `dangerouslySetInnerHTML`

* Fixed types of viewbox.

* Changed types source for Shape components.

* small refactor.

* Fixed imports.

* Removed `shape` from `canvas`

* Updated docs.

* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Changed imports of components.

* Fixed errors, related to shape and autosuggestions.

* Fixed i18n for shape.

* Moved function from public to common and registered at server.

* Fixed types error.

* Fixed snapshots and shape mocks.

* Moved some libs from `presentations_util` to `expression_shape`

* Shape refactored.

* Shape picker fixed.

* Moved `Popover` back to `canvas`

* Removed `Popover` export from presentation_utils components.

* Moved error_component and debug_component from presentation_util to expression_error.

* Removed `.i18nrc.json`.

* Removed `.i18nrc.json`.

* Removed useless scss.

* Fixed color of `error`.

* added fixes of rebase.

* More fixes of rebase error .

* Removed useless .i18nrc.json file.

* More fixes.

* More fixes of rebase.

* One more fix.

* More fixes.

* Fixed limits and translations.

* Added.

* Fixed i18nrc.

* Fixed error..

* Moved shapes to async chunks.

* One more fix.

* Some fixes.

* Trying to fix the typecheck error.

* Added temp of drawer.

* Moved shapes to the async chunk in a less complex way.

* Made `ShapeDrawer` reusable among different `expressions`.

* Changed type of `shapes` from `any` and `Shape` to `string`.

* Made changes, based on nits.

* Removed not necessary changes.

* Moved all reusable libs to `expression_shapes`.

* Reduced the size of the bundle.

* Hope, fixed type check errors.

* Removed getDefaultShapeData.

* Removed `getViewBox` from bundle.
Kuznietsov added a commit to Kuznietsov/kibana that referenced this issue Jul 21, 2021
* expression_reveal_image skeleton.

* expression_functions added.

* expression_renderers added.

* Backup of daily work.

* Fixed errors.

* Added legacy support. Added button for legacy.

* Added storybook.

* Removed revealImage from canvas.

* Types fixed.

* Fixed test suite error.

* Fixed eslint error.

* Moved UI and elements, related to expressionRevealImage from canvas.

* Fixed unused translations errors.

* Moved type of element to types.

* Fixed types and added service for representing elements, ui and supported renderers to canvas.

* Added expression registration to canvas.

* Fixed

* Fixed mutiple call of the function.

* Removed support of a legacy lib for revealImage chart.

* Removed legacy presentation_utils plugin import.

* Removed useless translations and tried to fix error.

* One more fix.

* Small imports fix.

* Fixed translations.

* Made fixes based on nits.

* Removed useless params.

* fix.

* Fixed errors, related to jest and __mocks__.

* Removed useless type definition.

* Replaced RendererHandlers with IInterpreterRendererHandlers.

* fixed supported_shareable.

* Moved elements back to canvas.

* Moved views to canvas, removed expression service and imported renderer to canvas.

* Fixed translations.

* Moved libs to presentation utils.

* Fixed types and removed function_wrapper.ts

* Fixed types of test helpers.

* Fixed imports.

* One more fix.

* Fixed public API.

* Moved css to component.

* Fixed spaces at element.

* Removed unused plugin.

* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Moved related components from canvas.

* Changed imports of components.

* Removed useless translations and fixed .i18nrc.json

* More fixes of i18nrc.

* Fixed async functions.

Written current code, based on storybookjs/storybook#7745

* Fixed one test with Expression input.

After changing the way of rendering in stories, all elements are mounting and componentDidMount is involved. The previous snapshot was without
mounted `monaco` editor.

* generated plugin and copied code from expression_reveal_image

* fixed double import after merge.

* Changed all names from reveal_image to shape.

* moved shape to plugin and added all necessary configs

* Fixed translations, fixed all imports and debug of svg.

* `function` moved to `server`.

* One shape is rewritten to `React` and rendering is written with passing necessary props.

* changed default width and heigth.

* Added `ShapeHOC`.

* Shapes changed.

* small refactor.

* Removed useless import.

* one more refactor.

* Refactor + fix errors + updated limits.

* Changed ShapePreview from pure js to react and removed `dangerouslySetInnerHTML`

* Fixed types of viewbox.

* Changed types source for Shape components.

* small refactor.

* Fixed imports.

* Removed `shape` from `canvas`

* Updated docs.

* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Changed imports of components.

* Fixed errors, related to shape and autosuggestions.

* Fixed i18n for shape.

* Moved function from public to common and registered at server.

* Fixed types error.

* Fixed snapshots and shape mocks.

* Moved some libs from `presentations_util` to `expression_shape`

* Shape refactored.

* Shape picker fixed.

* Moved `Popover` back to `canvas`

* Removed `Popover` export from presentation_utils components.

* Moved error_component and debug_component from presentation_util to expression_error.

* Removed `.i18nrc.json`.

* Removed `.i18nrc.json`.

* Removed useless scss.

* Fixed color of `error`.

* added fixes of rebase.

* More fixes of rebase error .

* Removed useless .i18nrc.json file.

* More fixes.

* More fixes of rebase.

* One more fix.

* More fixes.

* Fixed limits and translations.

* Added.

* Fixed i18nrc.

* Fixed error..

* Moved shapes to async chunks.

* One more fix.

* Some fixes.

* Trying to fix the typecheck error.

* Added temp of drawer.

* Moved shapes to the async chunk in a less complex way.

* Made `ShapeDrawer` reusable among different `expressions`.

* Changed type of `shapes` from `any` and `Shape` to `string`.

* Made changes, based on nits.

* Removed not necessary changes.

* Moved all reusable libs to `expression_shapes`.

* Reduced the size of the bundle.

* Hope, fixed type check errors.

* Removed getDefaultShapeData.

* Removed `getViewBox` from bundle.
# Conflicts:
#	packages/kbn-optimizer/limits.yml
Kuznietsov added a commit to elastic/kibana that referenced this issue Jul 21, 2021
* expression_reveal_image skeleton.

* expression_functions added.

* expression_renderers added.

* Backup of daily work.

* Fixed errors.

* Added legacy support. Added button for legacy.

* Added storybook.

* Removed revealImage from canvas.

* Types fixed.

* Fixed test suite error.

* Fixed eslint error.

* Moved UI and elements, related to expressionRevealImage from canvas.

* Fixed unused translations errors.

* Moved type of element to types.

* Fixed types and added service for representing elements, ui and supported renderers to canvas.

* Added expression registration to canvas.

* Fixed

* Fixed mutiple call of the function.

* Removed support of a legacy lib for revealImage chart.

* Removed legacy presentation_utils plugin import.

* Removed useless translations and tried to fix error.

* One more fix.

* Small imports fix.

* Fixed translations.

* Made fixes based on nits.

* Removed useless params.

* fix.

* Fixed errors, related to jest and __mocks__.

* Removed useless type definition.

* Replaced RendererHandlers with IInterpreterRendererHandlers.

* fixed supported_shareable.

* Moved elements back to canvas.

* Moved views to canvas, removed expression service and imported renderer to canvas.

* Fixed translations.

* Moved libs to presentation utils.

* Fixed types and removed function_wrapper.ts

* Fixed types of test helpers.

* Fixed imports.

* One more fix.

* Fixed public API.

* Moved css to component.

* Fixed spaces at element.

* Removed unused plugin.

* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Moved related components from canvas.

* Changed imports of components.

* Removed useless translations and fixed .i18nrc.json

* More fixes of i18nrc.

* Fixed async functions.

Written current code, based on storybookjs/storybook#7745

* Fixed one test with Expression input.

After changing the way of rendering in stories, all elements are mounting and componentDidMount is involved. The previous snapshot was without
mounted `monaco` editor.

* generated plugin and copied code from expression_reveal_image

* fixed double import after merge.

* Changed all names from reveal_image to shape.

* moved shape to plugin and added all necessary configs

* Fixed translations, fixed all imports and debug of svg.

* `function` moved to `server`.

* One shape is rewritten to `React` and rendering is written with passing necessary props.

* changed default width and heigth.

* Added `ShapeHOC`.

* Shapes changed.

* small refactor.

* Removed useless import.

* one more refactor.

* Refactor + fix errors + updated limits.

* Changed ShapePreview from pure js to react and removed `dangerouslySetInnerHTML`

* Fixed types of viewbox.

* Changed types source for Shape components.

* small refactor.

* Fixed imports.

* Removed `shape` from `canvas`

* Updated docs.

* Basic setup of error plugin.

* Removed not used `function` files at `error` expression.

* Changed imports of components.

* Fixed errors, related to shape and autosuggestions.

* Fixed i18n for shape.

* Moved function from public to common and registered at server.

* Fixed types error.

* Fixed snapshots and shape mocks.

* Moved some libs from `presentations_util` to `expression_shape`

* Shape refactored.

* Shape picker fixed.

* Moved `Popover` back to `canvas`

* Removed `Popover` export from presentation_utils components.

* Moved error_component and debug_component from presentation_util to expression_error.

* Removed `.i18nrc.json`.

* Removed `.i18nrc.json`.

* Removed useless scss.

* Fixed color of `error`.

* added fixes of rebase.

* More fixes of rebase error .

* Removed useless .i18nrc.json file.

* More fixes.

* More fixes of rebase.

* One more fix.

* More fixes.

* Fixed limits and translations.

* Added.

* Fixed i18nrc.

* Fixed error..

* Moved shapes to async chunks.

* One more fix.

* Some fixes.

* Trying to fix the typecheck error.

* Added temp of drawer.

* Moved shapes to the async chunk in a less complex way.

* Made `ShapeDrawer` reusable among different `expressions`.

* Changed type of `shapes` from `any` and `Shape` to `string`.

* Made changes, based on nits.

* Removed not necessary changes.

* Moved all reusable libs to `expression_shapes`.

* Reduced the size of the bundle.

* Hope, fixed type check errors.

* Removed getDefaultShapeData.

* Removed `getViewBox` from bundle.
# Conflicts:
#	packages/kbn-optimizer/limits.yml
@FokkeZB
Copy link

FokkeZB commented Jan 8, 2022

@Nerlin I've tried your solution for @testing-library/react in #7745 (comment), but for some reason the tests timeout - the await act() never resolves. Any idea?

@thienna
Copy link

thienna commented Mar 29, 2022

same as @FokkeZB

@ndelangen
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests