Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Run Playwright script through K6

$
0
0

I would like to give load of multiple users from K6 tool and the automation script is recorded in Playwright. When I run the script using K6 run test.js getting below error.Value is not an object: undefined

import { exec } from 'k6/execution';import { sleep } from 'k6';export let options = {stages: [    { duration: '10m', target: 10 }, // Ramp up to 10 users over 1 minute    { duration: '9m', target: 10 }, // Stay at 10 users for 9 minutes    { duration: '1m', target: 0 }   // Ramp down to 0 users over 1 minute    ],thresholds: {    http_req_duration: ['p(95)<500'], // Thresholds for response time    }};export default function () {    exec('playwright test HRH.spec.js'); // Execute the Playwright script via command line    sleep(1); // Add some delay if needed}

getting error in exec function.Below are code from HRH.spec.js

import { test, expect } from '@playwright/test';test('test', async ({ page }) => {  await page.goto('https://www.google.com/');});

Standalone Plywright script run resultC:/k6project/tests> npx playwright test .\HRH.spec.js --headed

Running 1 test using 1 worker

✓ 1 HRH.spec.js:3:5 › test (1.3s)

1 passed (3.0s)

Above script with K6 tool run resultC:/k6project/tests>k6 run script.js

      /\      |‾‾| /‾‾/   /‾‾/ /\  /  \     |  |/  /   /  //  \/    \    |     (   /   ‾‾\

/ \ | |\ \ | (‾) |/ __________ \ || _\ __/ .io

 execution: local    script: script.js    output: - scenarios: (100.00%) 1 scenario, 10 max VUs, 40s max duration (incl. graceful stop):          * default: Up to 10 looping VUs for 10s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s)

ERRO[0000] TypeError: Value is not an object: undefinedat file:///C:/k6project/tests/script.js:51:9(5) executor=ramping-vus scenario=default source=stacktraceERRO[0000] TypeError: Value is not an object: undefinedat file:///C:/k6project/tests/script.js:51:9(5) executor=ramping-vus scenario=default source=stacktrace


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>