IKivan-kozenko -aqa
Try yourself as a QA tester
Back to topic

Quiz

Components (experimental)

Check yourself

  1. 1.You're testing an OrderForm component. You write vi.mock('./api/orders', () => ({ createOrder: vi.fn() })) at the top of your component test file, expecting the mock to intercept API calls made by the component. But the component still calls the real API. Why?
  2. 2.What environment does the component run in during a Playwright component test?
  3. 3.You're setting up Playwright component testing for a React project. Which package do you install?
  4. 4.Your OrderForm component accepts an onSubmit(order: Order) callback. Order contains a non-serializable Date object. You try to pass the callback directly via mount() but crossing the Node/browser boundary fails. What's the fix?
  5. 5.You're testing a Vue component that uses vue-router for navigation links. The component crashes because there's no router instance. How do you set up the router for all component tests?
  6. 6.Which configuration object lets a specific test pass per-test data to the beforeMount hook in playwright/index.ts?
  7. 7.Should you call mount() in beforeEach or inside each individual test?
  8. 8.A ProductCard component fetches /api/product/123 on mount and renders the price. In a component test, you want to control what the API returns. What's the correct approach?