Skip to content

Latest commit

 

History

History
138 lines (102 loc) · 4.4 KB

File metadata and controls

138 lines (102 loc) · 4.4 KB

WebTestPilot

License: MIT Node.js Version

An AI-powered VS Code extension for automated web testing and test case generation.

Table of Contents

Demo

Demo

Clone repo

git clone --recurse-submodules https://github.com/code-philia/WebTestPilot-extension.git
cd WebTestPilot-extension
git submodule sync --recursive
git submodule update --init --recursive

Prerequisites

Setup

Setup environement variables

# Copy sample .env file
cp .env.example .env

# Fill in the OPENAI_API_KEY in .env ...

Install uv

Install uv using the following scripts:

# For MacOS
curl -LsSf https://astral.sh/uv/install.sh | sh

# For Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# Test the command
uv

For more details, refer to original uv document.

Setup Extension

# If don't have yarn
npm install --global yarn

# MacOS / Linux / WSL
source setup.sh

# Windows
powershell -ExecutionPolicy Bypass -File setup.ps1

if you see the output below, it means the extension is installed successfully. setup-result

Usage

Start the Development Server

  1. Start chrome browser instance:
# MacOS / Linux / WSL
source browser.sh

# Windows
powershell -ExecutionPolicy Bypass -File browser.ps1

you will see this output and a chrome browser instance opened. browser-result

  1. Open file src/extension.ts.
  2. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac) and search for command: "Debug: Start Debugging", click it and choose "VS Code Extension Development". start-debugging choose-debugger-type

Open the Testcase Folder

  1. In the extension debug window (with the title of "[Extention Development Host]")
  2. Open the sample folder inside the WebTestPilot-extension repo.
  3. Press Ctrl+Shift+P and type "WebTestPilot: Set Workspace...", then select the WebTestPilot-extension folder. set-workspace choose-workspace

Run and Add Testcase

  1. Click the WebTestPilot extension icon in the sidebar. extension-icon
  2. Check the "Real Sites" option in the WebTestPilot sidebar for running test on real websites. real-sites
  3. Click "Run test" to run single test. extension-icon
  4. Write your own testcases in json format in the sample folder, and back to WebTestPilot sidebar to run the test.

In case of updates

When there are updates to the code base, run the following command and then restart the extension.

First, update build

# MacOS / Linux / WSL
source setup.sh

# Windows
sh setup.sh

Second, restart the extension. Click the restart button here (after debugging started) restart-extension

or, stop the debugger and start again:

stop-extension start-debugging

Instructions how to use WebTestPilot

A walkthrough demo of WebTestPilot Demo

There are 3 main functionalities of WebTestPilot:

  • Test cases: steps to perform (i.e. "Click Login button") and its expected result (i.e. "Login screen show up").
  • Fixtures: shared common steps before a test case, i.e. many test cases need login, we can have a fixture for login.
  • Environment variables: we define common variables such as WEBSITE_URL, USERNAME, PASSWORD, ... these can be used in fixtures and test cases in the form of ${WEBSITE_URL}.

Examples: fixtures, testcases and environments in ./sample.

This image shows how all three functionalities can be used together.

webtestpilot