mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-17 19:35:36 -04:00
Made Reliable Assertion on LibraryScreen and added few Robots
Added Robots for LZimHost, Reader and Bookmarks
This commit is contained in:
parent
788ddc93f9
commit
aa3b6f8e9e
@ -30,12 +30,17 @@ import org.kiwix.kiwixmobile.nav.destination.LibraryRobot
|
||||
import org.kiwix.kiwixmobile.nav.destination.OnlineLibraryRobot
|
||||
import org.kiwix.kiwixmobile.nav.destination.library
|
||||
import org.kiwix.kiwixmobile.nav.destination.onlineLibrary
|
||||
import org.kiwix.kiwixmobile.nav.destination.reader.ReaderRobot
|
||||
import org.kiwix.kiwixmobile.nav.destination.reader.reader
|
||||
import org.kiwix.kiwixmobile.page.bookmarks.BookmarksRobot
|
||||
import org.kiwix.kiwixmobile.page.bookmarks.bookmarks
|
||||
import org.kiwix.kiwixmobile.page.history.HistoryRobot
|
||||
import org.kiwix.kiwixmobile.page.history.history
|
||||
import org.kiwix.kiwixmobile.settings.SettingsRobot
|
||||
import org.kiwix.kiwixmobile.settings.settingsRobo
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils.getResourceString
|
||||
import org.kiwix.kiwixmobile.webserver.ZimHostRobot
|
||||
import org.kiwix.kiwixmobile.webserver.zimHost
|
||||
|
||||
fun kiwixMainRobo(func: KiwixMainRobot.() -> Unit) =
|
||||
KiwixMainRobot().applyWithViewHierarchyPrinting(func)
|
||||
@ -46,10 +51,9 @@ class KiwixMainRobot : BaseRobot() {
|
||||
isVisible(ViewId(R.id.navigation_container))
|
||||
}
|
||||
|
||||
fun clickReaderOnBottomNav(func: LibraryRobot.() -> Unit) {
|
||||
fun clickReaderOnBottomNav(func: ReaderRobot.() -> Unit) {
|
||||
clickOn(ViewId(R.id.readerFragment))
|
||||
isVisible(Text(getResourceString(R.string.reader)))
|
||||
library(func)
|
||||
reader(func)
|
||||
}
|
||||
|
||||
fun clickLibraryOnBottomNav(func: LibraryRobot.() -> Unit) {
|
||||
@ -83,15 +87,15 @@ class KiwixMainRobot : BaseRobot() {
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun clickHostBooksOnSideNav(func: KiwixMainRobot.() -> Unit) {
|
||||
fun clickHostBooksOnSideNav(func: ZimHostRobot.() -> Unit) {
|
||||
clickOn(Text(getResourceString(R.string.menu_host_books)))
|
||||
isVisible(Text(getResourceString(R.string.menu_host_books)))
|
||||
zimHost(func)
|
||||
pressBack()
|
||||
}
|
||||
|
||||
fun clickSettingsOnSideNav(func: SettingsRobot.() -> Unit) {
|
||||
clickOn(Text(getResourceString(R.string.menu_settings)))
|
||||
isVisible(Text(getResourceString(R.string.menu_settings)))
|
||||
settingsRobo(func)
|
||||
pressBack()
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ fun library(func: LibraryRobot.() -> Unit) = LibraryRobot().applyWithViewHierarc
|
||||
|
||||
class LibraryRobot : BaseRobot() {
|
||||
init {
|
||||
isVisible(Text(getResourceString(R.string.library)))
|
||||
isVisible(ViewId(R.id.get_zim_nearby_device))
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,4 +53,3 @@ class OnlineLibraryRobot : BaseRobot() {
|
||||
language(func)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Kiwix Android
|
||||
* Copyright (c) 2020 Kiwix <android.kiwix.org>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.kiwix.kiwixmobile.nav.destination.reader
|
||||
|
||||
import applyWithViewHierarchyPrinting
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable.StringId.TextId
|
||||
import org.kiwix.kiwixmobile.R
|
||||
|
||||
/**
|
||||
* Authored by Ayush Shrivastava on 29/10/20
|
||||
*/
|
||||
|
||||
fun reader(func: ReaderRobot.() -> Unit) = ReaderRobot().applyWithViewHierarchyPrinting(func)
|
||||
|
||||
class ReaderRobot : BaseRobot() {
|
||||
init {
|
||||
isVisible(TextId(R.string.reader))
|
||||
}
|
||||
}
|
@ -19,7 +19,9 @@
|
||||
package org.kiwix.kiwixmobile.page.bookmarks
|
||||
|
||||
import applyWithViewHierarchyPrinting
|
||||
import com.schibsted.spain.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable
|
||||
import org.kiwix.kiwixmobile.Findable.StringId.ContentDesc
|
||||
import org.kiwix.kiwixmobile.Findable.Text
|
||||
import org.kiwix.kiwixmobile.R
|
||||
@ -34,6 +36,11 @@ fun bookmarks(func: BookmarksRobot.() -> Unit) =
|
||||
|
||||
class BookmarksRobot : BaseRobot() {
|
||||
/** Pushed back robot rules due to lack of info to assert the correct screen */
|
||||
init {
|
||||
assertDisplayed(R.string.bookmarks_from_current_book)
|
||||
// isVisible(Findable.StringId.TextId(R.string.bookmarks_from_current_book))
|
||||
}
|
||||
|
||||
fun clickOnTrashIcon() {
|
||||
clickOn(ContentDesc(R.string.pref_clear_all_bookmarks_title))
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Kiwix Android
|
||||
* Copyright (c) 2020 Kiwix <android.kiwix.org>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.kiwix.kiwixmobile.webserver
|
||||
|
||||
import applyWithViewHierarchyPrinting
|
||||
import org.kiwix.kiwixmobile.BaseRobot
|
||||
import org.kiwix.kiwixmobile.Findable
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils
|
||||
|
||||
/**
|
||||
* Authored by Ayush Shrivastava on 29/10/20
|
||||
*/
|
||||
|
||||
fun zimHost(func: ZimHostRobot.() -> Unit) = ZimHostRobot().applyWithViewHierarchyPrinting(func)
|
||||
|
||||
class ZimHostRobot : BaseRobot() {
|
||||
init {
|
||||
isVisible(Findable.Text(TestUtils.getResourceString(R.string.menu_host_books)))
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user