Skip to content

Instantly share code, notes, and snippets.

@sahajamit
Last active March 24, 2025 16:26
Show Gist options
  • Save sahajamit/8d137aa026574ef781dca380cbc82d3c to your computer and use it in GitHub Desktop.
Save sahajamit/8d137aa026574ef781dca380cbc82d3c to your computer and use it in GitHub Desktop.
AutomationFrameworkMigrationPrompt.md

Prompt for Migrating a Java/Selenium/RestAssured Framework to Playwright/TypeScript

I have a Java-based automation framework using Selenium for UI testing and RestAssured for API testing. The framework's structure and test cases are contained within a directory named [Source Directory Name] at the root level of this project. Please migrate this entire framework to use Playwright with TypeScript for both UI and API testing. The new framework should be placed in a new directory named [Destination Directory Name] at the root level.

The current framework includes:

  • UI Tests: Implemented using Selenium, likely with a Page Object Model (POM) or similar design pattern. These tests cover various user interactions with the web application.
  • API Tests: Implemented using RestAssured, covering the testing of RESTful APIs. These tests verify API functionality, data integrity, and response codes.
  • Test Framework: Likely using JUnit or TestNG for test execution, reporting, and assertion.
  • Build Tool: Likely Maven or Gradle for dependency management and build processes.
  • Utilities and Helpers: Custom classes for common tasks such as browser setup, data handling, reporting, logging, and configuration management.

The migration should include the following:

  1. UI Test Migration:

    • Migrate all Selenium-based UI tests to Playwright with TypeScript.
    • Maintain the existing POM or similar design pattern, adapting it to Playwright's API.
    • Ensure all UI test cases are successfully converted and functionally equivalent.
    • Handle browser interactions, element locators, waits, and assertions using Playwright's capabilities.
  2. API Test Migration:

    • Migrate all RestAssured-based API tests to Playwright's API testing capabilities using TypeScript.
    • Ensure all API test cases are successfully converted and functionally equivalent.
    • Handle API requests, responses, status codes, data validation (including JSON schema validation if used in the original framework), and authentication.
  3. Test Framework Migration:

    • Migrate the test framework from JUnit/TestNG to a suitable JavaScript testing framework like Jest or Mocha.
    • Ensure all tests can be executed, and reports can be generated.
  4. Build Tool Migration:

    • Migrate the build tool from Maven/Gradle to npm or yarn.
    • Configure the build process for TypeScript compilation, test execution, and dependency management.
  5. Utilities and Helpers Migration:

    • Migrate all utility and helper classes to TypeScript.
    • Adapt these utilities to work with Playwright and the chosen JavaScript testing framework.
  6. Configuration Management:

    • Migrate the configuration mechanism (e.g., properties files, environment variables) to a suitable approach for Node.js and TypeScript.
  7. Code Quality and Style:

    • Adhere to TypeScript best practices and coding conventions.
    • Ensure the migrated codebase is well-structured, readable, and maintainable.
  8. Directory Structure:

    • Maintain a logical and organized directory structure in the new project, mirroring the original framework's structure where appropriate.
  9. Documentation: Provide a brief README in the [Destination Directory Name] outlining the migration process, setup instructions, and how to run the tests.

Please provide the complete migrated code base in the [Destination Directory Name] directory. If there are any specific challenges or limitations encountered during the migration, please document them in the README. If any dependencies are required, please provide a package.json file in the root directory of the [Destination Directory Name] directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment