Search in sources :

Example 1 with FxRobot

use of org.testfx.api.FxRobot in project honest-profiler by jvm-profiling-tools.

the class FlatDiffViewTest method testFlatDiffViewScenario.

// Actual Test Method
@Test
public void testFlatDiffViewScenario() {
    FxRobot robot = new FxRobot();
    waitUntil(asyncFx(() -> getMainStage().setMaximized(true)));
    newProfileTab(robot, app(), 0, "Base : " + baseScenario.getName(), baseScenario, LOG);
    newProfileTab(robot, app(), 1, "New : " + newScenario.getName(), newScenario, LOG);
    selectTab(robot, 1);
    selectCtxMenu(robot, "#compareButton", 0, "Base : " + baseScenario.getName());
    selectTab(robot, 2);
    selectView(robot, FLAT);
    selectFrameGrouping(robot, frameGrouping, "#flat");
    TableView<DiffEntry> tableView = getFlatDiffTableView(robot);
    newScenario.checkFlatDiffAggregation(baseScenario, new FlatDiffTableViewCheckAdapter(BY_ID, frameGrouping, tableView));
}
Also used : FlatDiffTableViewCheckAdapter(com.insightfullogic.honest_profiler.framework.checker.FlatDiffTableViewCheckAdapter) FxRobot(org.testfx.api.FxRobot) DiffEntry(com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffEntry) AbstractJavaFxTest(com.insightfullogic.honest_profiler.ports.javafx.framework.AbstractJavaFxTest) Test(org.junit.Test)

Example 2 with FxRobot

use of org.testfx.api.FxRobot in project honest-profiler by jvm-profiling-tools.

the class TreeViewQuickFilterTest method testTreeQuickFilterScenario.

// Actual Test Method
@Test
public void testTreeQuickFilterScenario() {
    FxRobot robot = new FxRobot();
    newProfileTab(robot, app(), 0, scenario.getName(), scenario, LOG);
    selectView(robot, TREE);
    focusOn(robot, "#quickFilterText", "#tree");
    robot.write("ba");
    clickQuickFilterButton(robot, "#tree");
    checkResult(robot, keyFlt(s -> s.contains("ba")));
    selectView(robot, TREE);
    focusOn(robot, "#quickFilterText", "#tree");
    robot.type(BACK_SPACE, BACK_SPACE, ENTER);
    checkResult(robot);
}
Also used : ThreadGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.ThreadGrouping) AbstractJavaFxTest(com.insightfullogic.honest_profiler.ports.javafx.framework.AbstractJavaFxTest) HPFXUtil.clickExpandAll(com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.clickExpandAll) BACK_SPACE(javafx.scene.input.KeyCode.BACK_SPACE) HPFXUtil.focusOn(com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.focusOn) Node(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node) RunWith(org.junit.runner.RunWith) Parameters(org.junit.runners.Parameterized.Parameters) HPFXUtil.clickQuickFilterButton(com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.clickQuickFilterButton) ParameterUtil.getScenarios(com.insightfullogic.honest_profiler.framework.ParameterUtil.getScenarios) LOG(com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext.ProfileMode.LOG) TreeTableView(javafx.scene.control.TreeTableView) HPFXUtil.getTreeTableView(com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.getTreeTableView) Arrays.asList(java.util.Arrays.asList) ScenarioStraightFilter.keyFlt(com.insightfullogic.honest_profiler.framework.scenario.ScenarioStraightFilter.keyFlt) FxRobot(org.testfx.api.FxRobot) HPFXUtil.selectThreadGrouping(com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.selectThreadGrouping) FrameGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.FrameGrouping) Parameterized(org.junit.runners.Parameterized) HPFXUtil.newProfileTab(com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.newProfileTab) TREE(com.insightfullogic.honest_profiler.ports.javafx.ViewType.TREE) HPFXUtil.selectFrameGrouping(com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.selectFrameGrouping) Collection(java.util.Collection) Test(org.junit.Test) SimplifiedLogScenario(com.insightfullogic.honest_profiler.framework.scenario.SimplifiedLogScenario) HPFXUtil.selectView(com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.selectView) TreeTableViewCheckAdapter(com.insightfullogic.honest_profiler.framework.checker.TreeTableViewCheckAdapter) ENTER(javafx.scene.input.KeyCode.ENTER) Ignore(org.junit.Ignore) ScenarioStraightFilter(com.insightfullogic.honest_profiler.framework.scenario.ScenarioStraightFilter) FxRobot(org.testfx.api.FxRobot) AbstractJavaFxTest(com.insightfullogic.honest_profiler.ports.javafx.framework.AbstractJavaFxTest) Test(org.junit.Test)

