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

Acceptance Testing #1973

Closed
maitriyogin opened this issue Oct 23, 2015 · 4 comments
Closed

Acceptance Testing #1973

maitriyogin opened this issue Oct 23, 2015 · 4 comments
Labels
new feature New feature or request

Comments

@maitriyogin
Copy link

Hi,
first thanks for an awesome implementation!
And keeping upto date so fast, cool.
Anyway, I'm wondering what the best practices are for identifying dom elements for acceptance testing?
I'm using nightwatch but would be the same for protractor, fitness etc ...
I can't seem to find a way of setting ids on the components ? which may not be the best way to go anyway and I'v been moving more to adding html5 test attributes (testId=something) on elements to keep the ids seperate...
I'm having to set a BEM style name on the class attribute contentClassName="login__dialog" which I can then query in my tests
client.expect.element('.login__dialog').to.be.present.before(500);

What is the best practice for this?

Setting a classname feels a bit spooky, not having an id I can understand, but not having a way of setting say a html5 attribute for testing purposes is kind of challenging ...
Look forward to your replies,
Stephen.

@oliviertassinari
Copy link
Member

I don't know what is the best way to do fonctionnal testing. However I can expose you how I'm doing it.

As you said, the challenge is regarding selecting elements. To do it I'm adding data-test property to the root of my component.
Then to get ride of them in the production build, I'm using https://github.com/oliviertassinari/babel-plugin-react-remove-properties

@maitriyogin
Copy link
Author

sounds interesting, are you just putting that property directly on the MUI React component?
like <FlatButton data-test='appbar__logout’ />
/Stephen.

On 23 Oct 2015, at 15:30, Olivier Tassinari [email protected] wrote:

I don't know what is the best way to do fonctionnal testing. However I can expose you how I'm doing it.

As you said, the challenge is regarding selecting elements. To do it I'm adding data-test property to the root of my component.
Then to get ride of them in the production build, I'm using https://github.com/oliviertassinari/babel-plugin-react-remove-properties https://github.com/oliviertassinari/babel-plugin-react-remove-properties

Reply to this email directly or view it on GitHub #1973 (comment).

@oliviertassinari
Copy link
Member

Yes, like this.
It may not works for some components. I had to submit a PR for those one. (merged now)

@alitaheri alitaheri added new feature New feature or request Core labels Dec 9, 2015
@mbrookes
Copy link
Member

See #3330.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants