on xenial help sign in
Tests for the scopes overview
f82ec3cAlbert Astals
qml/Components/PageHeader.qml+1
@@ -242,6 +242,7 @@ Item {
242
242
243 actions: [
243 actions: [
244 Action {
244 Action {
245+ objectName: "search"
245 iconName: "search"
246 iconName: "search"
246 visible: root.searchEntryEnabled
247 visible: root.searchEntryEnabled
247 onTriggered: {
248 onTriggered: {
qml/Dash/Dash.qml+2
@@ -188,6 +188,7 @@ Showable {
188
188
189 GenericScopeView {
189 GenericScopeView {
190 id: scopeItem
190 id: scopeItem
191+ objectName: "dashTempScopeItem"
191
192
192 readonly property real targetOverviewScale: {
193 readonly property real targetOverviewScale: {
193 if (scopesOverview.currentTab == 0) {
194 if (scopesOverview.currentTab == 0) {
@@ -234,6 +235,7 @@ Showable {
234
235
235 EdgeDragArea {
236 EdgeDragArea {
236 id: overviewDragHandle
237 id: overviewDragHandle
238+ objectName: "overviewDragHandle"
237 z: 1
239 z: 1
238 direction: Direction.Upwards
240 direction: Direction.Upwards
239 enabled: !dashContent.previewShown && dashContent.currentScope && dashContent.currentScope.searchQuery == "" && (overviewController.progress == 0 || dragging)
241 enabled: !dashContent.previewShown && dashContent.currentScope && dashContent.currentScope.searchQuery == "" && (overviewController.progress == 0 || dragging)
qml/Dash/ScopesOverview.qml+6
@@ -154,6 +154,7 @@ Item {
154
154
155 PageHeader {
155 PageHeader {
156 id: pageHeader
156 id: pageHeader
157+ objectName: "scopesOverviewPageHeader"
157
158
158 readonly property real yDisplacement: pageHeader.height + tabBar.height + tabBar.anchors.margins
159 readonly property real yDisplacement: pageHeader.height + tabBar.height + tabBar.anchors.margins
159
160
@@ -190,10 +191,12 @@ Item {
190
191
191 Repeater {
192 Repeater {
192 id: middleItems
193 id: middleItems
194+ objectName: "scopesOverviewRepeater"
193 property real overrideOpacity: -1
195 property real overrideOpacity: -1
194 model: scope && scope.searchQuery == "" ? scope.categories : null
196 model: scope && scope.searchQuery == "" ? scope.categories : null
195 delegate: Loader {
197 delegate: Loader {
196 id: loader
198 id: loader
199+ objectName: "scopesOverviewRepeaterChild" + index
197
200
198 height: {
201 height: {
199 if (index == 0) {
202 if (index == 0) {
@@ -297,6 +300,7 @@ Item {
297
300
298 GenericScopeView {
301 GenericScopeView {
299 id: searchResultsViewer
302 id: searchResultsViewer
303+ objectName: "searchResultsViewer"
300 anchors {
304 anchors {
301 top: pageHeader.bottom
305 top: pageHeader.bottom
302 right: parent.right
306 right: parent.right
@@ -346,6 +350,7 @@ Item {
346 }
350 }
347
351
348 AbstractButton {
352 AbstractButton {
353+ objectName: "scopesOverviewDoneButton"
349 width: Math.max(label.width + units.gu(2), units.gu(10))
354 width: Math.max(label.width + units.gu(2), units.gu(10))
350 height: units.gu(4)
355 height: units.gu(4)
351 anchors {
356 anchors {
@@ -434,6 +439,7 @@ Item {
434
439
435 GenericScopeView {
440 GenericScopeView {
436 id: tempScopeItem
441 id: tempScopeItem
442+ objectName: "scopesOverviewTempScopeItem"
437
443
438 width: parent.width
444 width: parent.width
439 height: parent.height
445 height: parent.height
qml/Dash/ScopesOverviewTab.qml+1
@@ -40,6 +40,7 @@ Item {
40 }
40 }
41 AbstractButton {
41 AbstractButton {
42 id: tab2
42 id: tab2
43+ objectName: "scopesOverviewAllTabButton"
43 x: width
44 x: width
44 height: parent.height
45 height: parent.height
45 width: parent.width / 2
46 width: parent.width / 2
tests/qmltests/Dash/tst_Dash.qml+148−2
@@ -20,8 +20,6 @@ import "../../../qml/Dash"
20import Ubuntu.Components 0.1
20import Ubuntu.Components 0.1
21import Unity.Test 0.1 as UT
21import Unity.Test 0.1 as UT
22
22
23−// TODO We don't have any tests for the overlay scope functionality.
24−
25Item {
23Item {
26 id: shell
24 id: shell
27 width: units.gu(40)
25 width: units.gu(40)
@@ -153,5 +151,153 @@ Item {
153 tryCompare(overviewController, "progress", 0);
151 tryCompare(overviewController, "progress", 0);
154 compare(dashContentList.currentIndex, 1);
152 compare(dashContentList.currentIndex, 1);
155 }
153 }
154+
155+ function test_dash_overview_all_temp_scope_done_from_all() {
156+ // Wait for stuff to be loaded
157+ tryCompare(scopes, "loaded", true);
158+ var dashContentList = findChild(dash, "dashContentList");
159+ tryCompare(dashContentList, "count", 6);
160+ var mockScope1Loader = findChild(dash, "MockScope1 loader");
161+ tryCompareFunction(function() { return mockScope1Loader.item != null; }, true);
162+
163+ // Show the overview
164+ touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
165+ var overviewController = findInvisibleChild(dash, "overviewController");
166+ tryCompare(overviewController, "progress", 1);
167+
168+ // Make sure tab is where it should
169+ var scopesOverview = findChild(dash, "scopesOverview");
170+ compare(scopesOverview.currentTab, 0);
171+
172+ // Make sure stuff is loaded
173+ var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater");
174+ tryCompare(scopesOverviewFavoritesRepeater, "count", 6);
175+ tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true);
176+ waitForRendering(scopesOverviewFavoritesRepeater.itemAt(1).item);
177+
178+ // Click on the all tab
179+ var scopesOverviewAllTabButton = findChild(dash, "scopesOverviewAllTabButton");
180+ mouseClick(scopesOverviewAllTabButton, 0, 0);
181+
182+ // Wait for all tab to be enabled (animation finish)
183+ var scopesOverviewAllView = findChild(dash, "scopesOverviewRepeaterChild1");
184+ tryCompare(scopesOverviewAllView, "enabled", true);
185+
186+ // Click on a temp scope
187+ var tempScopeCard = findChild(scopesOverviewAllView, "delegate1");
188+ mouseClick(tempScopeCard, 0, 0);
189+
190+ // Check the bottom edge (overview) is disabled from temp scope
191+ var overviewDragHandle = findChild(dash, "overviewDragHandle");
192+ compare(overviewDragHandle.enabled, false);
193+
194+ // Check temp scope is there
195+ var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
196+ tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true);
197+ tryCompare(scopesOverviewTempScopeItem, "enabled", true);
198+
199+ // Go back
200+ var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader");
201+ var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton");
202+ mouseClick(backButton, 0, 0);
203+
204+ // Check temp scope is gone
205+ var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
206+ tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true);
207+ tryCompare(scopesOverviewTempScopeItem, "enabled", false);
208+
209+ // Press on done
210+ var scopesOverviewDoneButton = findChild(scopesOverview, "scopesOverviewDoneButton");
211+ mouseClick(scopesOverviewDoneButton, 0, 0);
212+
213+ // Check the dash overview is gone
214+ tryCompare(overviewController, "progress", 0);
215+
216+ // Original list is still on 0
217+ compare(dashContentList.currentIndex, 0);
218+ }
219+
220+ function test_temp_scope_dash_overview_all_search_temp_scope_favorite_from_all() {
221+ // Wait for stuff to be loaded
222+ tryCompare(scopes, "loaded", true);
223+ var dashContentList = findChild(dash, "dashContentList");
224+ tryCompare(dashContentList, "count", 6);
225+ var mockScope1Loader = findChild(dash, "MockScope1 loader");
226+ tryCompareFunction(function() { return mockScope1Loader.item != null; }, true);
227+
228+ // Swipe right to Apps scope
229+ touchFlick(dash, dash.width - 1, units.gu(1), dash.width - units.gu(10), units.gu(1));
230+ tryCompare(dashContentList, "contentX", dashContentList.width);
231+ tryCompare(dashContentList, "currentIndex", 1);
232+
233+ // Click on card that opens temp scope
234+ var dashCategory2 = findChild(dashContentList.currentItem, "dashCategory2");
235+ var card2 = findChild(dashCategory2, "delegate2");
236+ waitForRendering(card2);
237+ mouseClick(card2, 0, 0);
238+
239+ // Wait for temp scope to be there
240+ var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
241+ tryCompare(dashTempScopeItem, "x", 0);
242+
243+ // Show the overview
244+ touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
245+ var overviewController = findInvisibleChild(dash, "overviewController");
246+ tryCompare(overviewController, "progress", 1);
247+
248+ // Make sure tab is where it should
249+ var scopesOverview = findChild(dash, "scopesOverview");
250+ compare(scopesOverview.currentTab, 1);
251+
252+ // Do a search
253+ var scopesOverviewPageHeader = findChild(scopesOverview, "scopesOverviewPageHeader");
254+ var searchButton = findChild(scopesOverviewPageHeader, "search_header_button");
255+ mouseClick(searchButton, 0, 0);
256+
257+ // Type something
258+ keyClick(Qt.Key_H);
259+
260+ // Check results grid is there and the other lists are not
261+ var searchResultsViewer = findChild(scopesOverview, "searchResultsViewer");
262+ var scopesOverviewRepeater = findChild(dash, "scopesOverviewRepeater");
263+ tryCompare(searchResultsViewer, "opacity", 1);
264+ tryCompare(scopesOverviewRepeater, "count", 0);
265+
266+ // Click on a temp scope in the search
267+ var dashCategorysearchA = findChild(searchResultsViewer, "dashCategorysearchA");
268+ var cardTempScope = findChild(dashCategorysearchA, "delegate2");
269+ waitForRendering(cardTempScope);
270+ mouseClick(cardTempScope, cardTempScope.width / 2, cardTempScope.height / 2);
271+
272+ // Check the bottom edge (overview) is disabled from temp scope
273+ var overviewDragHandle = findChild(dash, "overviewDragHandle");
274+ compare(overviewDragHandle.enabled, false);
275+
276+ // Check temp scope is there
277+ var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
278+ tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true);
279+ tryCompare(scopesOverviewTempScopeItem, "enabled", true);
280+
281+ // Go back
282+ var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader");
283+ var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton");
284+ mouseClick(backButton, 0, 0);
285+
286+ // Check temp scope is gone
287+ var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
288+ tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true);
289+ tryCompare(scopesOverviewTempScopeItem, "enabled", false);
290+
291+ // Press on a favorite
292+ var dashCategorysearchB = findChild(searchResultsViewer, "dashCategorysearchB");
293+ var cardFavSearch = findChild(dashCategorysearchB, "delegate3");
294+ mouseClick(cardFavSearch, 0, 0);
295+
296+ // Check the dash overview is gone
297+ tryCompare(overviewController, "progress", 0);
298+
299+ // Original list went to the favorite
300+ compare(dashContentList.currentIndex, 0);
301+ }
156 }
302 }
157}
303}