use of code.satyagraha.gfm.viewer.bots.ProjectBot in project gfm_viewer by satyagraha.
the class MarkdownViewTest method shouldFollowEditorSelectedWhenLinked.
@Test
public void shouldFollowEditorSelectedWhenLinked() throws Exception {
LOGGER.info("");
assertThat(MarkdownViewBot.isPresent(), is(false));
ProjectBot project = ProjectBot.createSimpleProject();
project.newFile("file1.md");
project.newFile("file2.md");
MarkdownViewBot markdownViewBot = MarkdownViewBot.open();
assertThat(MarkdownViewBot.isPresent(), is(true));
EditorBot editorBot1 = EditorBot.findByName("file1.md").show();
SWTUtils.sleep(2000);
assertThat(markdownViewBot.getTitle(), is("file1"));
EditorBot editorBot2 = EditorBot.findByName("file2.md").show();
SWTUtils.sleep(2000);
assertThat(markdownViewBot.getTitle(), is("file2"));
editorBot2.close();
SWTUtils.sleep(2000);
assertThat(markdownViewBot.getTitle(), is("file1"));
editorBot1.close();
SWTUtils.sleep(2000);
assertThat(markdownViewBot.getTitle(), is("file1"));
markdownViewBot.close();
project.delete();
}
use of code.satyagraha.gfm.viewer.bots.ProjectBot in project gfm_viewer by satyagraha.
the class MarkdownViewTest method shouldGenerateHTMLviaContextMenu.
@Test
public void shouldGenerateHTMLviaContextMenu() throws Exception {
LOGGER.info("");
assertThat(MarkdownViewBot.isPresent(), is(false));
ProjectBot project = ProjectBot.createSimpleProject();
ProjectFileBot fileBot = project.newFile("file1.md");
EditorBot editorBot = EditorBot.findByName("file1.md");
String textMd = "sample text, timestamp: " + System.currentTimeMillis() + ".";
editorBot.typeText(textMd + "\r");
editorBot.save();
editorBot.close();
File fileMd = fileBot.toFile();
File fileHt = new File(fileMd.getParentFile(), ".file1.md.html");
assertThat(fileHt.exists(), is(false));
fileBot.generateMarkdownPreview();
SWTUtils.sleep(2000);
assertThat("not found: " + fileHt, fileHt.exists(), is(true));
String textHt = IOUtils.toString(new FileInputStream(fileHt));
assertThat(textHt, containsString(textMd));
EditorBot.closeAll();
project.delete();
}
use of code.satyagraha.gfm.viewer.bots.ProjectBot in project gfm_viewer by satyagraha.
the class MarkdownViewTest method shouldNotFollowEditorSelectedWhenNotLinked.
@Test
public void shouldNotFollowEditorSelectedWhenNotLinked() throws Exception {
LOGGER.info("");
assertThat(MarkdownViewBot.isPresent(), is(false));
ProjectBot project = ProjectBot.createSimpleProject();
project.newFile("file1.md");
project.newFile("file2.md");
MarkdownViewBot markdownViewBot = MarkdownViewBot.open();
assertThat(MarkdownViewBot.isPresent(), is(true));
SWTBotToolbarButton linkedButton = markdownViewBot.getLinkedButton();
EditorBot editorBot1 = EditorBot.findByName("file1.md").show();
SWTUtils.sleep(2000);
assertThat(markdownViewBot.getTitle(), is("file1"));
EditorBot editorBot2 = EditorBot.findByName("file2.md").show();
SWTUtils.sleep(2000);
assertThat(markdownViewBot.getTitle(), is("file2"));
// set unlinked
linkedButton.click();
editorBot2.close();
SWTUtils.sleep(2000);
assertThat(markdownViewBot.getTitle(), is("file2"));
editorBot1.close();
SWTUtils.sleep(2000);
assertThat(markdownViewBot.getTitle(), is("file2"));
linkedButton.click();
markdownViewBot.close();
project.delete();
}
Aggregations