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

Test Angular App using Playright #5

Open
reboottime opened this issue Jun 5, 2024 · 1 comment
Open

Test Angular App using Playright #5

reboottime opened this issue Jun 5, 2024 · 1 comment
Labels

Comments

@reboottime
Copy link
Owner

reboottime commented Jun 5, 2024

Overview

This article talks about testing angular app using playwright.

@reboottime reboottime added the 2024 label Jun 5, 2024
@reboottime
Copy link
Owner Author

reboottime commented Jun 8, 2024

Testing philosophy

Rule 1: Test user-visible behavior

  • Automated tests should verify that the application code works for the end users. The end user will see or interact with what is rendered on the page, so your test should typically only see/interact with the same rendered output. (source)
  • Ideally, locate elements using accessibility labels and roles, if possible.
  • If not possible:
    • Use testId
    • You can configure Playwright-related ID with your own prefix
      import { defineConfig } from '@playwright/test';
      
      export default defineConfig({
        use: {
          testIdAttribute: 'data-pw'
        }
      });

Rule 2: Avoid testing third-party dependencies by mocking third-party responses

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

No branches or pull requests

1 participant