diff --git a/discover/autotests/appstreamUrl.qml b/discover/autotests/appstreamUrl.qml index 7ca95482..e1d1dfae 100644 --- a/discover/autotests/appstreamUrl.qml +++ b/discover/autotests/appstreamUrl.qml @@ -1,10 +1,11 @@ import QtQuick 2.0 import QtTest 1.1 DiscoverTest { function test_open() { verify(appRoot.stack.currentItem, "has a loading page"); - compare(appRoot.stack.currentItem.title, "techie1", "same title"); + compare(appRoot.stack.currentItem.title, "", "same title"); + compare(appRoot.stack.currentItem.application.packageName, "techie1", "pkgname"); } } diff --git a/discover/autotests/install.qml b/discover/autotests/install.qml index 33bc5bcc..9f361e92 100644 --- a/discover/autotests/install.qml +++ b/discover/autotests/install.qml @@ -1,42 +1,41 @@ import QtQuick 2.0 import org.kde.discover.app 1.0 import QtTest 1.1 DiscoverTest { function test_openResource() { app.openApplication("dummy://dummy.1"); verify(waitForSignal(appRoot.stack, "currentItemChanged")) verify(appRoot.stack.currentItem, "has a page"); - compare(appRoot.stack.currentItem.title, "Dummy 1", "same title"); var button = findChild(appRoot.stack.currentItem, "InstallApplicationButton") verify(!button.isActive) button.click() verify(button.isActive) verify(waitForSignal(button, "isActiveChanged")) verify(!button.isActive) } SignalSpy { id: cancelSpy target: TransactionModel signalName: "transactionRemoved" } function test_cancel() { app.openApplication("dummy://dummy.2"); verify(waitForSignal(appRoot.stack, "currentItemChanged")) var button = findChild(appRoot.stack.currentItem, "InstallApplicationButton") verify(!button.isActive) cancelSpy.clear() var state = button.application.state; button.click() verify(button.isActive) button.listener.cancel() verify(!button.isActive) compare(cancelSpy.count, 1) verify(state == button.application.state) } } diff --git a/discover/autotests/missingResource.qml b/discover/autotests/missingResource.qml index e83ea740..0add2b1b 100644 --- a/discover/autotests/missingResource.qml +++ b/discover/autotests/missingResource.qml @@ -1,9 +1,9 @@ import QtQuick 2.0 import QtTest 1.1 DiscoverTest { function test_open() { - compare(appRoot.stack.currentItem.title, "Featured") + compare(appRoot.stack.currentItem.title, "Sorry...") } } diff --git a/discover/autotests/packageArgument.qml b/discover/autotests/packageArgument.qml index 9b2bf348..a121cc34 100644 --- a/discover/autotests/packageArgument.qml +++ b/discover/autotests/packageArgument.qml @@ -1,12 +1,13 @@ import QtQuick 2.0 import QtTest 1.1 DiscoverTest { function test_open() { verify(appRoot.stack.currentItem, "has a page"); while (appRoot.stack.currentItem.title === "Loading...") waitForRendering(); - compare(appRoot.stack.currentItem.title, "CMakeLists.txt", "same title"); + compare(appRoot.stack.currentItem.title, "", "same title"); + compare(appRoot.stack.currentItem.application.packageName, "CMakeLists.txt", "pkgname"); } } diff --git a/discover/autotests/toplevels.qml b/discover/autotests/toplevels.qml index 9cc25cb0..ce1e823d 100644 --- a/discover/autotests/toplevels.qml +++ b/discover/autotests/toplevels.qml @@ -1,127 +1,127 @@ import QtQuick 2.0 import org.kde.discover.app 1.0 import QtTest 1.1 DiscoverTest { onReset: { appRoot.currentTopLevel = appRoot.topBrowsingComp } function test_openCategory() { var categoryName = "dummy 3"; app.openCategory(categoryName); verify(appRoot.stack.currentItem, "has a page"); compare(appRoot.stack.currentItem.title, categoryName, "same title"); verify(waitForRendering()) categoryName = "dummy 4"; app.openCategory(categoryName); verify(appRoot.stack.currentItem, "has a page"); compare(appRoot.stack.currentItem.title, categoryName, "same title"); verify(waitForRendering()) } function test_openHome() { var drawer = appRoot.globalDrawer; var firstitem; chooseChild(drawer, function(object) { if (object.hasOwnProperty("label") && object.label.indexOf("ummy")>0) { firstitem = object; return true } return false; }); var categoryName = "dummy 3"; firstitem.clicked() drawer.bannerClicked() compare(appRoot.stack.currentItem.title, "Featured", "same title"); compare(drawer.currentSubMenu, null) } function test_navigateThenUpdate() { var drawer = appRoot.globalDrawer; var firstitem; chooseChild(drawer, function(object) { if (object.hasOwnProperty("label") && object.label.indexOf("ummy")>0) { firstitem = object; return true } return false; }); var updateButton; chooseChild(drawer, function(object) { if (object.objectName == "updateButton") { updateButton = object; return true } return false; }); firstitem.clicked() verify(updateButton.enabled) updateButton.clicked() compare(appRoot.currentTopLevel, appRoot.topUpdateComp, "correct component, updates"); } function test_update() { app.openMode("Update"); var updatePage = appRoot.stack.currentItem; compare(typeName(updatePage), "UpdatesPage") compare(updatePage.state, "has-updates", "to update") - var button = findChild(updatePage, "Button") - verify(button); - button.clicked(); + var action = updatePage.currentAction + verify(action); + action.triggered(updatePage); compare(updatePage.state, "has-updates", "updating") //make sure the window doesn't close while updating verify(appRoot.visible); verify(waitForRendering()) appRoot.close() verify(appRoot.visible); while(updatePage.state !== "now-uptodate") waitForSignal(updatePage, "stateChanged") compare(ResourcesModel.updatesCount, 0, "should be up to date") } function test_search() { app.openMode("Browsing"); var searchField = findChild(appRoot.globalDrawer.topContent[0], "SearchField"); verify(searchField); searchField.text = "cocacola" searchField.accepted() while(!isType(appRoot.stack.currentItem, "ApplicationsListPage")) verify(waitForSignal(appRoot.stack, "currentItemChanged")) var listPage = appRoot.stack.currentItem while(listPage.count>0) verify(waitForSignal(listPage, "countChanged")) compare(listPage.count, 0) compare(listPage.search, "cocacola") searchField.text = "dummy" searchField.accepted() compare(listPage.search, searchField.text) // compare(listPage.count, ResourcesModel.rowCount()/2) } function test_modes() { app.openMode("Browsing"); compare(appRoot.currentTopLevel, appRoot.topBrowsingComp, "correct component, browsing"); verify(waitForRendering()) app.openMode("Installed"); compare(appRoot.currentTopLevel, appRoot.topInstalledComp, "correct component, installed"); verify(waitForRendering()) app.openMode("Update"); compare(appRoot.currentTopLevel, appRoot.topUpdateComp, "correct component, updates"); verify(waitForRendering()) app.openMode("Sources"); compare(appRoot.currentTopLevel, appRoot.topSourcesComp, "correct component, sources"); verify(waitForRendering()) } } diff --git a/discover/autotests/updateandinstall.qml b/discover/autotests/updateandinstall.qml index 46a918fe..ca3bbed2 100644 --- a/discover/autotests/updateandinstall.qml +++ b/discover/autotests/updateandinstall.qml @@ -1,45 +1,45 @@ import QtQuick 2.0 import org.kde.discover.app 1.0 import QtTest 1.1 DiscoverTest { function test_openResource() { app.openMode("Update"); {// we start an upate var updatePage = appRoot.stack.currentItem; compare(typeName(updatePage), "UpdatesPage") compare(updatePage.state, "has-updates", "to update") - var button = findChild(updatePage, "Button") - verify(button); - button.clicked(); + var action = updatePage.currentAction + verify(action); + action.triggered(null); compare(updatePage.state, "has-updates", "updating") } {//we start installing a resource app.openApplication("dummy://dummy.1"); verify(waitForSignal(appRoot.stack, "currentItemChanged")) var button = findChild(appRoot.stack.currentItem, "InstallApplicationButton") console.log("button", appRoot.stack.currentItem, button) verify(button) verify(!button.isActive) button.click() } app.openMode("Update"); { var updatePage = appRoot.stack.currentItem; compare(typeName(updatePage), "UpdatesPage") while(updatePage.state === "fetching") waitForSignal(updatePage, "stateChanged") compare(updatePage.state, "now-uptodate", "to update") - var button = findChild(updatePage, "Button") - verify(!button.isActive) + var action = updatePage.currentAction + verify(!action.visible) } while(updatePage.state != "now-uptodate") waitForSignal(updatePage, "stateChanged") } }