From c61822155af0dea1607fc3a404a75c7a390a9a40 Mon Sep 17 00:00:00 2001 From: Eeva Date: Thu, 7 Feb 2019 14:08:48 +0200 Subject: [PATCH 1/8] Add new keywords: double_click_listview_row and double_click_listview_row_by_index --- UIAutomationTest/TestWindow.xaml | 10 ++++++++++ UIAutomationTest/TestWindow.xaml.cs | 6 ++++++ atests/feature_tests/listview.robot | 13 +++++++++++-- src/WhiteLibrary/keywords/items/listview.py | 18 ++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/UIAutomationTest/TestWindow.xaml b/UIAutomationTest/TestWindow.xaml index ecdb76e..2aa1ccb 100644 --- a/UIAutomationTest/TestWindow.xaml +++ b/UIAutomationTest/TestWindow.xaml @@ -154,6 +154,11 @@ ItemsSource="{Binding Mode=Default, XPath=/MockObjects/MockObject}" AutoGenerateColumns="False" IsReadOnly="True"> + + + @@ -173,6 +178,11 @@ ItemsSource="{Binding Mode=Default, XPath=/MockObjects/MockObject}" AutoGenerateColumns="False" IsReadOnly="True"> + + + diff --git a/UIAutomationTest/TestWindow.xaml.cs b/UIAutomationTest/TestWindow.xaml.cs index 3646ce5..5d0cb91 100644 --- a/UIAutomationTest/TestWindow.xaml.cs +++ b/UIAutomationTest/TestWindow.xaml.cs @@ -140,6 +140,12 @@ private void toolStripButtonEvent(object sender, RoutedEventArgs e, string messa } + private void datagridRowDoubleClick(object sender, RoutedEventArgs e) + { + DataGridRow row = sender as DataGridRow; + MessageBox.Show("Double clicked row " + row.GetIndex().ToString()); + } + private void popupItemClick(object sender, RoutedEventArgs e) { MessageBox.Show("Delete not allowed"); diff --git a/atests/feature_tests/listview.robot b/atests/feature_tests/listview.robot index 3750ec3..7318a4d 100644 --- a/atests/feature_tests/listview.robot +++ b/atests/feature_tests/listview.robot @@ -72,7 +72,7 @@ Get Text From ListView ${actual} Get Listview Cell Text By Index list_view2 2 2 Should Be Equal ${actual} Science -ListView Select +Select Listview Row Select ListView Row By Index list_view 1 Bible Should Be Selected Select ListView Row By Index list_view 2 @@ -80,8 +80,17 @@ ListView Select Select ListView Row list_view Title Robinson Crusoe Robinson Crusoe Should Be Selected -ListView Right Click +Right Click Listview Cell Repeat Keyword 2 Right Click Listview Cell list_view2 Title 1 Bible Should Be Right Clicked Repeat Keyword 2 Right Click Listview Cell list_view2 Author 0 Daniel Defoe Should Be Right Clicked + +Double Click Listview Row + Double Click ListView Row list_view2 Author Donald Knuth + Verify Label 65535 Double clicked row 2 + Click Button text=OK + + Double Click ListView Row By Index list_view2 1 + Verify Label 65535 Double clicked row 1 + [Teardown] Click Button text=OK diff --git a/src/WhiteLibrary/keywords/items/listview.py b/src/WhiteLibrary/keywords/items/listview.py index 6e4dbc3..f1633fd 100644 --- a/src/WhiteLibrary/keywords/items/listview.py +++ b/src/WhiteLibrary/keywords/items/listview.py @@ -4,6 +4,24 @@ class ListViewKeywords(LibraryComponent): + @keyword + def double_click_listview_row(self, locator, column_name, cell_text): + """Double clicks a listview row. + + See `Get Listview Row Text` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. + """ + row = self._get_row(locator, column_name, cell_text) + row.DoubleClick() + + @keyword + def double_click_listview_row_by_index(self, locator, row_index): + """Double clicks a listview row at index. + + See `Get Listview Row Text By Index` for details about arguments ``locator`` and ``row_index``. + """ + row = self._get_row_by_index(locator, row_index) + row.DoubleClick() + @keyword def get_listview_cell_text(self, locator, column_name, row_index): """Returns text of a listview cell. From 7444a0ebc6cea67db964c4bd738540efb504c4f5 Mon Sep 17 00:00:00 2001 From: Eeva Date: Mon, 11 Feb 2019 10:04:01 +0200 Subject: [PATCH 2/8] Add new datagrid to test application for listview row testing --- UIAutomationTest/TestWindow.xaml | 70 ++++++++++++++++++++--------- UIAutomationTest/TestWindow.xaml.cs | 28 ++++++++---- 2 files changed, 69 insertions(+), 29 deletions(-) diff --git a/UIAutomationTest/TestWindow.xaml b/UIAutomationTest/TestWindow.xaml index 2aa1ccb..2c4fc16 100644 --- a/UIAutomationTest/TestWindow.xaml +++ b/UIAutomationTest/TestWindow.xaml @@ -3,8 +3,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="UI Automation Test Window" Height="750" WindowStartupLocation="CenterScreen"> - - + + @@ -12,8 +12,8 @@ - - + + @@ -21,8 +21,17 @@ + + + + + + + + + - + - + - + @@ -140,10 +146,10 @@ - + + MouseMove="cursorPositionShow">move mouse @@ -157,6 +163,8 @@ @@ -177,20 +185,23 @@ + IsReadOnly="True" + SelectionUnit="Cell"> - - - - + + + - + @@ -198,7 +209,7 @@ - + @@ -224,6 +235,25 @@ > + + + + + + + + + + + diff --git a/UIAutomationTest/TestWindow.xaml.cs b/UIAutomationTest/TestWindow.xaml.cs index 5d0cb91..210aa88 100644 --- a/UIAutomationTest/TestWindow.xaml.cs +++ b/UIAutomationTest/TestWindow.xaml.cs @@ -91,8 +91,6 @@ private void menuAboutClick(object sender, RoutedEventArgs e) MessageBox.Show(text, title, button); } - - private void treeNodeSelect(object sender, RoutedEventArgs e) { treeNodeEvent(sender, e, "selected"); @@ -141,9 +139,24 @@ private void toolStripButtonEvent(object sender, RoutedEventArgs e, string messa } private void datagridRowDoubleClick(object sender, RoutedEventArgs e) + { + dataGridRowEvent(sender, "double clicked"); + } + + private void dataGridRowSelect(object sender, RoutedEventArgs e) + { + dataGridRowEvent(sender, "selected"); + } + + private void dataGridRowRightClick(object sender, RoutedEventArgs e) + { + dataGridRowEvent(sender, "right clicked"); + } + + private void dataGridRowEvent(object sender, string message) { DataGridRow row = sender as DataGridRow; - MessageBox.Show("Double clicked row " + row.GetIndex().ToString()); + selectionIndicatorLabel.Content = "Row " + row.GetIndex().ToString() + " " + message; } private void popupItemClick(object sender, RoutedEventArgs e) @@ -178,7 +191,7 @@ private void dataGridCellEvent(object sender, RoutedEventArgs e, string message) TextBlock cellText = node.Content as TextBlock; if (node != null) { - selectionIndicatorLabel.Content = cellText.Text + " " + message; + selectionIndicatorLabel.Content = cellText.Text + " " + message; } e.Handled = true; @@ -195,8 +208,7 @@ private async void alertSlow(object sender, RoutedEventArgs e) await TaskEx.Delay(5000); selectionIndicatorLabel.Content = "Slow alert occurred"; } - - + private void eventLabelRightDown(object sender, RoutedEventArgs e) { labelEvent(sender, e, "right button down"); @@ -225,8 +237,7 @@ private void labelEvent(object sender, RoutedEventArgs e, string message) { selectionIndicatorLabel.Content = message; } - - + private void eventTestButtonRightClick(object sender, RoutedEventArgs e) { testButtonEvent(sender, e, "right clicked"); @@ -249,6 +260,5 @@ private void cursorPositionShow(object sender, MouseEventArgs e) Point pnt = e.GetPosition(this); cursorPosition.Content = pnt.ToString(); } - } } From 72fe4deb5b4138bde247961c208be0a0da87e2ff Mon Sep 17 00:00:00 2001 From: Eeva Date: Mon, 11 Feb 2019 10:05:33 +0200 Subject: [PATCH 3/8] Add new keywords double_click_listview_cell and double_click_listview_cell_by_index --- src/WhiteLibrary/keywords/items/listview.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/WhiteLibrary/keywords/items/listview.py b/src/WhiteLibrary/keywords/items/listview.py index f1633fd..9f10347 100644 --- a/src/WhiteLibrary/keywords/items/listview.py +++ b/src/WhiteLibrary/keywords/items/listview.py @@ -4,6 +4,18 @@ class ListViewKeywords(LibraryComponent): + @keyword + def double_click_listview_cell(self, locator, column_name, row_index): + """Double clicks a listview cell.""" + cell = self._get_cell(locator, column_name, row_index) + cell.DoubleClick() + + @keyword + def double_click_listview_cell_by_index(self, locator, row_index, column_index): + """Double clicks a listview cell at index.""" + cell = self._get_cell_by_index(locator, row_index, column_index) + cell.DoubleClick() + @keyword def double_click_listview_row(self, locator, column_name, cell_text): """Double clicks a listview row. From 1511cea1dd473529ed7b5ebbc23af0ee3f99cc6d Mon Sep 17 00:00:00 2001 From: Eeva Date: Mon, 11 Feb 2019 10:06:05 +0200 Subject: [PATCH 4/8] Update robot suite for listview --- atests/feature_tests/listview.robot | 38 ++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/atests/feature_tests/listview.robot b/atests/feature_tests/listview.robot index 7318a4d..0aa6c89 100644 --- a/atests/feature_tests/listview.robot +++ b/atests/feature_tests/listview.robot @@ -73,12 +73,25 @@ Get Text From ListView Should Be Equal ${actual} Science Select Listview Row - Select ListView Row By Index list_view 1 - Bible Should Be Selected + Select ListView Row By Index birds 1 + Row 1 Should Be Selected Select ListView Row By Index list_view 2 - The Art of Computer Programming Should Be Selected + Row 2 Should Be Selected Select ListView Row list_view Title Robinson Crusoe - Robinson Crusoe Should Be Selected + Row 0 Should Be Selected + +Select Listview Cell + Select Listview Cell list_view2 Author 1 + Various Artists Should Be Selected + Select Listview Cell By Index list_view2 2 2 + Science Should Be Selected + +Right Click Listview Row + # click twice because first click selects the row + Repeat Keyword 2 Right Click Listview Row birds Bird Dodo + Row 2 Should Be Right Clicked + Repeat Keyword 2 Right Click Listview Row By Index birds 0 + Row 0 Should Be Right Clicked Right Click Listview Cell Repeat Keyword 2 Right Click Listview Cell list_view2 Title 1 @@ -87,10 +100,13 @@ Right Click Listview Cell Daniel Defoe Should Be Right Clicked Double Click Listview Row - Double Click ListView Row list_view2 Author Donald Knuth - Verify Label 65535 Double clicked row 2 - Click Button text=OK - - Double Click ListView Row By Index list_view2 1 - Verify Label 65535 Double clicked row 1 - [Teardown] Click Button text=OK + Double Click ListView Row birds Bird Dodo + Row 2 Should Be Double Clicked + Double Click ListView Row By Index birds 1 + Row 1 Should Be Double Clicked + +Double Click Listview Cell + Double Click Listview Cell list_view2 Author 2 + Donald Knuth Should Be Double Clicked + Double Click Listview Cell By Index list_view2 0 2 + Fiction Should Be Double Clicked From 13ba8fc23cffdb7f315f31a9bdffca1675889329 Mon Sep 17 00:00:00 2001 From: Eeva Date: Mon, 11 Feb 2019 11:16:59 +0200 Subject: [PATCH 5/8] Add new keywords: right_click_listview_cell_by_index, select_listview_cell and select_listview_cell_by_index --- src/WhiteLibrary/keywords/items/listview.py | 24 ++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/WhiteLibrary/keywords/items/listview.py b/src/WhiteLibrary/keywords/items/listview.py index 9f10347..9fb19b0 100644 --- a/src/WhiteLibrary/keywords/items/listview.py +++ b/src/WhiteLibrary/keywords/items/listview.py @@ -52,7 +52,7 @@ def get_listview_cell_text(self, locator, column_name, row_index): @keyword def get_listview_cell_text_by_index(self, locator, row_index, column_index): - """Returns text of a listview cell. + """Returns text of a listview cell at index. ``locator`` is the locator of the listview. @@ -242,6 +242,12 @@ def right_click_listview_cell(self, locator, column_name, row_index): cell = self._get_cell(locator, column_name, row_index) cell.RightClick() + @keyword + def right_click_listview_cell_by_index(self, locator, row_index, column_index): + """Right clicks a listview cell at index.""" + cell = self._get_cell_by_index(locator, row_index, column_index) + cell.RightClick() + @keyword def right_click_listview_row(self, locator, column_name, cell_text): """Right clicks a listview row that has given text in given column. @@ -253,13 +259,25 @@ def right_click_listview_row(self, locator, column_name, cell_text): @keyword def right_click_listview_row_by_index(self, locator, row_index): - """Right clicks a listview row by its index. + """Right clicks a listview row at index. See `Get Listview Row Text By Index` for details about arguments ``locator`` and ``row_index``. """ row = self._get_row_by_index(locator, row_index) row.RightClick() + @keyword + def select_listview_cell(self, locator, column_name, row_index): + """Selects a listview cell.""" + cell = self._get_cell(locator, column_name, row_index) + cell.Click() + + @keyword + def select_listview_cell_by_index(self, locator, row_index, column_index): + """Selects a listview cell at index.""" + cell = self._get_cell_by_index(locator, row_index, column_index) + cell.Click() + @keyword def select_listview_row(self, locator, column_name, cell_text): """Selects a listview row. @@ -271,7 +289,7 @@ def select_listview_row(self, locator, column_name, cell_text): @keyword def select_listview_row_by_index(self, locator, row_index): - """Selects a row from a listview. + """Selects a listview row at index. See `Get Listview Row Text By Index` for details about arguments ``locator`` and ``row_index``. """ From 670ee7e5124381aaac8e812018ebfe81df427a92 Mon Sep 17 00:00:00 2001 From: Eeva Date: Mon, 11 Feb 2019 11:19:16 +0200 Subject: [PATCH 6/8] Fix test for right clicking listview cell --- atests/feature_tests/listview.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atests/feature_tests/listview.robot b/atests/feature_tests/listview.robot index 0aa6c89..bcf5b55 100644 --- a/atests/feature_tests/listview.robot +++ b/atests/feature_tests/listview.robot @@ -96,7 +96,7 @@ Right Click Listview Row Right Click Listview Cell Repeat Keyword 2 Right Click Listview Cell list_view2 Title 1 Bible Should Be Right Clicked - Repeat Keyword 2 Right Click Listview Cell list_view2 Author 0 + Repeat Keyword 2 Right Click Listview Cell By Index list_view2 0 0 Daniel Defoe Should Be Right Clicked Double Click Listview Row From 27863e77d03480dd3acde69a7414bc731013c114 Mon Sep 17 00:00:00 2001 From: Eeva Date: Mon, 11 Feb 2019 11:51:17 +0200 Subject: [PATCH 7/8] Rename keywords and update documentation --- src/WhiteLibrary/keywords/items/listview.py | 133 +++++++++++--------- 1 file changed, 74 insertions(+), 59 deletions(-) diff --git a/src/WhiteLibrary/keywords/items/listview.py b/src/WhiteLibrary/keywords/items/listview.py index 9fb19b0..3c88418 100644 --- a/src/WhiteLibrary/keywords/items/listview.py +++ b/src/WhiteLibrary/keywords/items/listview.py @@ -6,13 +6,33 @@ class ListViewKeywords(LibraryComponent): @keyword def double_click_listview_cell(self, locator, column_name, row_index): - """Double clicks a listview cell.""" + """Double clicks a listview cell. + + ``locator`` is the locator of the listview. + + ``column_name`` is the name of the column. + + ``row_index`` is the zero-based row index. + + Example: + | Double Click Listview Cell | id:addressList | Street | 0 | # double click cell in the column "Street" of the first row | + """ cell = self._get_cell(locator, column_name, row_index) cell.DoubleClick() @keyword def double_click_listview_cell_by_index(self, locator, row_index, column_index): - """Double clicks a listview cell at index.""" + """Double clicks a listview cell at index. + + ``locator`` is the locator of the listview. + + ``row_index`` is the zero-based row index. + + ``column_index`` is the zero-based column index. + + Example: + | Double Click Listview Cell By Index | id:addressList | 0 | 0 | + """ cell = self._get_cell_by_index(locator, row_index, column_index) cell.DoubleClick() @@ -20,7 +40,13 @@ def double_click_listview_cell_by_index(self, locator, row_index, column_index): def double_click_listview_row(self, locator, column_name, cell_text): """Double clicks a listview row. - See `Get Listview Row Text` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. + ``locator`` is the locator of the listview. + + ``column_name`` and ``cell_text`` define the row. Row is the first matching row where text in column + ``column_name`` is ``cell_text``. + + Example: + | Double Click Listview Row | id:addressList | City | Helsinki | # double click row that has the text "Helsinki" in the column "City" | """ row = self._get_row(locator, column_name, cell_text) row.DoubleClick() @@ -29,7 +55,12 @@ def double_click_listview_row(self, locator, column_name, cell_text): def double_click_listview_row_by_index(self, locator, row_index): """Double clicks a listview row at index. - See `Get Listview Row Text By Index` for details about arguments ``locator`` and ``row_index``. + ``locator`` is the locator of the listview. + + ``row_index`` is the zero-based row index. + + Example: + | Double Click Listview Row By Index | id:addressList | 4 | """ row = self._get_row_by_index(locator, row_index) row.DoubleClick() @@ -38,14 +69,7 @@ def double_click_listview_row_by_index(self, locator, row_index): def get_listview_cell_text(self, locator, column_name, row_index): """Returns text of a listview cell. - ``locator`` is the locator of the listview. - - ``column_name`` is the name of the column. - - ``row_index`` is the zero-based row index. - - Example: - | ${cell_text} | Get Listview Cell Text | id:addressList | Street | 0 | # return text in the column "Street" of the first row | + See `Double Click Listview Cell` for details about arguments ``locator``, ``column_name``, and ``row_index``. """ cell = self._get_cell(locator, column_name, row_index) return cell.Text @@ -54,14 +78,7 @@ def get_listview_cell_text(self, locator, column_name, row_index): def get_listview_cell_text_by_index(self, locator, row_index, column_index): """Returns text of a listview cell at index. - ``locator`` is the locator of the listview. - - ``row_index`` is the zero-based row index. - - ``column_index`` is the zero-based column index. - - Example: - | ${cell_text} | Get Listview Cell Text By Index | id:addressList | 0 | 0 | + See `Double Click Listview Cell By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. """ cell = self._get_cell_by_index(locator, row_index, column_index) return cell.Text @@ -70,13 +87,7 @@ def get_listview_cell_text_by_index(self, locator, row_index, column_index): def get_listview_row_text(self, locator, column_name, cell_text): """Returns a list containing text of each cell in a listview row. - ``locator`` is the locator of the listview. - - ``column_name`` and ``cell_text`` define the row. Row is the first matching row where text in column - ``column_name`` is ``cell_text``. - - Example: - | @{row_text} | Get Listview Row Text | id:addressList | City | Helsinki | # return all text from row that has text "Helsinki" in the column "City" | + See `Double Click Listview Row` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. """ row = self._get_row(locator, column_name, cell_text) return [cell.Text for cell in row.Cells] @@ -85,21 +96,16 @@ def get_listview_row_text(self, locator, column_name, cell_text): def get_listview_row_text_by_index(self, locator, row_index): """Returns text of a listview row as a list. - ``locator`` is the locator of the listview. - - ``row_index`` is the zero-based row index. - - Example: - | @{row_text} | Get Listview Row Text By Index | id:addressList | 4 | + See `Double Click Listview Row By Index` for details about arguments ``locator`` and ``row_index``. """ row = self._get_row_by_index(locator, row_index) return [cell.Text for cell in row.Cells] @keyword - def listview_cell_in_index_should_contain(self, locator, row_index, column_index, expected): + def listview_cell_at_index_should_contain(self, locator, row_index, column_index, expected): """Verifies that the given listview cell contains text ``expected``. - See `Get Listview Cell Text By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. + See `Double Click Listview Cell By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. """ cell = self._get_cell_by_index(locator, row_index, column_index) if expected not in cell.Text: @@ -107,10 +113,10 @@ def listview_cell_in_index_should_contain(self, locator, row_index, column_index .format(row_index, column_index, expected)) @keyword - def listview_cell_in_index_should_not_contain(self, locator, row_index, column_index, expected): + def listview_cell_at_index_should_not_contain(self, locator, row_index, column_index, expected): """Verifies that the given listview cell does not contain text ``expected``. - See `Get Listview Cell Text By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. + See `Double Click Listview Cell By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. """ cell = self._get_cell_by_index(locator, row_index, column_index) if expected in cell.Text: @@ -121,7 +127,7 @@ def listview_cell_in_index_should_not_contain(self, locator, row_index, column_i def listview_cell_should_contain(self, locator, column_name, row_index, expected): """Verifies that the given listview cell contains text ``expected``. - See `Get Listview Cell Text` for details about arguments ``locator``, ``column_name``, and ``row_index``. + See `Double Click Listview Cell` for details about arguments ``locator``, ``column_name``, and ``row_index``. """ cell = self._get_cell(locator, column_name, row_index) if expected not in cell.Text: @@ -132,7 +138,7 @@ def listview_cell_should_contain(self, locator, column_name, row_index, expected def listview_cell_should_not_contain(self, locator, column_name, row_index, expected): """Verifies that the given listview cell does not contain text ``expected``. - See `Get Listview Cell Text` for details about arguments ``locator``, ``column_name``, and ``row_index``. + See `Double Click Listview Cell` for details about arguments ``locator``, ``column_name``, and ``row_index``. """ cell = self._get_cell(locator, column_name, row_index) if expected in cell.Text: @@ -140,10 +146,10 @@ def listview_cell_should_not_contain(self, locator, column_name, row_index, expe .format(expected)) @keyword - def listview_cell_text_in_index_should_be(self, locator, row_index, column_index, expected): + def listview_cell_text_at_index_should_be(self, locator, row_index, column_index, expected): """Verifies that listview cell text is ``expected``. - See `Get Listview Cell Text By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. + See `Double Click Listview Cell By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. """ cell = self._get_cell_by_index(locator, row_index, column_index) if cell.Text != expected: @@ -151,10 +157,10 @@ def listview_cell_text_in_index_should_be(self, locator, row_index, column_index .format(row_index, column_index, expected, cell.Text)) @keyword - def listview_cell_text_in_index_should_not_be(self, locator, row_index, column_index, expected): + def listview_cell_text_at_index_should_not_be(self, locator, row_index, column_index, expected): """Verifies that listview cell text is not ``expected``. - See `Get Listview Cell Text By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. + See `Double Click Listview Cell By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. """ cell = self._get_cell_by_index(locator, row_index, column_index) if cell.Text == expected: @@ -165,7 +171,7 @@ def listview_cell_text_in_index_should_not_be(self, locator, row_index, column_i def listview_cell_text_should_be(self, locator, column_name, row_index, expected): """Verifies that listview cell text is ``expected``. - See `Get Listview Cell Text` for details about arguments ``locator``, ``column_name``, and ``row_index``. + See `Double Click Listview Cell` for details about arguments ``locator``, ``column_name``, and ``row_index``. """ cell = self._get_cell(locator, column_name, row_index) if cell.Text != expected: @@ -175,7 +181,7 @@ def listview_cell_text_should_be(self, locator, column_name, row_index, expected def listview_cell_text_should_not_be(self, locator, column_name, row_index, expected): """Verifies that listview cell text is not ``expected``. - See `Get Listview Cell Text` for details about arguments ``locator``, ``column_name``, and ``row_index``. + See `Double Click Listview Cell` for details about arguments ``locator``, ``column_name``, and ``row_index``. """ cell = self._get_cell(locator, column_name, row_index) if cell.Text == expected: @@ -183,10 +189,10 @@ def listview_cell_text_should_not_be(self, locator, column_name, row_index, expe .format(expected)) @keyword - def listview_row_in_index_should_contain(self, locator, row_index, expected): + def listview_row_at_index_should_contain(self, locator, row_index, expected): """Verifies that any cell in the given listview row contains text ``expected``. - See `Get Listview Row Text By Index` for details about arguments ``locator`` and ``row_index``. + See `Double Click Listview Row By Index` for details about arguments ``locator`` and ``row_index``. """ row = self._get_row_by_index(locator, row_index) for cell in row.Cells: @@ -196,10 +202,10 @@ def listview_row_in_index_should_contain(self, locator, row_index, expected): .format(row_index, expected)) @keyword - def listview_row_in_index_should_not_contain(self, locator, row_index, expected): + def listview_row_at_index_should_not_contain(self, locator, row_index, expected): """Verifies that any cell in the given listview row does not contain text ``expected``. - See `Get Listview Row Text By Index` for details about arguments ``locator`` and ``row_index``. + See `Double Click Listview Row By Index` for details about arguments ``locator`` and ``row_index``. """ listview = self.state._get_typed_item_by_locator(ListView, locator) row = listview.Rows.Get(int(row_index)) @@ -212,7 +218,7 @@ def listview_row_in_index_should_not_contain(self, locator, row_index, expected) def listview_row_should_contain(self, locator, column_name, cell_text, expected): """Verifies that the given listview row contains text ``expected``. - See `Get Listview Row Text` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. + See `Double Click Listview Row` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. """ row = self._get_row(locator, column_name, cell_text) for cell in row.Cells: @@ -225,7 +231,7 @@ def listview_row_should_contain(self, locator, column_name, cell_text, expected) def listview_row_should_not_contain(self, locator, column_name, cell_text, expected): """Verifies that the given listview row does not contain text ``expected``. - See `Get Listview Row Text` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. + See `Double Click Listview Row` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. """ row = self._get_row(locator, column_name, cell_text) for cell in row.Cells: @@ -237,14 +243,17 @@ def listview_row_should_not_contain(self, locator, column_name, cell_text, expec def right_click_listview_cell(self, locator, column_name, row_index): """Right clicks a listview cell using its column name and row index. - See `Get Listview Cell Text` for details about arguments ``locator``, ``column_name``, and ``row_index``. + See `Double Click Listview Cell` for details about arguments ``locator``, ``column_name``, and ``row_index``. """ cell = self._get_cell(locator, column_name, row_index) cell.RightClick() @keyword def right_click_listview_cell_by_index(self, locator, row_index, column_index): - """Right clicks a listview cell at index.""" + """Right clicks a listview cell at index. + + See `Double Click Listview Cell By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. + """ cell = self._get_cell_by_index(locator, row_index, column_index) cell.RightClick() @@ -252,7 +261,7 @@ def right_click_listview_cell_by_index(self, locator, row_index, column_index): def right_click_listview_row(self, locator, column_name, cell_text): """Right clicks a listview row that has given text in given column. - See `Get Listview Row Text` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. + See `Double Click Listview Row` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. """ row = self._get_row(locator, column_name, cell_text) row.RightClick() @@ -261,20 +270,26 @@ def right_click_listview_row(self, locator, column_name, cell_text): def right_click_listview_row_by_index(self, locator, row_index): """Right clicks a listview row at index. - See `Get Listview Row Text By Index` for details about arguments ``locator`` and ``row_index``. + See `Double Click Listview Row By Index` for details about arguments ``locator`` and ``row_index``. """ row = self._get_row_by_index(locator, row_index) row.RightClick() @keyword def select_listview_cell(self, locator, column_name, row_index): - """Selects a listview cell.""" + """Selects a listview cell. + + See `Double Click Listview Cell` for details about arguments ``locator``, ``column_name``, and ``row_index``. + """ cell = self._get_cell(locator, column_name, row_index) cell.Click() @keyword def select_listview_cell_by_index(self, locator, row_index, column_index): - """Selects a listview cell at index.""" + """Selects a listview cell at index. + + See `Double Click Listview Cell By Index` for details about arguments ``locator``, ``row_index``, and ``column_index``. + """ cell = self._get_cell_by_index(locator, row_index, column_index) cell.Click() @@ -282,7 +297,7 @@ def select_listview_cell_by_index(self, locator, row_index, column_index): def select_listview_row(self, locator, column_name, cell_text): """Selects a listview row. - See `Get Listview Row Text` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. + See `Double Click Listview Row` for details about the arguments ``locator``, ``column_name``, and ``cell_text``. """ listview = self.state._get_typed_item_by_locator(ListView, locator) listview.Select(column_name, cell_text) @@ -291,7 +306,7 @@ def select_listview_row(self, locator, column_name, cell_text): def select_listview_row_by_index(self, locator, row_index): """Selects a listview row at index. - See `Get Listview Row Text By Index` for details about arguments ``locator`` and ``row_index``. + See `Double Click Listview Row By Index` for details about arguments ``locator`` and ``row_index``. """ listview = self.state._get_typed_item_by_locator(ListView, locator) listview.Select(int(row_index)) From da7b377dfc365f7f8c1d03b31d45c0b12227d1bb Mon Sep 17 00:00:00 2001 From: Eeva Date: Mon, 11 Feb 2019 12:24:10 +0200 Subject: [PATCH 8/8] Fix name changes in listview tests and clean up keyword documentation --- atests/feature_tests/listview.robot | 24 +++++++++++----------- src/WhiteLibrary/keywords/configuration.py | 11 +++++----- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/atests/feature_tests/listview.robot b/atests/feature_tests/listview.robot index bcf5b55..a9d0bb0 100644 --- a/atests/feature_tests/listview.robot +++ b/atests/feature_tests/listview.robot @@ -8,19 +8,19 @@ Suite Teardown Select Tab Page tabControl Tab1 Row Verification Listview Row Should Contain list_view2 Title Bible ligious Listview Row Should Not Contain list_view2 Title Robinson Crusoe Scienc - Listview Row In Index Should Contain list_view2 2 Programming - Listview Row In Index Should Not Contain list_view2 1 Donald + Listview Row At Index Should Contain list_view2 2 Programming + Listview Row At Index Should Not Contain list_view2 1 Donald Cell Verification Listview Cell Text Should Be list_view2 Title 2 The Art of Computer Programming Listview Cell Text Should Not Be list_view2 Title 2 Robinson Crusoe - Listview Cell Text In Index Should Be list_view2 2 1 The Art of Computer Programming - Listview Cell Text In Index Should Not Be list_view2 2 1 Robinson Crusoe + Listview Cell Text At Index Should Be list_view2 2 1 The Art of Computer Programming + Listview Cell Text At Index Should Not Be list_view2 2 1 Robinson Crusoe Listview Cell Should Contain list_view2 Title 2 omputer P Listview Cell Should Not Contain list_view2 Title 2 obinson - Listview Cell In Index Should Contain list_view2 2 1 omputer - Listview Cell In Index Should Not Contain list_view2 2 1 obinson + Listview Cell At Index Should Contain list_view2 2 1 omputer + Listview Cell At Index Should Not Contain list_view2 2 1 obinson Unsuccessful Row Verification Run Keyword And Expect Error Row defined by cell 'Title'='Bible' did not contain text 'abcd' @@ -28,9 +28,9 @@ Unsuccessful Row Verification Run Keyword And Expect Error Row defined by cell 'Title'='Robinson Crusoe' should not have contained text 'Fiction' ... Listview Row Should Not Contain list_view2 Title Robinson Crusoe Fiction Run Keyword And Expect Error Row 2 did not contain text 'abcd' - ... Listview Row In Index Should Contain list_view2 2 abcd + ... Listview Row At Index Should Contain list_view2 2 abcd Run Keyword And Expect Error Row 1 should not have contained text 'igious' - ... Listview Row In Index Should Not Contain list_view2 1 igious + ... Listview Row At Index Should Not Contain list_view2 1 igious Unsuccessful Cell Verification Run Keyword And Expect Error Cell text should have been 'Hello', found 'The Art of Computer Programming' @@ -40,10 +40,10 @@ Unsuccessful Cell Verification ... Listview Cell Text Should Not Be list_view2 Title 2 The Art of Computer Programming Run Keyword And Expect Error Cell (2, 1) text should have been 'Hello', found 'The Art of Computer Programming' - ... Listview Cell Text In Index Should Be list_view2 2 1 Hello + ... Listview Cell Text At Index Should Be list_view2 2 1 Hello Run Keyword And Expect Error Cell (2, 1) text should not have been 'The Art of Computer Programming' - ... Listview Cell Text In Index Should Not Be list_view2 2 1 The Art of Computer Programming + ... Listview Cell Text At Index Should Not Be list_view2 2 1 The Art of Computer Programming Run Keyword And Expect Error Cell did not contain text 'obinson' ... Listview Cell Should Contain list_view2 Title 2 obinson @@ -52,10 +52,10 @@ Unsuccessful Cell Verification ... Listview Cell Should Not Contain list_view2 Title 2 omputer Run Keyword And Expect Error Cell (2, 1) did not contain text 'obinson' - ... Listview Cell In Index Should Contain list_view2 2 1 obinson + ... Listview Cell At Index Should Contain list_view2 2 1 obinson Run Keyword And Expect Error Cell (2, 1) should not have contained text 'omputer' - ... Listview Cell In Index Should Not Contain list_view2 2 1 omputer + ... Listview Cell At Index Should Not Contain list_view2 2 1 omputer Get Text From ListView ${expected} Create List Donald Knuth The Art of Computer Programming Science diff --git a/src/WhiteLibrary/keywords/configuration.py b/src/WhiteLibrary/keywords/configuration.py index 791a621..246ca10 100644 --- a/src/WhiteLibrary/keywords/configuration.py +++ b/src/WhiteLibrary/keywords/configuration.py @@ -64,19 +64,18 @@ def get_white_double_click_interval(self): def set_white_drag_step_count(self, value): """Sets DragStepCount for White - ``value`` is integer. DragStepCount defines how many steps White Teststack uses to move dragged object to the destination. - With default value 1 the dragged object is moved instantly in a single step from start to destination. + ``value`` is the DragStepCount value as integer. + DragStepCount defines how many steps White uses to move dragged object to the destination. + With default value 1 the dragged object is moved instantly in a single step from start to destination. """ - CoreAppXmlConfiguration.Instance.DragStepCount = int(value) logger.info("White DragStepCount set to" + str(CoreAppXmlConfiguration.Instance.DragStepCount)) return CoreAppXmlConfiguration.Instance.DragStepCount + @keyword def get_white_drag_step_count(self): - """Gets DragStepCount for White Teststack - - """ + """Returns DragStepCount value of White.""" return CoreAppXmlConfiguration.Instance.DragStepCount def _get_timestr_in_milliseconds(self, time_string):