From 79b27379c1cf109faeb80bc51fdd1c44df4fbfee Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 30 Sep 2019 17:03:41 +0100 Subject: [PATCH] uitest: share some code. Change-Id: I2f586bd5e2e4c3cf1fc052cdfe526532dca9acd4 Reviewed-on: https://gerrit.libreoffice.org/79884 Tested-by: Jenkins Reviewed-by: Michael Meeks --- uitest/calc_tests/create_chart.py | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/uitest/calc_tests/create_chart.py b/uitest/calc_tests/create_chart.py index 5b97199bdf59..cced0ac63d37 100644 --- a/uitest/calc_tests/create_chart.py +++ b/uitest/calc_tests/create_chart.py @@ -15,6 +15,11 @@ import unittest class CalcChartUIDemo(UITestCase): + def create_insert_chart_dialog(self): + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + # time.sleep(1) # ideally wait for a creation event + return self.xUITest.getTopFocusWindow() + def fill_spreadsheet(self): xCalcDoc = self.xUITest.getTopFocusWindow() xGridWindow = xCalcDoc.getChild("grid_window") @@ -34,9 +39,7 @@ class CalcChartUIDemo(UITestCase): self.fill_spreadsheet() - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - - xChartDlg = self.xUITest.getTopFocusWindow() + xChartDlg = self.create_insert_chart_dialog(); xCancelBtn = xChartDlg.getChild("cancel") self.ui_test.close_dialog_through_button(xCancelBtn) @@ -49,9 +52,7 @@ class CalcChartUIDemo(UITestCase): self.fill_spreadsheet() - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - - xChartDlg = self.xUITest.getTopFocusWindow() + xChartDlg = self.create_insert_chart_dialog(); xOkBtn = xChartDlg.getChild("finish") self.ui_test.close_dialog_through_button(xOkBtn) @@ -64,9 +65,7 @@ class CalcChartUIDemo(UITestCase): self.fill_spreadsheet() - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - - xChartDlg = self.xUITest.getTopFocusWindow() + xChartDlg = self.create_insert_chart_dialog(); xNextBtn = xChartDlg.getChild("next") xNextBtn.executeAction("CLICK", tuple()) @@ -90,9 +89,7 @@ class CalcChartUIDemo(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() xGridWindow = xCalcDoc.getChild("grid_window") - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - - xChartDlg = self.xUITest.getTopFocusWindow() + xChartDlg = self.create_insert_chart_dialog(); xNextBtn = xChartDlg.getChild("finish") self.ui_test.close_dialog_through_button(xNextBtn) @@ -112,9 +109,7 @@ class CalcChartUIDemo(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() xGridWindow = xCalcDoc.getChild("grid_window") - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - - xChartDlg = self.xUITest.getTopFocusWindow() + xChartDlg = self.create_insert_chart_dialog(); xNextBtn = xChartDlg.getChild("finish") self.ui_test.close_dialog_through_button(xNextBtn) @@ -137,9 +132,7 @@ class CalcChartUIDemo(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() xGridWindow = xCalcDoc.getChild("grid_window") - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - - xChartDlg = self.xUITest.getTopFocusWindow() + xChartDlg = self.create_insert_chart_dialog(); xNextBtn = xChartDlg.getChild("finish") self.ui_test.close_dialog_through_button(xNextBtn)