kiteto logo

Running Tests

How to run the Playwright tests generated by kiteto

Overview

Once kiteto has generated a Playwright test for your web application, you can download the test code and run it locally. This page explains how to integrate kiteto-generated tests into an existing Playwright project.

If you are completely new to Playwright and have not set it up yet, our blog post on running Playwright tests walks you through the full setup from scratch. Alternatively, have a look into the official Playwright installation guide.


Getting the generated test code

Once kiteto has finished generating a test, click the Integrate Test button that appears on the generation page. This opens a modal with the generated TypeScript test code.

Click Copy code inside the modal to copy it to your clipboard.

The generated code is a standard Playwright test file that you can drop into any Playwright project without further modifications.


Adding the test to your project

  1. In your Playwright project, open the folder that holds your test files (default: tests/)
  2. Create a new file, e.g. tests/my-kiteto-test.spec.ts
  3. Paste the copied code into the file and save it

Note

Playwright automatically discovers all files ending with .spec.ts or .test.ts, so no additional configuration is required.


Running the test

Run only the kiteto-generated test file:

npx playwright test tests/my-kiteto-test.spec.ts

Or run all tests in your project at once:

npx playwright test

By default Playwright runs tests in Chromium, Firefox, and WebKit. You can restrict this in your playwright.config.ts if needed.


Reviewing the results

Terminal output

After the run, the terminal shows a summary:

Running 1 test using 1 worker
  1 passed (4.1s)

HTML report

For a detailed, interactive report open:

npx playwright show-report

The report lets you inspect each test step, view screenshots taken during the run, and drill into failure traces.


Troubleshooting

SymptomLikely causeWhat to try
Cannot find module '@playwright/test'Playwright not installedRun npm install in your project
Test fails on first stepThe target URL has changedUpdate the URL in the generated test file
Element not foundPage layout changed since generationRe-generate the test in kiteto
Test timeout of 30000ms exceededPage or action is slower than the default 30 s test timeoutIncrease timeout in playwright.config.ts (see below)
locator.click: Timeout 30000ms exceededA single action (click, fill, …) takes longer than the default action timeoutSet actionTimeout in playwright.config.ts (see below)

Adjusting timeouts

Playwright has two independent timeout settings that are most relevant for kiteto-generated tests:

  • timeout — maximum duration for an entire test (default: 30 000 ms)
  • use.actionTimeout — maximum duration for a single action such as a click or form fill (default: none, inherits from timeout)

Increase them globally in playwright.config.ts:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  timeout: 60_000, // 60 s per test
  use: {
    actionTimeout: 15_000, // 15 s per action
    navigationTimeout: 30_000, // 30 s for page.goto()
  },
});

Or override the test timeout for a single file only:

import { test } from '@playwright/test';

test.setTimeout(60_000);

test('my kiteto test', async ({ page }) => {
  // …
});

See the Playwright timeout documentation for the full list of available options.


Next steps

  • Automate: Integrate the test file into your CI/CD pipeline (e.g. GitHub Actions or GitLab CI) so it runs automatically on every push
  • Extend: Generate additional kiteto tests for other user flows and organise them by feature in separate files
  • Debug: Use npx playwright test --ui to step through a failing test interactively

On this page