Java Code Examples for org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor#getTitle()

The following examples show how to use org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor#getTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestWebPurchase.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testWebPurchase() throws Exception {
    SWTBotTestUtil.createNewDiagram(bot);
    final SWTBotEditor botEditor = bot.activeEditor();
    diagramTitle = botEditor.getTitle();
    final SWTBotGefEditor gmfEditor = bot.gefEditor(botEditor.getTitle());

    final SWTBotGefEditPart element = gmfEditor.getEditPart("Step1");
    element.click();
    gmfEditor.clickContextMenu("Delete");
    gmfEditor.click(200, 200);
    gmfEditor.clickContextMenu("Delete");
    gmfEditor.click(200, 200);
    configurePool(gmfEditor);
    stepGateWayXor(gmfEditor);
    stepSalesReview(gmfEditor);
    stepMoreInfo(gmfEditor);
    stepPay(gmfEditor);
    stepReject(gmfEditor);
    stepExpressDelivery(gmfEditor);
    stepArchive(gmfEditor);
    finalEvent(gmfEditor);
    bot.toolbarButtonWithId(SWTBotConstants.SWTBOT_ID_SAVE_EDITOR).click();
    configureProcess(gmfEditor);
    runProcess(gmfEditor);
}
 
Example 2
Source File: TestTimer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return
 */
private SWTBotGefEditor addTimerAndTaskToDiagram() {
    // create new Diagram
    SWTBotTestUtil.createNewDiagram(bot);
    final SWTBotEditor activeEditor = bot.activeEditor();
    final String editorTitle = activeEditor.getTitle();

    final SWTBotGefEditor gmfEditor = bot.gefEditor(editorTitle);

    // add a Timer
    gmfEditor.activateTool("Timer");
    gmfEditor.click(400, 100);
    gmfEditor.click(400, 200);

    // Add Transition Timer1 -> Step1
    SWTBotTestUtil.selectTransitionFromSelectedElementAndDragIt(gmfEditor, "Step1", new Point(405, 105));

    // Add Service Task & Transition Timer1 -> Step2
    SWTBotTestUtil.selectTaskFromSelectedElementAndDragIt(gmfEditor, "Timer1", new Point(610, 110));
    return gmfEditor;
}
 
Example 3
Source File: TestTimer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a Diagram, and remove the initial Start and Task.
 *
 * @return
 * @throws InterruptedException
 */
private SWTBotGefEditor createNewEmptyDiagram() throws InterruptedException {
    SWTBotTestUtil.createNewDiagram(bot);
    final SWTBotEditor activeEditor = bot.activeEditor();
    final String editorTitle = activeEditor.getTitle();

    final SWTBotGefEditor gmfEditor = bot.gefEditor(editorTitle);

    // remove actual diagram
    gmfEditor.getEditPart("Start1").parent().select();

    bot.sleep(500);
    SWTBotTestUtil.pressDelete();
    gmfEditor.getEditPart("Step1").parent().select();

    bot.sleep(500);
    SWTBotTestUtil.pressDelete();
    return gmfEditor;
}
 
Example 4
Source File: BarExporterTest.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void testServerBuild() {

    SWTBotTestUtil.createNewDiagram(bot);
    final SWTBotEditor activeEditor = bot.activeEditor();
    final String editorTitle = activeEditor.getTitle();
    assertFalse("Error: first diagram name is empty.", editorTitle.isEmpty());

    final BotExecutionDiagramPropertiesView executionTab = new BotProcessDiagramPropertiesViewFolder(bot)
            .selectExecutionTab();
    executionTab.selectInstantiationFormTab().selectNone();
    new BotGefProcessDiagramEditor(bot).selectElement("Step1");
    executionTab.selectFormTab().selectNone();

    // get the GEF editor to activate tools
    final SWTBotGefEditor gmfEditor = bot.gefEditor(editorTitle);

    // Create 2 Pools
    gmfEditor.activateTool("Pool");
    gmfEditor.click(200, 500);

    new BotProcessDiagramPropertiesViewFolder(bot).selectExecutionTab().selectInstantiationFormTab().selectNone();

    gmfEditor.activateTool("Pool");
    gmfEditor.click(200, 800);

    new BotProcessDiagramPropertiesViewFolder(bot).selectExecutionTab().selectInstantiationFormTab().selectNone();

    // Save Diagram
    bot.menu("File").menu("Save").click();
    bot.waitUntil(BonitaBPMConditions.noPopupActive());

    // Menu Server > Build...
    bot.menu("Server").menu("Build...").click();

    // shell 'Build'
    final SWTBotShell shell = bot.shell(Messages.buildTitle);
    bot.waitUntil(Conditions.shellIsActive(Messages.buildTitle));

    // select and check created Diagram in the Tree
    final SWTBotTree tree = bot.treeWithLabel("Select processes to export");
    final SWTBotTreeItem diagramTreeItem = tree.getTreeItem(editorTitle);

    // check the diagram to export
    diagramTreeItem.select().check();
    diagramTreeItem.expand();

    // Number of pool in the diagram
    final int poolListSize = diagramTreeItem.getItems().length;
    assertEquals("Error: Diagram must contain 3 Pools.", 3, poolListSize);

    // unselect the first pool of the list

    diagramTreeItem.getNode(0).select();
    diagramTreeItem.getNode(0).uncheck();

    final List<String> poolTitleList = new ArrayList<>(3);
    final int poolTitleListSize = poolTitleList.size();

    // check the selected pools
    for (int i = 1; i < poolTitleListSize; i++) {
        final SWTBotTreeItem poolTreeItem = diagramTreeItem.getNode(i);
        poolTitleList.set(i, poolTreeItem.getText());
        final String poolName = getItemName(poolTitleList.get(i));

        // test the good pool is checked
        assertFalse("Error: Pool " + i + " should be checked.", !poolTreeItem.isChecked());
        assertFalse("Error: Pool selected is not the good one.", !poolName.equals("Pool" + i));
    }
    // create tmp directory to write diagrams
    final File tmpBarFolder = new File(ProjectUtil.getBonitaStudioWorkFolder(), "testExportBar");
    tmpBarFolder.deleteOnExit();
    tmpBarFolder.mkdirs();
    //set the path where files are saved
    final String tmpBarFolderPath = tmpBarFolder.getAbsolutePath();
    bot.comboBoxWithLabel(Messages.destinationPath + " *").setText(tmpBarFolderPath);

    // click 'Finish' button to close 'Build' shell
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL)));
    bot.button(IDialogConstants.FINISH_LABEL).click();

    //  click 'OK' button to close 'Export' shell
    bot.waitUntil(new ShellIsActiveWithThreadSTacksOnFailure(Messages.exportSuccessTitle), 10000);
    bot.button(IDialogConstants.OK_LABEL).click();

    // wait the shell to close before checking creation of files
    bot.waitUntil(Conditions.shellCloses(shell));

    // check pools files exist
    for (int i = 1; i < poolTitleListSize; i++) {
        final String tmpPoolTitle = poolTitleList.get(i);
        final String poolFileName = getItemName(tmpPoolTitle) + "--" + getItemVersion(tmpPoolTitle) + ".bar";
        final File poolFile = new File(tmpBarFolderPath, poolFileName);
        poolFile.deleteOnExit();
        assertTrue("Error: The Pool export must exist", poolFile.exists());
        assertTrue("Error: The Pool export must be a file", poolFile.isFile());
    }
}