Example 3 with FxRobot

use of org.testfx.api.FxRobot in project honest-profiler by jvm-profiling-tools.

the class HPFXUtil method newProfileTab.

// Profile Creation
public static final void newProfileTab(FxRobot robot, JavaFXApplication application, int expectedIndex, String name, LogScenario scenario, ProfileMode mode) {
    TabPane tabPane = robot.lookup("#profileTabs").query();
    waitUntil(() -> tabPane.isVisible());
    assertEquals(expectedIndex, tabPane.getTabs().size());
    ProfileContextGenerator gen = new ProfileContextGenerator(application, name, mode);
    waitUntil(asyncFx(() -> gen.createNewProfile(scenario)));
    waitUntil(() -> tabPane.getTabs().size() == expectedIndex + 1);
    Tab tab = tabPane.getTabs().get(expectedIndex);
    waitUntil(() -> ((Parent) tab.getGraphic()).getChildrenUnmodifiable().stream().filter(node -> node instanceof Label && name.equals(((Label) node).getText())).findFirst().isPresent());
}
Also used : EventHandler(javafx.event.EventHandler) Button(javafx.scene.control.Button) DiffEntry(com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffEntry) WaitForAsyncUtils.asyncFx(org.testfx.util.WaitForAsyncUtils.asyncFx) ThreadGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.ThreadGrouping) MouseButton(javafx.scene.input.MouseButton) Node(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node) Control(javafx.scene.control.Control) MouseEvent(javafx.scene.input.MouseEvent) TimeoutException(java.util.concurrent.TimeoutException) Callable(java.util.concurrent.Callable) ProfileContextGenerator(com.insightfullogic.honest_profiler.framework.generator.ProfileContextGenerator) WaitForAsyncUtils.waitFor(org.testfx.util.WaitForAsyncUtils.waitFor) Parent(javafx.scene.Parent) Future(java.util.concurrent.Future) TreeTableView(javafx.scene.control.TreeTableView) TabPane(javafx.scene.control.TabPane) JavaFXApplication(com.insightfullogic.honest_profiler.ports.javafx.JavaFXApplication) ContextMenu(javafx.scene.control.ContextMenu) Entry(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry) FxRobot(org.testfx.api.FxRobot) Assert.fail(org.junit.Assert.fail) TableView(javafx.scene.control.TableView) FrameGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.FrameGrouping) DiffNode(com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffNode) ViewType(com.insightfullogic.honest_profiler.ports.javafx.ViewType) PRIMARY(javafx.scene.input.MouseButton.PRIMARY) LogScenario(com.insightfullogic.honest_profiler.framework.scenario.LogScenario) Label(javafx.scene.control.Label) MenuItem(javafx.scene.control.MenuItem) Boolean.getBoolean(java.lang.Boolean.getBoolean) ChoiceBox(javafx.scene.control.ChoiceBox) DOWN(javafx.scene.input.KeyCode.DOWN) SECONDARY(javafx.scene.input.MouseButton.SECONDARY) ENTER(javafx.scene.input.KeyCode.ENTER) ProfileMode(com.insightfullogic.honest_profiler.ports.javafx.model.ProfileContext.ProfileMode) Tab(javafx.scene.control.Tab) SECONDS(java.util.concurrent.TimeUnit.SECONDS) Assert.assertEquals(org.junit.Assert.assertEquals) TabPane(javafx.scene.control.TabPane) Tab(javafx.scene.control.Tab) Label(javafx.scene.control.Label) ProfileContextGenerator(com.insightfullogic.honest_profiler.framework.generator.ProfileContextGenerator)

Example 4 with FxRobot

use of org.testfx.api.FxRobot in project honest-profiler by jvm-profiling-tools.

the class SampleCountTest method testSampleCount.

// Actual Test Method
@Test
public void testSampleCount() {
    FxRobot robot = new FxRobot();
    newProfileTab(robot, app(), 0, scenario.getName(), scenario, LOG);
    Label label = robot.lookup("#profileSampleCount").query();
    waitUntil(() -> label.getText() != null && !label.getText().isEmpty());
    assertEquals(scenario.getTraceCount() + " samples", label.getText());
}
Also used : Label(javafx.scene.control.Label) FxRobot(org.testfx.api.FxRobot) AbstractJavaFxTest(com.insightfullogic.honest_profiler.ports.javafx.framework.AbstractJavaFxTest) Test(org.junit.Test)

Example 5 with FxRobot

use of org.testfx.api.FxRobot in project honest-profiler by jvm-profiling-tools.

the class TreeDiffViewTest method testTreeDiffViewScenario.

// Actual Test Method
@Test
public void testTreeDiffViewScenario() {
    FxRobot robot = new FxRobot();
    waitUntil(asyncFx(() -> getMainStage().setMaximized(true)));
    newProfileTab(robot, app(), 0, "Base : " + baseScenario.getName(), baseScenario, LOG);
    newProfileTab(robot, app(), 1, "New : " + newScenario.getName(), newScenario, LOG);
    selectTab(robot, 1);
    selectCtxMenu(robot, "#compareButton", 0, "Base : " + baseScenario.getName());
    selectTab(robot, 2);
    selectView(robot, TREE);
    selectFrameGrouping(robot, frameGrouping, "#tree");
    selectThreadGrouping(robot, threadGrouping, "#tree");
    clickExpandAll(robot, "#tree");
    TreeTableView<DiffNode> tableView = getTreeDiffTableView(robot);
    newScenario.checkTreeDiffAggregation(baseScenario, new TreeDiffTableViewCheckAdapter(threadGrouping, frameGrouping, tableView));
}
Also used : TreeDiffTableViewCheckAdapter(com.insightfullogic.honest_profiler.framework.checker.TreeDiffTableViewCheckAdapter) DiffNode(com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffNode) FxRobot(org.testfx.api.FxRobot) AbstractJavaFxTest(com.insightfullogic.honest_profiler.ports.javafx.framework.AbstractJavaFxTest) Test(org.junit.Test)

Aggregations

FxRobot (org.testfx.api.FxRobot)11 AbstractJavaFxTest (com.insightfullogic.honest_profiler.ports.javafx.framework.AbstractJavaFxTest)7 Test (org.junit.Test)7 FrameGrouping (com.insightfullogic.honest_profiler.core.aggregation.grouping.FrameGrouping)3 Entry (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry)3 Node (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node)3 ThreadGrouping (com.insightfullogic.honest_profiler.core.aggregation.grouping.ThreadGrouping)2 DiffEntry (com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffEntry)2 DiffNode (com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffNode)2 ParameterUtil.getScenarios (com.insightfullogic.honest_profiler.framework.ParameterUtil.getScenarios)2 FlatTableViewCheckAdapter (com.insightfullogic.honest_profiler.framework.checker.FlatTableViewCheckAdapter)2 TreeTableViewCheckAdapter (com.insightfullogic.honest_profiler.framework.checker.TreeTableViewCheckAdapter)2 ScenarioStraightFilter (com.insightfullogic.honest_profiler.framework.scenario.ScenarioStraightFilter)2 ScenarioStraightFilter.keyFlt (com.insightfullogic.honest_profiler.framework.scenario.ScenarioStraightFilter.keyFlt)2 SimplifiedLogScenario (com.insightfullogic.honest_profiler.framework.scenario.SimplifiedLogScenario)2 HPFXUtil.clickQuickFilterButton (com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.clickQuickFilterButton)2 HPFXUtil.focusOn (com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.focusOn)2 HPFXUtil.newProfileTab (com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.newProfileTab)2 HPFXUtil.selectFrameGrouping (com.insightfullogic.honest_profiler.ports.javafx.framework.HPFXUtil.selectFrameGrouping)2 ResourceBundle (java.util.ResourceBundle)2