Cloud Browser Testing: Save Screenshots

Here is a really simple script for k6 browser testing.

export const options = {
	scenarios: {
		browser: {
			executor: "constant-vus",
			exec: "browserTest",
			vus: 10,
			duration: "60s",
			options: {
				browser: {
					type: "chromium",
				},
			},
		},
	},
	cloud: {
		distribution: {
			distributionLabel1: { loadZone: "amazon:de:frankfurt", percent: 100 },
		},
	},
};

export async function browserTest() {
	const page = browser.newPage();

	try {
		await page.goto("https://google.com");

		page.screenshot({ path: "screenshots/screenshot.png" });
	} finally {
		page.close();
	}
}

The script is working totally fine when running local via k6 run test-script.js , but in cloud (via k6 cloud test-script.js) screenshots are not saved. The rest is working fine.

Error Message:

ERRO[0139] Uncaught (in promise) GoError: taking screenshot of page: persisting screenshot: creating a local directory "screenshots": mkdir screenshots: permission denied

Apparently I do not have permission to create a folder. Do I somehow have the option to save screenshots during k6 cloud testing? Unfortunately, I couldn’t find anything about this in the docs or the forum and I’m wondering, as it should be a pretty basic requirement.