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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding an Icon in test fails after 4.7.0 #18803

Closed
2 tasks done
zoltanbedi opened this issue Dec 12, 2019 · 2 comments
Closed
2 tasks done

Finding an Icon in test fails after 4.7.0 #18803

zoltanbedi opened this issue Dec 12, 2019 · 2 comments
Labels
external dependency Blocked by external dependency, we can鈥檛 do anything about it test

Comments

@zoltanbedi
Copy link
Contributor

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

Some of my tests started to fail because I use a syntax like this

import React from "react";
import RotateLeftIcon from "@material-ui/icons/RotateLeft";
import Enzyme, { mount } from "enzyme";
import Adapter from "enzyme-adapter-react-16";

import { RotateLeft } from "./RotateLeft";

Enzyme.configure({ adapter: new Adapter() });

it("renders properly", () => {
  const wrapper = mount(<RotateLeft />);
  console.log(wrapper.find(RotateLeftIcon).debug({ verbose: true }));
  expect(wrapper.exists(RotateLeftIcon)).toBeTruthy();
});

Expected Behavior 馃

I expect that it should still work.

Steps to Reproduce 馃暪

This test fails with 4.7.0 but not with 4.6.1
https://codesandbox.io/s/material-demo-7yfry

@oliviertassinari oliviertassinari added duplicate This issue or pull request already exists external dependency Blocked by external dependency, we can鈥檛 do anything about it and removed duplicate This issue or pull request already exists labels Dec 12, 2019
@oliviertassinari
Copy link
Member

We had a similar report on enzymejs/enzyme#2146 (comment).

@zoltanbedi
Copy link
Contributor Author

Didn't notice the duplicate bug.
I went with this approach #15928 (comment) refactoring my tests with data-attributes. Thanks for the fast response Oliver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external dependency Blocked by external dependency, we can鈥檛 do anything about it test
Projects
None yet
Development

No branches or pull requests

2 participants