
com.github.invictum.panels.builder.FramePanelBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of invictum-test-core Show documentation
Show all versions of invictum-test-core Show documentation
Used as a base for automation. Based on Serenity BDD project.
The newest version!
package com.github.invictum.panels.builder;
import com.github.invictum.panels.AbstractPanel;
import com.github.invictum.panels.frame.FramePanelMethodInterceptor;
import com.github.invictum.panels.init.PanelInitUtil;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import java.util.List;
public class FramePanelBuilder extends PanelBuilder {
public FramePanelBuilder(Class panelClass) {
super(panelClass);
}
@Override
public T build() {
// Start panel init
getPage().activateIfJQueryRelated(locator());
PanelInitUtil.applyGlobalInitStrategy(panelClass(), getPage());
// Build panel as a proxy with auto switch
Enhancer enhancer = new Enhancer();
enhancer.setClassLoader(panelClass().getClassLoader());
enhancer.setSuperclass(panelClass());
MethodInterceptor interceptor = new FramePanelMethodInterceptor(getPage().getDriver(), locator());
enhancer.setCallback(interceptor);
T panelInstance = (T) enhancer.create();
// Finish panel init
panelInstance.initWith(getPage(), null);
PanelInitUtil.invokeWhenInitializedMethods(panelInstance);
return panelInstance;
}
@Override
public List buildAll() {
throw new IllegalStateException("Failed to init several frame panels");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy