Coder Social home page Coder Social logo

Comments (5)

dgozman avatar dgozman commented on June 25, 2024 1

We can also see whether the counter is increasing here: https://github.com/search?q=beforeEach%28async+%28%7B+mount+%7D%29&type=code (43 matches ATM).

Thank you for the link! Looking at the usages, some of them look totally fine to me. Maybe it's not that obvious a decision, and folks should decide for themselves 😄

from playwright.

dgozman avatar dgozman commented on June 25, 2024

@sand4rt I think ESLint rule and/or docs is the way to fix this, instead of arbitrarily restricting mount() in some environments. There is always a way to introduce unmaintainable mess to the codebase 😄 We should have some "best practices" or "pitfalls" in the documentation describing this. Let me know what you think.

from playwright.

sand4rt avatar sand4rt commented on June 25, 2024

I agree that there will always be ways to introduce mess, but i don't think there is any benefit of using test.beforeEach(async ({ mount }) or test.afterEach(async ({ mount }) in component testing though.

That's right. I just don't want us to introduce special cases like this, at least for now, until we see a lot of users bumping into this particular issue.

Some "best practices" or "pitfalls" would definitly be nice anyway. What would be the right place for this?

I guess the same test-components.md? We have not yet figured out a way to structure component testing docs alongside e2e docs, so let's pile up more content in that large guide for now.

from playwright.

sand4rt avatar sand4rt commented on June 25, 2024

That's alright. I might add a "best practices" section in test-components.md later on.

I don't think there are many people who will report this, but let's see. Any chance the feature-components tag could be added? We can also see whether the counter is increasing here: https://github.com/search?q=beforeEach%28async+%28%7B+mount+%7D%29&type=code (43 matches ATM).

from playwright.

sand4rt avatar sand4rt commented on June 25, 2024

Thank you for the link! Looking at the usages, some of them look totally fine to me. Maybe it's not that obvious a decision, and folks should decide for themselves 😄

Some of them look fine now, but will look terrible when they evolve, especially if different props are needed for a few tests. In my opinion, it's better to provide users the right handles rather than trying to support everything in component testing. This same mistake was made during the Enzyme days and was a painfull lesson learned. Might be interesting to save a few links and set a reminder to check in after a few months :D

I totally respect that you don't want to add an special case just for component testing tho!

from playwright.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.