Hi, @ppcano ! I was following your approach to using it in my project.
I copied the webpack.config.js, tsconfig.json, .babelrc files and installed the devDependencies in my project that uses the POM “pattern” (I just only did a minor change in the GlobEntries changing the path to my performance tests).
When I tried to use the chromium browser (import { chromium } from 'k6/experimental/browser';, I got this error: Module '"k6/experimental/browser"' has no exported member 'chromium'.
Sample.-
import { sleep, check } from "k6";
import { chromium } from 'k6/experimental/browser';
import { SLLoginPage } from '../pages/SLLoginPage';
import { SLProductPage } from '../pages/SLProductsPage';
let slLoginPage: SLLoginPage;
let slProductPage: SLProductPage;
export const options = {
scenarios: {
login: {
executor: 'constant-vus',
exec: 'login',
vus: 1
}
},
};
export async function login() {
const browser = chromium.launch({
headless: true,
slowMo: '500ms'
});
const context = browser.newContext();
const page = context.newPage();
try {
slLoginPage = new SLLoginPage(page);
slProductPage = new SLProductPage(page);
await slLoginPage.goTo();
await slLoginPage.fillLoginForm(process.env.USERNAME as string, process.env.PASSWORD as string);
await page.waitForURL('**/dashboard', { timeout: 3000 });
} finally {
page.close();
browser.close();
}
Thanks in advance for your help. Have a great day!
Did I do something wrong? Or is there any actual problem in the template? I have installed the typescript dependencies and tried again the same error persisted.
I encountered the same problem and solved it, so I’d like to share it.
In my case, the cause was simply that “.babelrc” was not cloned from the template.