Refactor flavours (#17)

- Fastlane completed
 - Circleci config completed
 - Flavours build completed
This commit is contained in:
2023-08-07 20:17:08 +01:00
committed by GitHub
parent 4a37b724a6
commit baabebd40d
121 changed files with 1326 additions and 1586 deletions

View File

@@ -0,0 +1,20 @@
package com.appttude.h_mal.monoWeather
import androidx.test.espresso.Espresso
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.matcher.RootMatchers
import androidx.test.espresso.matcher.ViewMatchers
import com.appttude.h_mal.atlas_weather.BaseTest
import com.appttude.h_mal.atlas_weather.ui.MainActivity
open class MonoBaseTest: BaseTest<MainActivity>(MainActivity::class.java) {
override fun afterLaunch() {
// Dismiss dialog on start up
Espresso.onView(ViewMatchers.withText("AGREE"))
.inRoot(RootMatchers.isDialog())
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
.perform(ViewActions.click())
}
}

View File

@@ -0,0 +1,11 @@
package com.appttude.h_mal.monoWeather.robot
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.BaseTestRobot
fun homeScreen(func: HomeScreenRobot.() -> Unit) = HomeScreenRobot().apply { func() }
class HomeScreenRobot : BaseTestRobot() {
fun verifyCurrentTemperature(temperature: Int) = matchText(R.id.temp_main_4, temperature.toString())
fun verifyCurrentLocation(location: String) = matchText(R.id.location_main_4, location)
fun refresh() = pullToRefresh(R.id.swipe_refresh)
}

View File

@@ -0,0 +1,11 @@
package com.appttude.h_mal.monoWeather.robot
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.BaseTestRobot
fun widgetPermissionScreen(func: WidgetPermissionScreenRobot.() -> Unit) =
WidgetPermissionScreenRobot().apply { func() }
class WidgetPermissionScreenRobot : BaseTestRobot() {
fun declarationDisplayed() = matchDisplayed(R.id.declaration_text)
}

View File

@@ -0,0 +1,22 @@
package com.appttude.h_mal.monoWeather.tests
import com.appttude.h_mal.monoWeather.robot.homeScreen
import com.appttude.h_mal.atlas_weather.utils.Stubs
import com.appttude.h_mal.monoWeather.MonoBaseTest
import org.junit.Test
class HomePageUITest : MonoBaseTest() {
override fun beforeLaunch() {
stubEndpoint("https://api.openweathermap.org/data/2.5/onecall", Stubs.Valid)
}
@Test
fun loadApp_validWeatherResponse_returnsValidPage() {
homeScreen {
verifyCurrentTemperature(2)
verifyCurrentLocation("Mock Location")
}
}
}

View File

@@ -0,0 +1,26 @@
package com.appttude.h_mal.monoWeather.tests
import android.appwidget.AppWidgetManager
import android.content.Intent
import android.os.Bundle
import androidx.test.rule.ActivityTestRule
import com.appttude.h_mal.atlas_weather.BaseTest
import com.appttude.h_mal.monoWeather.robot.widgetPermissionScreen
import com.appttude.h_mal.monoWeather.ui.widget.WidgetLocationPermissionActivity
import org.junit.Test
class WidgetLocationPermissionActivityTest : BaseTest<WidgetLocationPermissionActivity>(
activity = WidgetLocationPermissionActivity::class.java,
intentBundle = Bundle().apply {
putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, 112)
}
) {
@Test
fun demo_test() {
widgetPermissionScreen {
declarationDisplayed()
}
}
}