throw exception for errors in uitest actions
so we abort early when a uitest goes wrong, instead of letting tests become fragile because it looks like its passing, but the code is just accidentally working Remove code in python uitests that was not actually doing anything (and now crashes because we throw an exception for actions that don't mean anything) Change-Id: I9c52f9fdc06f1c01e9b93b58a5200f9c3684db1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112471 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
32a0b40928
commit
f1cc5d2229
11 changed files with 25 additions and 71 deletions
|
@ -41,14 +41,6 @@ class formatCell(UITestCase):
|
|||
props3 = {"TEXT": "English (USA)"}
|
||||
actionProps3 = mkPropertyValues(props3)
|
||||
xlanguagelb.executeAction("SELECT", actionProps3)
|
||||
#set Number
|
||||
props = {"TEXT": "Number"}
|
||||
actionProps = mkPropertyValues(props)
|
||||
xliststore1.executeAction("SELECT", actionProps)
|
||||
#set Standard
|
||||
props2 = {"TEXT": "Standard"}
|
||||
actionProps2 = mkPropertyValues(props2)
|
||||
xliststore2.executeAction("SELECT", actionProps2)
|
||||
#other properties
|
||||
xdecimalsed.executeAction("UP", tuple())
|
||||
xleadzerosed.executeAction("UP", tuple())
|
||||
|
|
|
@ -40,10 +40,6 @@ class Subtotals(UITestCase):
|
|||
# x6Entry = xTreeList.getChild("5")
|
||||
# xFirstEntry.executeAction("CLICK", tuple())
|
||||
#use the Max function
|
||||
xfunctions = xDialog.getChild("functions")
|
||||
propsF = {"TEXT": "Max"}
|
||||
actionPropsF = mkPropertyValues(propsF)
|
||||
xfunctions.executeAction("SELECT", actionPropsF)
|
||||
|
||||
#= 2nd group =5. Group by "Person Number", select "shipping time" and use the Min function.
|
||||
select_pos(xTabs, "1")
|
||||
|
@ -57,10 +53,6 @@ class Subtotals(UITestCase):
|
|||
# x6Entry = xTreeList.getChild("5")
|
||||
# xFirstEntry.executeAction("CLICK", tuple())
|
||||
#use the Min function
|
||||
xfunctions = xDialog.getChild("functions")
|
||||
propsF2 = {"TEXT": "Min"}
|
||||
actionPropsF2 = mkPropertyValues(propsF2)
|
||||
xfunctions.executeAction("SELECT", actionPropsF2)
|
||||
|
||||
#= 3rd group = Group by "Person Number", select "shipping time" and use the Average function.
|
||||
select_pos(xTabs, "2")
|
||||
|
@ -74,10 +66,6 @@ class Subtotals(UITestCase):
|
|||
# x6Entry = xTreeList.getChild("5")
|
||||
# xFirstEntry.executeAction("CLICK", tuple())
|
||||
#use the Average function
|
||||
xfunctions = xDialog.getChild("functions")
|
||||
propsF3 = {"TEXT": "Average"}
|
||||
actionPropsF3 = mkPropertyValues(propsF3)
|
||||
xfunctions.executeAction("SELECT", actionPropsF3)
|
||||
|
||||
# 5. Click OK
|
||||
xOKBtn = xDialog.getChild("ok")
|
||||
|
|
|
@ -59,7 +59,6 @@ class tdf126248(UITestCase):
|
|||
|
||||
self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
|
||||
xCellsDlg = self.xUITest.getTopFocusWindow()
|
||||
select_pos(xCellsDlg, "2")
|
||||
|
||||
# Get current font names from the Format Cell dialog
|
||||
westFontName = get_state_as_dict(xCellsDlg.getChild("westfontnamelb-cjk"))['Text']
|
||||
|
|
|
@ -41,7 +41,6 @@ class customSlideShow(UITestCase):
|
|||
edit = CustomSlideShows.getChild("edit")
|
||||
customshowlist = CustomSlideShows.getChild("customshowlist")
|
||||
self.assertEqual(get_state_as_dict(customshowlist)["SelectionCount"], "1")
|
||||
select_pos(customshowlist, "1")
|
||||
ok = CustomSlideShows.getChild("ok")
|
||||
|
||||
def handle_edit_dlg(DefineCustomSlideShow):
|
||||
|
|
|
@ -79,7 +79,6 @@ class findReplace(UITestCase):
|
|||
select_pos(xTabs, "0")
|
||||
xSizeFont = dialog.getChild("westsizelb-cjk")
|
||||
xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
|
||||
xSizeFont.executeAction("BACKSPACE", tuple())
|
||||
xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"16"})) #set font size 16
|
||||
xOkBtn = dialog.getChild("ok")
|
||||
self.ui_test.close_dialog_through_button(xOkBtn)
|
||||
|
|
|
@ -25,7 +25,6 @@ class DeleteAllComments(UITestCase):
|
|||
selection = self.xUITest.executeCommand(".uno:SelectAll")
|
||||
self.xUITest.executeCommand(".uno:InsertAnnotation")
|
||||
cursor = document.getCurrentController().getViewCursor()
|
||||
xWriterDoc.executeAction("LEFT", tuple())
|
||||
type_text(xWriterEdit, "EEEEE")
|
||||
self.xUITest.executeCommand(".uno:InsertAnnotation")
|
||||
self.xUITest.executeCommand(".uno:DeleteAllNotes")
|
||||
|
|
|
@ -516,7 +516,6 @@ class formatParagraph(UITestCase):
|
|||
xBottom = xDialog.getChild("bottommf")
|
||||
xMerge = xDialog.getChild("mergewithnext")
|
||||
|
||||
select_pos(xStyle, "1")
|
||||
xwidth.executeAction("UP", tuple())
|
||||
xSync.executeAction("CLICK", tuple())
|
||||
xLeft.executeAction("UP", tuple())
|
||||
|
|
|
@ -19,9 +19,6 @@ class ListBoxTest(UITestCase):
|
|||
self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
|
||||
xCellsDlg = self.xUITest.getTopFocusWindow()
|
||||
|
||||
categoryLB = xCellsDlg.getChild("categorylb")
|
||||
select_pos(categoryLB, "4")
|
||||
|
||||
xOkBtn = xCellsDlg.getChild("ok")
|
||||
self.ui_test.close_dialog_through_button(xOkBtn)
|
||||
|
||||
|
@ -34,12 +31,6 @@ class ListBoxTest(UITestCase):
|
|||
self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
|
||||
xCellsDlg = self.xUITest.getTopFocusWindow()
|
||||
|
||||
categoryLB = xCellsDlg.getChild("categorylb")
|
||||
props = {"TEXT": "Time"}
|
||||
|
||||
actionProps = mkPropertyValues(props)
|
||||
categoryLB.executeAction("SELECT", actionProps)
|
||||
|
||||
xOkBtn = xCellsDlg.getChild("ok")
|
||||
self.ui_test.close_dialog_through_button(xOkBtn)
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ class SpinFieldTest(UITestCase):
|
|||
self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
|
||||
xCellsDlg = self.xUITest.getTopFocusWindow()
|
||||
|
||||
# select the numbers tab page
|
||||
select_pos(xCellsDlg, "0")
|
||||
|
||||
xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
|
||||
xDecimalPlaces.executeAction("UP", tuple())
|
||||
|
||||
|
@ -40,9 +37,6 @@ class SpinFieldTest(UITestCase):
|
|||
self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
|
||||
xCellsDlg = self.xUITest.getTopFocusWindow()
|
||||
|
||||
# select the numbers tab page
|
||||
select_pos(xCellsDlg, "0")
|
||||
|
||||
xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
|
||||
xDecimalPlaces.executeAction("UP", tuple())
|
||||
xDecimalPlaces.executeAction("UP", tuple())
|
||||
|
|
|
@ -19,8 +19,6 @@ class TabDialogTest(UITestCase):
|
|||
self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
|
||||
xCellsDlg = self.xUITest.getTopFocusWindow()
|
||||
|
||||
select_pos(xCellsDlg, "1")
|
||||
|
||||
xOkBtn = xCellsDlg.getChild("ok")
|
||||
self.ui_test.close_dialog_through_button(xOkBtn)
|
||||
|
||||
|
@ -33,10 +31,6 @@ class TabDialogTest(UITestCase):
|
|||
self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
|
||||
xCellsDlg = self.xUITest.getTopFocusWindow()
|
||||
|
||||
props = {"NAME": "Borders"}
|
||||
propsUNO = mkPropertyValues(props)
|
||||
xCellsDlg.executeAction("SELECT", propsUNO)
|
||||
|
||||
xOkBtn = xCellsDlg.getChild("ok")
|
||||
self.ui_test.close_dialog_through_button(xOkBtn)
|
||||
|
||||
|
|
|
@ -337,7 +337,6 @@ StringMap WindowUIObject::get_state()
|
|||
void WindowUIObject::execute(const OUString& rAction,
|
||||
const StringMap& rParameters)
|
||||
{
|
||||
bool bHandled = true;
|
||||
if (rAction == "SET")
|
||||
{
|
||||
for (auto const& parameter : rParameters)
|
||||
|
@ -369,8 +368,12 @@ void WindowUIObject::execute(const OUString& rAction,
|
|||
}
|
||||
else
|
||||
{
|
||||
SAL_WARN("vcl.uitest", "missing parameter TEXT to action TYPE");
|
||||
return;
|
||||
OStringBuffer buf;
|
||||
for (auto const & rPair : rParameters)
|
||||
buf.append(",").append(rPair.first.toUtf8()).append("=").append(rPair.second.toUtf8());
|
||||
SAL_WARN("vcl.uitest", "missing parameter TEXT to action TYPE "
|
||||
<< buf.makeStringAndClear());
|
||||
throw std::logic_error("missing parameter TEXT to action TYPE");
|
||||
}
|
||||
}
|
||||
else if (rAction == "FOCUS")
|
||||
|
@ -379,12 +382,12 @@ void WindowUIObject::execute(const OUString& rAction,
|
|||
}
|
||||
else
|
||||
{
|
||||
bHandled = false;
|
||||
}
|
||||
|
||||
if (!bHandled)
|
||||
{
|
||||
SAL_WARN("vcl.uitest", "unknown action or parameter for " << get_name() << ". Action: " << rAction);
|
||||
OStringBuffer buf;
|
||||
for (auto const & rPair : rParameters)
|
||||
buf.append(",").append(rPair.first.toUtf8()).append("=").append(rPair.second.toUtf8());
|
||||
SAL_WARN("vcl.uitest", "unknown action for " << get_name()
|
||||
<< ". Action: " << rAction << buf.makeStringAndClear());
|
||||
throw std::logic_error("unknown action");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -726,15 +729,9 @@ void EditUIObject::execute(const OUString& rAction,
|
|||
bool bHandled = true;
|
||||
if (rAction == "TYPE")
|
||||
{
|
||||
if (rParameters.find("TEXT") != rParameters.end())
|
||||
auto it = rParameters.find("TEXT");
|
||||
if (it != rParameters.end())
|
||||
{
|
||||
auto it = rParameters.find("TEXT");
|
||||
if (it == rParameters.end())
|
||||
{
|
||||
SAL_WARN("vcl.uitest", "missing parameter TEXT to action SET");
|
||||
return;
|
||||
}
|
||||
|
||||
const OUString& rText = it->second;
|
||||
auto aKeyEvents = generate_key_events_from_text(rText);
|
||||
for (auto const& keyEvent : aKeyEvents)
|
||||
|
@ -904,13 +901,15 @@ CheckBoxUIObject::~CheckBoxUIObject()
|
|||
}
|
||||
|
||||
void CheckBoxUIObject::execute(const OUString& rAction,
|
||||
const StringMap& /*rParameters*/)
|
||||
const StringMap& rParameters)
|
||||
{
|
||||
if (rAction == "CLICK")
|
||||
{
|
||||
// don't use toggle directly, it does not set the value
|
||||
mxCheckBox->ImplCheck();
|
||||
}
|
||||
else
|
||||
WindowUIObject::execute(rAction, rParameters);
|
||||
}
|
||||
|
||||
StringMap CheckBoxUIObject::get_state()
|
||||
|
@ -959,12 +958,14 @@ RadioButtonUIObject::~RadioButtonUIObject()
|
|||
}
|
||||
|
||||
void RadioButtonUIObject::execute(const OUString& rAction,
|
||||
const StringMap& /*rParameters*/)
|
||||
const StringMap& rParameters)
|
||||
{
|
||||
if (rAction == "CLICK")
|
||||
{
|
||||
mxRadioButton->ImplCallClick();
|
||||
}
|
||||
else
|
||||
WindowUIObject::execute(rAction, rParameters);
|
||||
}
|
||||
|
||||
StringMap RadioButtonUIObject::get_state()
|
||||
|
@ -1013,12 +1014,9 @@ TabPageUIObject::~TabPageUIObject()
|
|||
}
|
||||
|
||||
void TabPageUIObject::execute(const OUString& rAction,
|
||||
const StringMap& /*rParameters*/)
|
||||
const StringMap& rParameters)
|
||||
{
|
||||
if (rAction == "SELECT")
|
||||
{
|
||||
/* code */
|
||||
}
|
||||
WindowUIObject::execute(rAction, rParameters);
|
||||
}
|
||||
|
||||
StringMap TabPageUIObject::get_state()
|
||||
|
@ -1218,7 +1216,7 @@ SpinUIObject::~SpinUIObject()
|
|||
}
|
||||
|
||||
void SpinUIObject::execute(const OUString& rAction,
|
||||
const StringMap& /*rParameters*/)
|
||||
const StringMap& rParameters)
|
||||
{
|
||||
if (rAction == "UP")
|
||||
{
|
||||
|
@ -1228,6 +1226,8 @@ void SpinUIObject::execute(const OUString& rAction,
|
|||
{
|
||||
mxSpinButton->Down();
|
||||
}
|
||||
else
|
||||
WindowUIObject::execute(rAction, rParameters);
|
||||
}
|
||||
|
||||
StringMap SpinUIObject::get_state()
|
||||
|
|
Loading…
Reference in a new issue