mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
4708 only perform screen shot when test times out first time
This commit is contained in:
parent
bd5c6ba37e
commit
825c7ecb09
@ -42,6 +42,7 @@ import org.netbeans.jellytools.NbDialogOperator;
|
|||||||
import org.netbeans.jellytools.WizardOperator;
|
import org.netbeans.jellytools.WizardOperator;
|
||||||
import org.netbeans.jemmy.JemmyProperties;
|
import org.netbeans.jemmy.JemmyProperties;
|
||||||
import org.netbeans.jemmy.Timeout;
|
import org.netbeans.jemmy.Timeout;
|
||||||
|
import org.netbeans.jemmy.TimeoutExpiredException;
|
||||||
import org.netbeans.jemmy.Timeouts;
|
import org.netbeans.jemmy.Timeouts;
|
||||||
import org.netbeans.jemmy.operators.JButtonOperator;
|
import org.netbeans.jemmy.operators.JButtonOperator;
|
||||||
import org.netbeans.jemmy.operators.JCheckBoxOperator;
|
import org.netbeans.jemmy.operators.JCheckBoxOperator;
|
||||||
@ -67,7 +68,7 @@ public class AutopsyTestCases {
|
|||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(AutopsyTestCases.class.getName());
|
private static final Logger logger = Logger.getLogger(AutopsyTestCases.class.getName());
|
||||||
private long start;
|
private long start;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escapes the slashes in a file or directory path.
|
* Escapes the slashes in a file or directory path.
|
||||||
*
|
*
|
||||||
@ -96,274 +97,338 @@ public class AutopsyTestCases {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testNewCaseWizardOpen(String title) {
|
public void testNewCaseWizardOpen(String title) {
|
||||||
logger.info("New Case");
|
try {
|
||||||
resetTimeouts("WindowWaiter.WaitWindowTimeout", 240000);
|
logger.info("New Case");
|
||||||
NbDialogOperator nbdo = new NbDialogOperator(title);
|
setTimeout("WindowWaiter.WaitWindowTimeout", 240000);
|
||||||
JButtonOperator jbo = new JButtonOperator(nbdo, 0); // the "New Case" button
|
NbDialogOperator nbdo = new NbDialogOperator(title);
|
||||||
jbo.pushNoBlock();
|
JButtonOperator jbo = new JButtonOperator(nbdo, 0); // the "New Case" button
|
||||||
|
jbo.pushNoBlock();
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNewCaseWizard() {
|
public void testNewCaseWizard() {
|
||||||
logger.info("New Case Wizard");
|
try {
|
||||||
WizardOperator wo = new WizardOperator("New Case Information");
|
logger.info("New Case Wizard");
|
||||||
JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 1);
|
WizardOperator wo = new WizardOperator("New Case Information");
|
||||||
jtfo0.typeText("AutopsyTestCase"); // Name the case "AutopsyTestCase"
|
JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 1);
|
||||||
JTextFieldOperator jtfo1 = new JTextFieldOperator(wo, 2);
|
jtfo0.typeText("AutopsyTestCase"); // Name the case "AutopsyTestCase"
|
||||||
jtfo1.typeText(getEscapedPath(System.getProperty("out_path")));
|
JTextFieldOperator jtfo1 = new JTextFieldOperator(wo, 2);
|
||||||
wo.btNext().clickMouse();
|
jtfo1.typeText(getEscapedPath(System.getProperty("out_path")));
|
||||||
JTextFieldOperator jtfo2 = new JTextFieldOperator(wo, 0);
|
wo.btNext().clickMouse();
|
||||||
jtfo2.typeText("000"); // Set the case number
|
JTextFieldOperator jtfo2 = new JTextFieldOperator(wo, 0);
|
||||||
JTextFieldOperator jtfo3 = new JTextFieldOperator(wo, 1);
|
jtfo2.typeText("000"); // Set the case number
|
||||||
jtfo3.typeText("Examiner 1"); // Set the case examiner
|
JTextFieldOperator jtfo3 = new JTextFieldOperator(wo, 1);
|
||||||
start = System.currentTimeMillis();
|
jtfo3.typeText("Examiner 1"); // Set the case examiner
|
||||||
wo.btFinish().clickMouse();
|
start = System.currentTimeMillis();
|
||||||
|
wo.btFinish().clickMouse();
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStartAddImageFileDataSource() {
|
public void testStartAddImageFileDataSource() {
|
||||||
/*
|
try {
|
||||||
* This time out is to give time for creating case database and opening solr index
|
/*
|
||||||
*/
|
* This time out is to give time for creating case database and
|
||||||
new Timeout("pausing", 120000).sleep();
|
* opening solr index
|
||||||
logger.info("Starting Add Image process");
|
*/
|
||||||
resetTimeouts("WindowWaiter.WaitWindowTimeOut", 240000);
|
new Timeout("pausing", 120000).sleep();
|
||||||
WizardOperator wo = new WizardOperator("Add Data Source");
|
logger.info("Starting Add Image process");
|
||||||
while(!wo.btNext().isEnabled()){
|
setTimeout("WindowWaiter.WaitWindowTimeOut", 240000);
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled
|
WizardOperator wo = new WizardOperator("Add Data Source");
|
||||||
|
while (!wo.btNext().isEnabled()) {
|
||||||
|
new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled
|
||||||
|
}
|
||||||
|
//select the toggle button for Disk Image or VM File it will be the first button created and proceed to next panel
|
||||||
|
JToggleButtonOperator jtbo = new JToggleButtonOperator(wo, 0);
|
||||||
|
jtbo.clickMouse();
|
||||||
|
wo.btNext().clickMouse();
|
||||||
|
JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 0);
|
||||||
|
String img_path = getEscapedPath(System.getProperty("img_path"));
|
||||||
|
String imageDir = img_path;
|
||||||
|
((JTextComponent) jtfo0.getSource()).setText(imageDir);
|
||||||
|
JComboBoxOperator comboBoxOperator = new JComboBoxOperator(wo, 0);
|
||||||
|
comboBoxOperator.setSelectedItem("(GMT-5:00) America/New_York");
|
||||||
|
wo.btNext().clickMouse();
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
}
|
}
|
||||||
//select the toggle button for Disk Image or VM File it will be the first button created and proceed to next panel
|
|
||||||
JToggleButtonOperator jtbo = new JToggleButtonOperator(wo, 0);
|
|
||||||
jtbo.clickMouse();
|
|
||||||
wo.btNext().clickMouse();
|
|
||||||
JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 0);
|
|
||||||
String img_path = getEscapedPath(System.getProperty("img_path"));
|
|
||||||
String imageDir = img_path;
|
|
||||||
((JTextComponent) jtfo0.getSource()).setText(imageDir);
|
|
||||||
JComboBoxOperator comboBoxOperator = new JComboBoxOperator(wo, 0);
|
|
||||||
comboBoxOperator.setSelectedItem("(GMT-5:00) America/New_York");
|
|
||||||
wo.btNext().clickMouse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStartAddLogicalFilesDataSource() {
|
public void testStartAddLogicalFilesDataSource() {
|
||||||
/*
|
try {
|
||||||
* This time out is to give time for creating case database and opening solr index
|
/*
|
||||||
*/
|
* This time out is to give time for creating case database and
|
||||||
new Timeout("pausing", 120000).sleep();
|
* opening solr index
|
||||||
logger.info("Starting Add Logical Files process");
|
*/
|
||||||
WizardOperator wo = new WizardOperator("Add Data Source");
|
new Timeout("pausing", 120000).sleep();
|
||||||
wo.setTimeouts(resetTimeouts("WindowWaiter.WaitWindowTimeOut", 240000));
|
logger.info("Starting Add Logical Files process");
|
||||||
while(!wo.btNext().isEnabled()){
|
WizardOperator wo = new WizardOperator("Add Data Source");
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled
|
wo.setTimeouts(setTimeout("WindowWaiter.WaitWindowTimeOut", 240000));
|
||||||
|
while (!wo.btNext().isEnabled()) {
|
||||||
|
new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled
|
||||||
|
}
|
||||||
|
//select the toggle button for Logical Files it will be the third button created and proceed to next panel
|
||||||
|
JToggleButtonOperator jtbo = new JToggleButtonOperator(wo, 2);
|
||||||
|
jtbo.clickMouse();
|
||||||
|
wo.btNext().clickMouse();
|
||||||
|
JButtonOperator addButtonOperator = new JButtonOperator(wo, "Add");
|
||||||
|
addButtonOperator.pushNoBlock();
|
||||||
|
JFileChooserOperator fileChooserOperator = new JFileChooserOperator();
|
||||||
|
fileChooserOperator.setCurrentDirectory(new File(getEscapedPath(System.getProperty("img_path"))));
|
||||||
|
// set the current directory one level above the directory containing logicalFileSet folder.
|
||||||
|
fileChooserOperator.goUpLevel();
|
||||||
|
fileChooserOperator.chooseFile(new File(getEscapedPath(System.getProperty("img_path"))).getName());
|
||||||
|
wo.btNext().clickMouse();
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
}
|
}
|
||||||
//select the toggle button for Logical Files it will be the third button created and proceed to next panel
|
|
||||||
JToggleButtonOperator jtbo = new JToggleButtonOperator(wo, 2);
|
|
||||||
jtbo.clickMouse();
|
|
||||||
wo.btNext().clickMouse();
|
|
||||||
JButtonOperator addButtonOperator = new JButtonOperator(wo, "Add");
|
|
||||||
addButtonOperator.pushNoBlock();
|
|
||||||
JFileChooserOperator fileChooserOperator = new JFileChooserOperator();
|
|
||||||
fileChooserOperator.setCurrentDirectory(new File(getEscapedPath(System.getProperty("img_path"))));
|
|
||||||
// set the current directory one level above the directory containing logicalFileSet folder.
|
|
||||||
fileChooserOperator.goUpLevel();
|
|
||||||
fileChooserOperator.chooseFile(new File(getEscapedPath(System.getProperty("img_path"))).getName());
|
|
||||||
wo.btNext().clickMouse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAddSourceWizard1() {
|
public void testAddSourceWizard1() {
|
||||||
WizardOperator wo = new WizardOperator("Add Data Source");
|
try {
|
||||||
while (!wo.btFinish().isEnabled()) {
|
WizardOperator wo = new WizardOperator("Add Data Source");
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
|
while (!wo.btFinish().isEnabled()) {
|
||||||
|
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
|
||||||
|
}
|
||||||
|
logger.log(Level.INFO, "Add image took {0}ms", (System.currentTimeMillis() - start));
|
||||||
|
wo.btFinish().clickMouse();
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
}
|
}
|
||||||
logger.log(Level.INFO, "Add image took {0}ms", (System.currentTimeMillis() - start));
|
|
||||||
wo.btFinish().clickMouse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConfigureIngest1() {
|
public void testConfigureIngest1() {
|
||||||
/*
|
try {
|
||||||
* This timeout is to allow the setup for the ingest job settings panel
|
/*
|
||||||
* to complete.
|
* This timeout is to allow the setup for the ingest job settings
|
||||||
*/
|
* panel to complete.
|
||||||
new Timeout("pausing", 10000).sleep();
|
*/
|
||||||
|
new Timeout("pausing", 10000).sleep();
|
||||||
|
|
||||||
logger.info("Looking for hash lookup module in ingest job settings panel");
|
logger.info("Looking for hash lookup module in ingest job settings panel");
|
||||||
WizardOperator wo = new WizardOperator("Add Data Source");
|
WizardOperator wo = new WizardOperator("Add Data Source");
|
||||||
while(!wo.btNext().isEnabled()){
|
while (!wo.btNext().isEnabled()) {
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled
|
new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled
|
||||||
|
}
|
||||||
|
JTableOperator jto = new JTableOperator(wo, 0);
|
||||||
|
int row = jto.findCellRow("Hash Lookup", 2, 0);
|
||||||
|
jto.clickOnCell(row, 1);
|
||||||
|
logger.info("Selected hash lookup module in ingest job settings panel");
|
||||||
|
JButtonOperator jbo1 = new JButtonOperator(wo, "Global Settings");
|
||||||
|
jbo1.pushNoBlock();
|
||||||
|
logger.info("Pushed Global Settings button for hash lookup module in ingest job settings panel");
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
}
|
}
|
||||||
JTableOperator jto = new JTableOperator(wo, 0);
|
|
||||||
int row = jto.findCellRow("Hash Lookup", 2, 0);
|
|
||||||
jto.clickOnCell(row, 1);
|
|
||||||
logger.info("Selected hash lookup module in ingest job settings panel");
|
|
||||||
JButtonOperator jbo1 = new JButtonOperator(wo, "Global Settings");
|
|
||||||
jbo1.pushNoBlock();
|
|
||||||
logger.info("Pushed Global Settings button for hash lookup module in ingest job settings panel");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConfigureHash() {
|
public void testConfigureHash() {
|
||||||
logger.info("Hash Configure");
|
try {
|
||||||
JDialog hashMainDialog = JDialogOperator.waitJDialog("Global Hash Lookup Settings", false, false);
|
logger.info("Hash Configure");
|
||||||
JDialogOperator hashMainDialogOperator = new JDialogOperator(hashMainDialog);
|
JDialog hashMainDialog = JDialogOperator.waitJDialog("Global Hash Lookup Settings", false, false);
|
||||||
List<String> databases = new ArrayList<>();
|
JDialogOperator hashMainDialogOperator = new JDialogOperator(hashMainDialog);
|
||||||
databases.add(getEscapedPath(System.getProperty("nsrl_path")));
|
List<String> databases = new ArrayList<>();
|
||||||
databases.add(getEscapedPath(System.getProperty("known_bad_path")));
|
databases.add(getEscapedPath(System.getProperty("nsrl_path")));
|
||||||
databases.stream().map((database) -> {
|
databases.add(getEscapedPath(System.getProperty("known_bad_path")));
|
||||||
JButtonOperator importButtonOperator = new JButtonOperator(hashMainDialogOperator, "Import");
|
databases.stream().map((database) -> {
|
||||||
importButtonOperator.pushNoBlock();
|
JButtonOperator importButtonOperator = new JButtonOperator(hashMainDialogOperator, "Import");
|
||||||
JDialog addDatabaseDialog = JDialogOperator.waitJDialog("Import Hash Set", false, false);
|
importButtonOperator.pushNoBlock();
|
||||||
JDialogOperator addDatabaseDialogOperator = new JDialogOperator(addDatabaseDialog);
|
JDialog addDatabaseDialog = JDialogOperator.waitJDialog("Import Hash Set", false, false);
|
||||||
JButtonOperator browseButtonOperator = new JButtonOperator(addDatabaseDialogOperator, "Open...", 0);
|
JDialogOperator addDatabaseDialogOperator = new JDialogOperator(addDatabaseDialog);
|
||||||
browseButtonOperator.pushNoBlock();
|
JButtonOperator browseButtonOperator = new JButtonOperator(addDatabaseDialogOperator, "Open...", 0);
|
||||||
JFileChooserOperator fileChooserOperator = new JFileChooserOperator();
|
browseButtonOperator.pushNoBlock();
|
||||||
fileChooserOperator.chooseFile(database);
|
JFileChooserOperator fileChooserOperator = new JFileChooserOperator();
|
||||||
JButtonOperator okButtonOperator = new JButtonOperator(addDatabaseDialogOperator, "OK", 0);
|
fileChooserOperator.chooseFile(database);
|
||||||
return okButtonOperator;
|
JButtonOperator okButtonOperator = new JButtonOperator(addDatabaseDialogOperator, "OK", 0);
|
||||||
}).map((okButtonOperator) -> {
|
return okButtonOperator;
|
||||||
okButtonOperator.pushNoBlock();
|
}).map((okButtonOperator) -> {
|
||||||
return okButtonOperator;
|
okButtonOperator.pushNoBlock();
|
||||||
}).forEach((_item) -> {
|
return okButtonOperator;
|
||||||
|
}).forEach((_item) -> {
|
||||||
|
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
|
||||||
|
});
|
||||||
|
// Used if the database has no index
|
||||||
|
//JDialog jd3 = JDialogOperator.waitJDialog("No Index Exists", false, false);
|
||||||
|
//JDialogOperator jdo3 = new JDialogOperator(jd3);
|
||||||
|
//JButtonOperator jbo3 = new JButtonOperator(jdo3, "Yes", 0);
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
|
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
|
||||||
});
|
//jbo3.pushNoBlock();
|
||||||
// Used if the database has no index
|
JButtonOperator jbo4 = new JButtonOperator(hashMainDialogOperator, "OK", 0);
|
||||||
//JDialog jd3 = JDialogOperator.waitJDialog("No Index Exists", false, false);
|
jbo4.pushNoBlock();
|
||||||
//JDialogOperator jdo3 = new JDialogOperator(jd3);
|
} catch (TimeoutExpiredException ex) {
|
||||||
//JButtonOperator jbo3 = new JButtonOperator(jdo3, "Yes", 0);
|
screenshot("TimeoutScreenshot");
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
//jbo3.pushNoBlock();
|
}
|
||||||
JButtonOperator jbo4 = new JButtonOperator(hashMainDialogOperator, "OK", 0);
|
|
||||||
jbo4.pushNoBlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConfigureIngest2() {
|
public void testConfigureIngest2() {
|
||||||
logger.info("Looking for keyword search module in ingest job settings panel");
|
try {
|
||||||
WizardOperator wo = new WizardOperator("Add Data Source");
|
logger.info("Looking for keyword search module in ingest job settings panel");
|
||||||
while(!wo.btNext().isEnabled()){
|
WizardOperator wo = new WizardOperator("Add Data Source");
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled
|
while (!wo.btNext().isEnabled()) {
|
||||||
|
new Timeout("pausing", 1000).sleep(); // give it a second till the Add Data Source dialog enabled
|
||||||
|
}
|
||||||
|
JTableOperator jto = new JTableOperator(wo, 0);
|
||||||
|
int row = jto.findCellRow("Keyword Search", 2, 0);
|
||||||
|
jto.clickOnCell(row, 1);
|
||||||
|
logger.info("Selected keyword search module in ingest job settings panel");
|
||||||
|
JButtonOperator jbo1 = new JButtonOperator(wo, "Global Settings");
|
||||||
|
jbo1.pushNoBlock();
|
||||||
|
logger.info("Pushed Global Settings button for keyword search module in ingest job settings panel");
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
}
|
}
|
||||||
JTableOperator jto = new JTableOperator(wo, 0);
|
|
||||||
int row = jto.findCellRow("Keyword Search", 2, 0);
|
|
||||||
jto.clickOnCell(row, 1);
|
|
||||||
logger.info("Selected keyword search module in ingest job settings panel");
|
|
||||||
JButtonOperator jbo1 = new JButtonOperator(wo, "Global Settings");
|
|
||||||
jbo1.pushNoBlock();
|
|
||||||
logger.info("Pushed Global Settings button for keyword search module in ingest job settings panel");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConfigureSearch() {
|
public void testConfigureSearch() {
|
||||||
logger.info("Search Configure");
|
try {
|
||||||
JDialog jd = JDialogOperator.waitJDialog("Global Keyword Search Settings", false, false);
|
logger.info("Search Configure");
|
||||||
JDialogOperator jdo = new JDialogOperator(jd);
|
JDialog jd = JDialogOperator.waitJDialog("Global Keyword Search Settings", false, false);
|
||||||
String words = getEscapedPath(System.getProperty("keyword_path"));
|
JDialogOperator jdo = new JDialogOperator(jd);
|
||||||
JButtonOperator jbo0 = new JButtonOperator(jdo, "Import List", 0);
|
String words = getEscapedPath(System.getProperty("keyword_path"));
|
||||||
jbo0.pushNoBlock();
|
JButtonOperator jbo0 = new JButtonOperator(jdo, "Import List", 0);
|
||||||
JFileChooserOperator jfco0 = new JFileChooserOperator();
|
jbo0.pushNoBlock();
|
||||||
jfco0.chooseFile(words);
|
JFileChooserOperator jfco0 = new JFileChooserOperator();
|
||||||
JTableOperator jto = new JTableOperator(jdo, 0);
|
jfco0.chooseFile(words);
|
||||||
jto.clickOnCell(0, 0);
|
JTableOperator jto = new JTableOperator(jdo, 0);
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second to process
|
jto.clickOnCell(0, 0);
|
||||||
if (Boolean.parseBoolean(System.getProperty("mugen_mode"))) {
|
|
||||||
JTabbedPaneOperator jtpo = new JTabbedPaneOperator(jdo);
|
|
||||||
jtpo.selectPage("String Extraction");
|
|
||||||
JCheckBoxOperator jcbo0 = new JCheckBoxOperator(jtpo, "Arabic (Arabic)");
|
|
||||||
jcbo0.doClick();
|
|
||||||
JCheckBoxOperator jcbo1 = new JCheckBoxOperator(jtpo, "Han (Chinese, Japanese, Korean)");
|
|
||||||
jcbo1.doClick();
|
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second to process
|
new Timeout("pausing", 1000).sleep(); // give it a second to process
|
||||||
|
if (Boolean.parseBoolean(System.getProperty("mugen_mode"))) {
|
||||||
|
JTabbedPaneOperator jtpo = new JTabbedPaneOperator(jdo);
|
||||||
|
jtpo.selectPage("String Extraction");
|
||||||
|
JCheckBoxOperator jcbo0 = new JCheckBoxOperator(jtpo, "Arabic (Arabic)");
|
||||||
|
jcbo0.doClick();
|
||||||
|
JCheckBoxOperator jcbo1 = new JCheckBoxOperator(jtpo, "Han (Chinese, Japanese, Korean)");
|
||||||
|
jcbo1.doClick();
|
||||||
|
new Timeout("pausing", 1000).sleep(); // give it a second to process
|
||||||
|
}
|
||||||
|
JButtonOperator jbo2 = new JButtonOperator(jdo, "OK", 0);
|
||||||
|
jbo2.pushNoBlock();
|
||||||
|
WizardOperator wo = new WizardOperator("Add Data Source");
|
||||||
|
new Timeout("pausing", 10000).sleep(); // let things catch up
|
||||||
|
wo.btNext().clickMouse();
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
}
|
}
|
||||||
JButtonOperator jbo2 = new JButtonOperator(jdo, "OK", 0);
|
|
||||||
jbo2.pushNoBlock();
|
|
||||||
WizardOperator wo = new WizardOperator("Add Data Source");
|
|
||||||
new Timeout("pausing", 10000).sleep(); // let things catch up
|
|
||||||
wo.btNext().clickMouse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIngest() {
|
public void testIngest() {
|
||||||
logger.info("Ingest 3");
|
try {
|
||||||
new Timeout("pausing", 10000).sleep(); // wait for ingest to actually start
|
logger.info("Ingest 3");
|
||||||
long startIngest = System.currentTimeMillis();
|
new Timeout("pausing", 10000).sleep(); // wait for ingest to actually start
|
||||||
IngestManager man = IngestManager.getInstance();
|
long startIngest = System.currentTimeMillis();
|
||||||
while (man.isIngestRunning()) {
|
IngestManager man = IngestManager.getInstance();
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
|
while (man.isIngestRunning()) {
|
||||||
|
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
|
||||||
|
}
|
||||||
|
logger.log(Level.INFO, "Ingest (including enqueue) took {0}ms", (System.currentTimeMillis() - startIngest));
|
||||||
|
// allow keyword search to finish saving artifacts, just in case
|
||||||
|
// but randomize the timing so that we don't always get the same error
|
||||||
|
// consistently, making it seem like default behavior
|
||||||
|
Random rand = new Random();
|
||||||
|
new Timeout("pausing", 10000 + (rand.nextInt(15000) + 5000)).sleep();
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
}
|
}
|
||||||
logger.log(Level.INFO, "Ingest (including enqueue) took {0}ms", (System.currentTimeMillis() - startIngest));
|
|
||||||
// allow keyword search to finish saving artifacts, just in case
|
|
||||||
// but randomize the timing so that we don't always get the same error
|
|
||||||
// consistently, making it seem like default behavior
|
|
||||||
Random rand = new Random();
|
|
||||||
new Timeout("pausing", 10000 + (rand.nextInt(15000) + 5000)).sleep();
|
|
||||||
screenshot("Finished Ingest");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExpandDataSourcesTree() {
|
public void testExpandDataSourcesTree() {
|
||||||
logger.info("Data Sources Node");
|
try {
|
||||||
MainWindowOperator mwo = MainWindowOperator.getDefault();
|
logger.info("Data Sources Node");
|
||||||
JTreeOperator jto = new JTreeOperator(mwo, "Data Sources");
|
MainWindowOperator mwo = MainWindowOperator.getDefault();
|
||||||
String [] nodeNames = {"Data Sources"};
|
JTreeOperator jto = new JTreeOperator(mwo, "Data Sources");
|
||||||
TreePath tp = jto.findPath(nodeNames);
|
String[] nodeNames = {"Data Sources"};
|
||||||
expandNodes(jto, tp);
|
TreePath tp = jto.findPath(nodeNames);
|
||||||
screenshot("Data Sources Tree");
|
expandNodes(jto, tp);
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGenerateReportToolbar() {
|
public void testGenerateReportToolbar() {
|
||||||
logger.info("Generate Report Toolbars");
|
try {
|
||||||
MainWindowOperator mwo = MainWindowOperator.getDefault();
|
logger.info("Generate Report Toolbars");
|
||||||
JButtonOperator jbo = new JButtonOperator(mwo, "Generate Report");
|
MainWindowOperator mwo = MainWindowOperator.getDefault();
|
||||||
jbo.pushNoBlock();
|
JButtonOperator jbo = new JButtonOperator(mwo, "Generate Report");
|
||||||
new Timeout("pausing", 5000).sleep();
|
jbo.pushNoBlock();
|
||||||
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGenerateReportButton() throws IOException {
|
public void testGenerateReportButton() throws IOException {
|
||||||
logger.info("Generate Report Button");
|
try {
|
||||||
resetTimeouts("ComponentOperator.WaitComponentTimeout", 240000);
|
logger.info("Generate Report Button");
|
||||||
JDialog reportDialog = JDialogOperator.waitJDialog("Generate Report", false, false);
|
setTimeout("ComponentOperator.WaitComponentTimeout", 240000);
|
||||||
JDialogOperator reportDialogOperator = new JDialogOperator(reportDialog);
|
JDialog reportDialog = JDialogOperator.waitJDialog("Generate Report", false, false);
|
||||||
JListOperator listOperator = new JListOperator(reportDialogOperator);
|
JDialogOperator reportDialogOperator = new JDialogOperator(reportDialog);
|
||||||
JButtonOperator jbo0 = new JButtonOperator(reportDialogOperator, "Next");
|
JListOperator listOperator = new JListOperator(reportDialogOperator);
|
||||||
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss");
|
JButtonOperator jbo0 = new JButtonOperator(reportDialogOperator, "Next");
|
||||||
Date date = new Date();
|
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss");
|
||||||
String datenotime = dateFormat.format(date);
|
Date date = new Date();
|
||||||
listOperator.clickOnItem(0, 1);
|
String datenotime = dateFormat.format(date);
|
||||||
jbo0.pushNoBlock();
|
listOperator.clickOnItem(0, 1);
|
||||||
new Timeout("pausing", 2000).sleep();
|
jbo0.pushNoBlock();
|
||||||
JButtonOperator jbo1 = new JButtonOperator(reportDialogOperator, "Finish");
|
new Timeout("pausing", 2000).sleep();
|
||||||
jbo1.pushNoBlock();
|
JButtonOperator jbo1 = new JButtonOperator(reportDialogOperator, "Finish");
|
||||||
JDialog previewDialog = JDialogOperator.waitJDialog("Progress", false, false);
|
jbo1.pushNoBlock();
|
||||||
screenshot("Progress");
|
JDialog previewDialog = JDialogOperator.waitJDialog("Progress", false, false);
|
||||||
JDialogOperator previewDialogOperator = new JDialogOperator(previewDialog);
|
JDialogOperator previewDialogOperator = new JDialogOperator(previewDialog);
|
||||||
JLabelOperator.waitJLabel(previewDialog, "Complete", false, false);
|
JLabelOperator.waitJLabel(previewDialog, "Complete", false, false);
|
||||||
JButtonOperator jbo2 = new JButtonOperator(previewDialogOperator, "Close");
|
JButtonOperator jbo2 = new JButtonOperator(previewDialogOperator, "Close");
|
||||||
jbo2.pushNoBlock();
|
jbo2.pushNoBlock();
|
||||||
new Timeout("pausing", 10000).sleep();
|
new Timeout("pausing", 10000).sleep();
|
||||||
System.setProperty("ReportStr", datenotime);
|
System.setProperty("ReportStr", datenotime);
|
||||||
screenshot("Done Testing");
|
} catch (TimeoutExpiredException ex) {
|
||||||
|
screenshot("TimeoutScreenshot");
|
||||||
|
logger.log(Level.SEVERE, "AutopsyTestCases.testNewCaseWizard encountered timed out", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void screenshot(String name) {
|
public void screenshot(String name) {
|
||||||
logger.info("Taking screenshot.");
|
String outPath = getEscapedPath(System.getProperty("out_path"));
|
||||||
try {
|
File screenShotFile = new File(outPath + "\\" + name + ".png");
|
||||||
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
|
if (!screenShotFile.exists()) {
|
||||||
BufferedImage capture = new Robot().createScreenCapture(screenRect);
|
logger.info("Taking screenshot.");
|
||||||
String outPath = getEscapedPath(System.getProperty("out_path"));
|
try {
|
||||||
ImageIO.write(capture, "png", new File(outPath + "\\" + name + ".png"));
|
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
|
||||||
new Timeout("pausing", 1000).sleep(); // give it a second to save
|
BufferedImage capture = new Robot().createScreenCapture(screenRect);
|
||||||
} catch (IOException ex) {
|
ImageIO.write(capture, "png", screenShotFile);
|
||||||
logger.log(Level.WARNING, "IOException taking screenshot.", ex);
|
new Timeout("pausing", 1000).sleep(); // give it a second to save
|
||||||
} catch (AWTException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.WARNING, "AWTException taking screenshot.", ex);
|
logger.log(Level.WARNING, "IOException taking screenshot.", ex);
|
||||||
|
} catch (AWTException ex) {
|
||||||
|
logger.log(Level.WARNING, "AWTException taking screenshot.", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Nightly test failed at WindowWaiter.WaitWindowTimeOut because of TimeoutExpiredException. So we
|
|
||||||
* use this conveninent method to override the default Jemmy Timeouts value.
|
|
||||||
*/
|
|
||||||
|
|
||||||
private Timeouts resetTimeouts(String name, int value) {
|
/*
|
||||||
|
* Nightly test failed at WindowWaiter.WaitWindowTimeOut because of
|
||||||
|
* TimeoutExpiredException. So we use this conveninent method to override
|
||||||
|
* the default Jemmy Timeouts value.
|
||||||
|
*/
|
||||||
|
private Timeouts setTimeout(String name, int value) {
|
||||||
Timeouts timeouts = JemmyProperties.getCurrentTimeouts();
|
Timeouts timeouts = JemmyProperties.getCurrentTimeouts();
|
||||||
timeouts.setTimeout(name, value);
|
timeouts.setTimeout(name, value);
|
||||||
return timeouts;
|
return timeouts;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMultiUserPerferences() {
|
private void setMultiUserPerferences() {
|
||||||
UserPreferences.setIsMultiUserModeEnabled(true);
|
UserPreferences.setIsMultiUserModeEnabled(true);
|
||||||
//PostgreSQL database settings
|
//PostgreSQL database settings
|
||||||
@ -393,8 +458,8 @@ public class AutopsyTestCases {
|
|||||||
logger.log(Level.SEVERE, "Error saving messaging service connection info", ex); //NON-NLS
|
logger.log(Level.SEVERE, "Error saving messaging service connection info", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expandNodes (JTreeOperator jto, TreePath tp) {
|
private void expandNodes(JTreeOperator jto, TreePath tp) {
|
||||||
try {
|
try {
|
||||||
jto.expandPath(tp);
|
jto.expandPath(tp);
|
||||||
for (TreePath t : jto.getChildPaths(tp)) {
|
for (TreePath t : jto.getChildPaths(tp)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user