test-automation

spjoshis's avatarfrom spjoshis

Master test automation with Selenium, Cypress, Playwright, framework design, and maintainable automated tests.

⭐1stars🔀0forks📁View on GitHub🕐Updated Dec 30, 2025

When & Why to Use This Skill

This Claude skill provides comprehensive guidance for mastering modern test automation frameworks including Selenium, Cypress, and Playwright. It empowers developers and QA engineers to build robust, maintainable automated test suites, implement scalable architectures like the Page Object Model, and integrate testing into CI/CD pipelines to ensure high-quality software delivery.

Use Cases

  • Automating regression testing suites to ensure new code deployments do not break existing application functionality.
  • Implementing the Page Object Model (POM) to create organized, reusable, and easy-to-maintain test codebases.
  • Integrating automated tests into CI/CD pipelines for continuous testing and immediate feedback on code quality.
  • Executing cross-browser and API testing to validate application reliability across different environments and backend services.
  • Developing data-driven testing strategies to validate complex business logic with multiple input datasets.
nametest-automation
descriptionMaster test automation with Selenium, Cypress, Playwright, framework design, and maintainable automated tests.

Test Automation

Build robust automated test suites using modern frameworks like Selenium, Cypress, and Playwright for efficient regression testing.

When to Use This Skill

  • Regression testing automation
  • CI/CD integration
  • API testing automation
  • Cross-browser testing
  • Performance testing
  • Smoke test automation
  • Data-driven testing
  • Continuous testing

Core Concepts

1. Cypress Test Example

// cypress/e2e/login.cy.js
describe('User Login', () => {
  beforeEach(() => {
    cy.visit('/login')
  })

  it('should login successfully with valid credentials', () => {
    cy.get('[data-testid="email"]').type('user@example.com')
    cy.get('[data-testid="password"]').type('SecurePass123!')
    cy.get('[data-testid="login-btn"]').click()

    cy.url().should('include', '/dashboard')
    cy.get('[data-testid="welcome-msg"]')
      .should('contain', 'Welcome')
  })

  it('should show error with invalid credentials', () => {
    cy.get('[data-testid="email"]').type('invalid@example.com')
    cy.get('[data-testid="password"]').type('wrong')
    cy.get('[data-testid="login-btn"]').click()

    cy.get('[data-testid="error-msg"]')
      .should('be.visible')
      .and('contain', 'Invalid credentials')
  })
})

2. Page Object Model

// pages/LoginPage.js
class LoginPage {
  get emailInput() { return cy.get('[data-testid="email"]') }
  get passwordInput() { return cy.get('[data-testid="password"]') }
  get loginButton() { return cy.get('[data-testid="login-btn"]') }
  get errorMessage() { return cy.get('[data-testid="error-msg"]') }

  login(email, password) {
    this.emailInput.type(email)
    this.passwordInput.type(password)
    this.loginButton.click()
  }

  verifyLoginError(message) {
    this.errorMessage.should('contain', message)
  }
}

export default new LoginPage()

// Test using Page Object
import LoginPage from '../pages/LoginPage'

it('login test', () => {
  cy.visit('/login')
  LoginPage.login('user@example.com', 'password')
})

3. API Test Example (REST Assured - Java)

@Test
public void testGetUser() {
    given()
        .baseUri("https://api.example.com")
        .header("Authorization", "Bearer " + token)
        .pathParam("id", "123")
    .when()
        .get("/users/{id}")
    .then()
        .statusCode(200)
        .body("id", equalTo("123"))
        .body("name", notNullValue())
        .body("email", containsString("@"));
}

Best Practices

  1. Use selectors wisely - data-testid over CSS
  2. Page Object Model - Maintainable structure
  3. Wait strategies - Explicit over implicit
  4. Independent tests - No test dependencies
  5. Test data management - Fixtures, factories
  6. Clear assertions - Meaningful error messages
  7. Screenshot on failure - Debug information
  8. CI/CD integration - Automated execution

Resources