Kaydet (Commit) 4374dd7f authored tarafından Liu Zhe's avatar Liu Zhe

#120732 - [VCLAuto patch] Fixed problems: Screenshot is not valid. Some scripts…

#120732 - [VCLAuto patch] Fixed problems: Screenshot is not valid. Some scripts are not stable. Add load/new documents interface.

Patch by: Li Lin Yi <lilinyi921734@gmail.com>
Review by: Liu Zhe <aliuzhe@gmail.com>
üst b407e333
......@@ -37,6 +37,8 @@ import java.util.StringTokenizer;
public class Tester {
static Robot robot;
static double factor = Double.parseDouble(System.getProperty("sleep.factor", "1.0"));
static {
try {
robot = new Robot();
......@@ -55,9 +57,9 @@ public class Tester {
*
* @param delay
*/
public static void sleep(double delay) {
public static void sleep(double seconds) {
try {
Thread.sleep((long) (delay * 1000));
Thread.sleep((long) (seconds * factor * 1000));
} catch (InterruptedException e) {
}
}
......
......@@ -51,7 +51,8 @@ public class VclApp {
}
public VclApp(OpenOffice openOffice) {
this("localhost", openOffice.getAutomationPort());
// this("localhost", openOffice.getAutomationPort());
this("127.0.0.1", openOffice.getAutomationPort()); // In case "localhost" is modified incorrectly
this.openOffice = openOffice;
}
......@@ -87,7 +88,7 @@ public class VclApp {
openOffice.kill();
openOffice.cleanUserInstallation();
openOffice.start();
SystemUtil.sleep(5);
SystemUtil.sleep(10);
} else {
openOffice.start();
}
......@@ -96,6 +97,20 @@ public class VclApp {
communicationManager.start();
}
public void loadDocument(String file) {
dispatch(".uno:Open");
VclComboBox FilePicker_Path = new VclComboBox("SVT_HID_FILEDLG_AUTOCOMPLETEBOX");
FilePicker_Path.setText(file);
VclButton FilePicker_Open = new VclButton("fpicker:PushButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_OPEN");
FilePicker_Open.click();
VclWindow writer = new VclWindow("SW_HID_EDIT_WIN");
writer.waitForExistence(10, 2);
}
public void newDocument(String type) {
dispatch(type);
}
public OpenOffice getOpenOffice() {
return this.openOffice;
}
......
......@@ -53,12 +53,12 @@ public class BVTFileType {
@Before
public void setUp() throws Exception {
app.start();
app.start(true);
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......@@ -100,7 +100,7 @@ public class BVTFileType {
String saveTo = getPath("temp/" + file);
// Create a new text document
app.dispatch("private:factory/swriter");
sleep(3);
writer.waitForExistence(10, 2);
// Input some text by keyboard
writer.focus();
......@@ -238,7 +238,7 @@ public class BVTFileType {
String text = "Hello Openoffice";
app.dispatch("private:factory/simpress?slot=6686");
PresentationWizard.ok();
sleep(1);
impress.waitForExistence(10, 2);
impress.click(0.01, 0.01);
typeKeys(text);
sleep(2);
......@@ -256,7 +256,6 @@ public class BVTFileType {
app.dispatch(".uno:Open");
submitOpenDlg(saveTo);
impress.waitForExistence(10, 2);
sleep(2);
impress.click(3, 3);
typeKeys("<tab><enter>");
app.dispatch(".uno:SelectAll");
......@@ -316,7 +315,7 @@ public class BVTFileType {
// Create a new drawing document
app.dispatch("private:factory/sdraw");
sleep(3);
draw.waitForExistence(10, 2);
// Insert a picture fully filled with green
app.dispatch(".uno:InsertGraphic");
......@@ -393,7 +392,7 @@ public class BVTFileType {
// Create a new math
app.dispatch("private:factory/smath");
sleep(3);
math_EditWindow.waitForExistence(10, 2);
// Verify if the Elements window is active
assertTrue(math_ElementsWindow.exists(3));
......
......@@ -53,12 +53,12 @@ public class BVTFunction {
@Before
public void setUp() throws Exception {
app.start();
app.start(true);
}
@After
public void tearDown() throws Exception {
app.close();
}
@Test
......@@ -89,7 +89,7 @@ public class BVTFunction {
public void testPrintDialog() {
// Create a new text document
app.dispatch("private:factory/swriter");
sleep(3);
writer.waitForExistence(10, 2);
app.dispatch(".uno:Print");
assertTrue(File_PrintDlg.exists(5));
File_PrintDlg.cancel();
......@@ -158,7 +158,7 @@ public class BVTFunction {
// Create a new text document
app.dispatch("private:factory/swriter");
sleep(3);
writer.waitForExistence(10, 2);
// Insert a picture fully filled with green
writer.click(400, 400);
......@@ -193,7 +193,7 @@ public class BVTFunction {
// Create a new text document
app.dispatch("private:factory/scalc");
sleep(3);
calc.waitForExistence(10, 2);
// Insert a picture fully filled with green
app.dispatch(".uno:InsertGraphic");
......@@ -229,7 +229,7 @@ public class BVTFunction {
// Create a new text document
app.dispatch("private:factory/simpress?slot=6686");
PresentationWizard.ok();
sleep(3);
impress.waitForExistence(10, 2);
// Insert a picture fully filled with green
app.dispatch(".uno:InsertGraphic");
......@@ -339,7 +339,7 @@ public class BVTFunction {
};
// Create a new text document
app.dispatch("private:factory/scalc");
sleep(3);
calc.waitForExistence(10, 2);
CalcUtil.selectRange("C5");
typeKeys("1<enter>");
......@@ -474,7 +474,7 @@ public class BVTFunction {
// Create a new drawing document
app.dispatch("private:factory/sdraw");
sleep(3);
draw.waitForExistence(10, 2);
// Insert a chart
app.dispatch(".uno:InsertObjectChart");
......@@ -498,7 +498,7 @@ public class BVTFunction {
// Create a new text document
app.dispatch("private:factory/swriter");
sleep(3);
writer.waitForExistence(10, 2);
// Insert a chart
app.dispatch(".uno:InsertObjectChart");
......@@ -522,7 +522,7 @@ public class BVTFunction {
// Create a new spreadsheet document
app.dispatch("private:factory/scalc");
sleep(3);
calc.waitForExistence(10, 2);
// Insert a chart
app.dispatch(".uno:InsertObjectChart");
......@@ -548,7 +548,7 @@ public class BVTFunction {
// Create a new presentation document
app.dispatch("private:factory/simpress?slot=6686");
PresentationWizard.ok();
sleep(3);
impress.waitForExistence(10, 2);
// Insert a chart
app.dispatch(".uno:InsertObjectChart");
......@@ -572,7 +572,7 @@ public class BVTFunction {
// Create a new drawing document
app.dispatch("private:factory/sdraw");
sleep(3);
draw.waitForExistence(10, 2);
// Insert a table
app.dispatch(".uno:InsertTable");
......@@ -580,6 +580,7 @@ public class BVTFunction {
sleep(3);
// Verify if the table toolbar is active
typeKeys("123"); // Insert text to focus on table, to avoid Bug 120171 on linux
assertTrue(Table_Toolbar.exists(3));
// Focus on edit pane
......@@ -598,7 +599,7 @@ public class BVTFunction {
// Create a new text document
app.dispatch("private:factory/swriter");
sleep(3);
writer.waitForExistence(10, 2);
// Insert a table
app.dispatch(".uno:InsertTable");
......@@ -629,7 +630,7 @@ public class BVTFunction {
// Create a new presentation document
app.dispatch("private:factory/simpress?slot=6686");
PresentationWizard.ok();
sleep(3);
impress.waitForExistence(10, 2);
// Insert a table
app.dispatch(".uno:InsertTable");
......@@ -637,6 +638,7 @@ public class BVTFunction {
sleep(3);
// Verify if the table toolbar is active
typeKeys("123"); // Insert text to focus on table, to avoid Bug 120171 on linux
assertTrue(Table_Toolbar.exists(3));
// // Check the statusbar to verify if the table is inserted
......@@ -659,7 +661,7 @@ public class BVTFunction {
// Create a new spreadsheet document
app.dispatch("private:factory/scalc");
sleep(3);
calc.waitForExistence(10, 2);
// Insert source numbers
String sourceNumber1 = "5";
......@@ -692,7 +694,7 @@ public class BVTFunction {
// Create a new spreadsheet document
app.dispatch("private:factory/scalc");
sleep(3);
calc.waitForExistence(10, 2);
// Insert source numbers and expected result
String sourceData = "0";
......@@ -722,7 +724,7 @@ public class BVTFunction {
// Create a new spreadsheet document
app.dispatch("private:factory/scalc");
sleep(3);
calc.waitForExistence(10, 2);
// Insert source number
String sourceNumber = "-5";
......
......@@ -55,7 +55,7 @@ public class SmokeTest {
@After
public void tearDown() throws Exception {
app.close();
}
@Test
......
......@@ -50,25 +50,19 @@ public class AddDeleteSymbolsFromCatalog {
// New a formula document
app.dispatch("private:factory/smath");
sleep(3); // If no sleep, can not find math_SymbolsDlg in mac
math_EditWindow.waitForExistence(10, 2);
// Click catalog button
math_CatalogButton.click();
// Verify if the "Symbols" dialog pop up
assertTrue("Symbols dialog does not pop up", math_SymbolsDlg.exists(3));
// Select "Special", click "Edit" button
math_SymbolsDlgListbox.select(2);
math_SymbolsDlgEditButton.click();
// Verify if the "Edit Symbols" dialog pop up
assertTrue("Edit Symbols dialog does not pop up", math_EditSymbolsDlg.exists(3));
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -50,18 +50,15 @@ public class InputCharacterFromCatalogDlg {
// New a formula document
app.dispatch("private:factory/smath");
sleep(3); // If no sleep, can not find math_SymbolsDlg in mac
math_EditWindow.waitForExistence(10, 2);
// Click catalog button
math_CatalogButton.click();
// Verify if the "Symbols" dialog pop up
assertTrue("Symbols dialog does not pop up", math_SymbolsDlg.exists(3));
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -56,7 +56,7 @@ public class CreateFormulaInDifferentWays {
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -50,12 +50,13 @@ public class ChartDialogSetting {
// Create a new spreadsheet document
app.dispatch("private:factory/scalc");
calc.waitForExistence(10, 2);
app.dispatch(".uno:InsertObjectChart");
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -54,12 +54,12 @@ public class DataPivotTable {
@Before
public void setUp() throws Exception {
app.start();
app.start(true);
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -57,7 +57,7 @@ public class Fitler {
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -50,7 +50,7 @@ public class InsertSheet {
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -55,11 +55,12 @@ public class SortDialogSetting {
// Create a new spreadsheet document
app.dispatch("private:factory/scalc");
calc.waitForExistence(10, 2);
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -53,14 +53,14 @@ public class SubtotalsFunctions {
String file = prepareData("sc/SubtotalsSampleFile.ods");
app.dispatch(".uno:Open");
submitOpenDlg(file);
sleep(2);
calc.waitForExistence(10, 2);
CalcUtil.selectRange("A1:E7");
app.dispatch(".uno:DataSubTotals");
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -57,7 +57,7 @@ public class ValidityDateSupport1024Columns {
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -50,7 +50,7 @@ public class ValidityDialogDefaultValue {
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -56,13 +56,14 @@ public class ValidityDialogSetting {
// New a spreadsheet, select cell range, open Validity dialog
app.dispatch("private:factory/scalc");
calc.waitForExistence(10, 2);
CalcUtil.selectRange("A1:C5");
app.dispatch(".uno:Validation");
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -48,7 +48,7 @@ public class ValiditySampleFile {
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
......@@ -46,12 +46,12 @@ public class HeaderAndFooterSetting{
@Before
public void setUp() throws Exception {
// app.start(true); // Bug 120476
app.start();
app.start(true); // Bug 120476
// New a impress, insert some slides
app.dispatch("private:factory/simpress?slot=6686");
PresentationWizard.ok();
impress.waitForExistence(10, 2);
for(int i=0; i<5;i++){
SD_InsertPageButtonOnToolbar.click();
......@@ -64,14 +64,14 @@ public class HeaderAndFooterSetting{
@After
public void tearDown() throws Exception {
app.close();
}
/**
* Test Copy slide with Apply Footer to same file and different file
* @throws Exception
*/
@Test//?
@Test
public void testCopySlideWithApplyFooter() throws Exception{
//add header and footer
......@@ -257,7 +257,7 @@ public class HeaderAndFooterSetting{
* Test footer not show on the first slide.
* @throws Exception
*/
@Test//??
@Test
public void testFooterNotShowOn1stSlide() throws Exception{
//add header and footer
......@@ -269,8 +269,12 @@ public class HeaderAndFooterSetting{
// Check slide 1
ImpressSlideSorter.focus();
typeKeys("<up><up><up><up><up>");
sleep(1); // If no sleep, error occur
// typeKeys("<up><up><up><up><up>"); // Not stable on ubuntu10.04
// sleep(1); // If no sleep, error occur
for (int i=0; i<5; i++) {
typeKeys("<up>");
sleep(1);
}
app.dispatch(".uno:HeaderAndFooter");
assertEquals(true,SD_FooterNotShowOn1stSlide.isChecked());
......
......@@ -45,13 +45,12 @@ public class OpenDocumentWithHeaderFooter {
@Before
public void setUp() throws Exception {
// app.start(true); // Bug 120476
app.start();
app.start(true); // Bug 120476
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......@@ -65,7 +64,7 @@ public class OpenDocumentWithHeaderFooter {
String file = prepareData("sd/AOO3.4HeaderFooter.odp");
app.dispatch(".uno:Open");
submitOpenDlg(file);
sleep(2); // If no sleep, error occur on mac
impress.waitForExistence(10, 2);
//check after reopen
app.dispatch(".uno:HeaderAndFooter");
......@@ -106,6 +105,7 @@ public class OpenDocumentWithHeaderFooter {
String file = prepareData("sd/gfdd.ppt");
app.dispatch(".uno:Open");
submitOpenDlg(file);
impress.waitForExistence(10, 2);
//check after reopen
app.dispatch(".uno:HeaderAndFooter");
......
......@@ -52,7 +52,7 @@ public class Table {
@After
public void tearDown() throws Exception {
app.close();
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment