I am getting the error ⠇ TypeError: fn is not a function
while running my artillery test file.
Here is the yml
layout:
target: "https://www.therisecollection.co/" # Update with your test URL
# Load the Playwright engine:
engines:
playwright: {}
processor: './javascriptTest.js'
phases:
- duration: 60
arrivalRate: 5
name: Warm up
- duration: 120
arrivalRate: 5
rampTo: 50
name: Ramp up load
- duration: 600
arrivalRate: 50
name: Sustained load
scenarios:
- engine: "playwright"
flowFunction: 'viewHome'
flow: []
here is the JavaScript I am attempting to use:
async function viewHome(page) {
await page.goto('https://www.therisecollection.co/');
await page.getByRole('button', { name: 'Home' }).click();
await page.getByRole('button', { name: 'About' }).click();
await page.getByRole('button', { name: 'Home' }).click();
await page.getByRole('button', { name: 'About' }).click();
await page.getByRole('button', { name: 'Home' }).click();
await page.getByRole('button', { name: 'About' }).click();
await page.getByRole('button', { name: 'Home' }).click();
await page.getByRole('button', { name: 'About' }).click();
}
module.export = viewHome;
I have seen the following recommended but haven't attempted this yet:
What is the best way to begin debugging this issue? From what I can see, everything related to the function is defined correctly.
You need to export the function as a named export. So:
module.exports = {
viewHome
};