I’m having trouble getting cbPlaywright to run. When I run my tests (/tests/runner.cfm
) I get the following exception. I must have missed a setup step. Any ideas?
Global Bundle Exception (3 ms)
cannot load class through its string name, because no definition for the class with the specified name [com.microsoft.playwright.Playwright$CreateOptions] could be found caused by (java.lang.ClassNotFoundException:com.microsoft.playwright.Playwright$CreateOptions;java.lang.ClassNotFoundException:com.microsoft.playwright.Playwright$CreateOptions not found by lucee.core [49];)
40: variables.javaSystem.setProperty( "playwright.cli.dir", driverDir );
41:
42: var playwrightOptions = createObject( "java", "com.microsoft.playwright.Playwright$CreateOptions" ).init();
43: variables.playwright = createObject( "java", "com.microsoft.playwright.impl.PlaywrightImpl" ).create( playwrightOptions );
44: }
Application.cfc
<cfscript>
component {
variables.modulesDir = getDirectoryFromPath('/modules/');
this.javaSettings = {
loadPaths = directoryList("#variables.modulesDir#/cbPlaywright/lib", true, "array", "*jar"),
loadColdFusionClassPath = true,
reloadOnChange = false
};
this.mappings[ "/testbox" ] = "#variables.modulesDir#/testbox";
this.mappings[ "/cbPlaywright" ] = "#variables.modulesDir#/cbPlaywright";
}
</cfscript>
runner.cfm
<cfset r = new testbox.system.TestBox(directory="tests") >
<cfoutput>#r.run()#</cfoutput>
Test.cfc
<cfscript>
component extends="cbPlaywright.models.PlaywrightTestCase" {
function run() {
describe( "home page", () => {
it( "can visit the home page", () => {
var browser = variables.playwright.firefox().launch();
var page = browser.newPage();
navigate( page, "http://" & CGI.HTTP_HOST );
waitForLoadState( page );
expect( page.title() ).toBe( "Welcome to my site!" );
} );
} );
}
}
</cfscript>