Browse Source

Move `io.element.android.tests.uitests.ScreenshotTest` to `ui.T` to generate much shorter name for screenshot files.

pull/844/head
Benoit Marty 1 year ago committed by Benoit Marty
parent
commit
ecc7ba0089
  1. 3
      tests/uitests/build.gradle.kts
  2. 18
      tests/uitests/src/main/AndroidManifest.xml
  3. 2
      tests/uitests/src/main/kotlin/ui/ElementXShowkaseRootModule.kt
  4. 2
      tests/uitests/src/main/kotlin/ui/ShowkaseNavigation.kt
  5. 2
      tests/uitests/src/test/kotlin/ui/BaseDeviceConfig.kt
  6. 2
      tests/uitests/src/test/kotlin/ui/ColorTestPreview.kt
  7. 2
      tests/uitests/src/test/kotlin/ui/ComponentTestPreview.kt
  8. 17
      tests/uitests/src/test/kotlin/ui/S.kt
  9. 2
      tests/uitests/src/test/kotlin/ui/TestPreview.kt
  10. 2
      tests/uitests/src/test/kotlin/ui/TypographyTestPreview.kt

3
tests/uitests/build.gradle.kts

@ -25,7 +25,8 @@ plugins {
} }
android { android {
namespace = "io.element.android.tests.uitests" // Keep it as short as possible
namespace = "ui"
} }
// Workaround: `kover` tasks somehow trigger the screenshot tests with a broken configuration, removing // Workaround: `kover` tasks somehow trigger the screenshot tests with a broken configuration, removing

18
tests/uitests/src/main/AndroidManifest.xml

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2022 New Vector Ltd
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<manifest/>

2
tests/uitests/src/main/kotlin/io/element/android/tests/uitests/ElementXShowkaseRootModule.kt → tests/uitests/src/main/kotlin/ui/ElementXShowkaseRootModule.kt

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package io.element.android.tests.uitests package ui
import com.airbnb.android.showkase.annotation.ShowkaseRoot import com.airbnb.android.showkase.annotation.ShowkaseRoot
import com.airbnb.android.showkase.annotation.ShowkaseRootModule import com.airbnb.android.showkase.annotation.ShowkaseRootModule

2
tests/uitests/src/main/kotlin/io/element/android/tests/uitests/ShowkaseNavigation.kt → tests/uitests/src/main/kotlin/ui/ShowkaseNavigation.kt

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package io.element.android.tests.uitests package ui
import android.app.Activity import android.app.Activity
import android.content.Intent import android.content.Intent

2
tests/uitests/src/test/kotlin/io/element/android/tests/uitests/BaseDeviceConfig.kt → tests/uitests/src/test/kotlin/ui/BaseDeviceConfig.kt

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package io.element.android.tests.uitests package ui
import app.cash.paparazzi.DeviceConfig import app.cash.paparazzi.DeviceConfig

2
tests/uitests/src/test/kotlin/io/element/android/tests/uitests/ColorTestPreview.kt → tests/uitests/src/test/kotlin/ui/ColorTestPreview.kt

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package io.element.android.tests.uitests package ui
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box

2
tests/uitests/src/test/kotlin/io/element/android/tests/uitests/ComponentTestPreview.kt → tests/uitests/src/test/kotlin/ui/ComponentTestPreview.kt

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package io.element.android.tests.uitests package ui
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import com.airbnb.android.showkase.models.ShowkaseBrowserComponent import com.airbnb.android.showkase.models.ShowkaseBrowserComponent

17
tests/uitests/src/test/kotlin/io/element/android/tests/uitests/ScreenshotTest.kt → tests/uitests/src/test/kotlin/ui/S.kt

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package io.element.android.tests.uitests package ui
import android.content.res.Configuration import android.content.res.Configuration
import android.os.LocaleList import android.os.LocaleList
@ -48,15 +48,16 @@ import java.util.Locale
/** /**
* BMA: Inspired from https://github.com/airbnb/Showkase/blob/master/showkase-screenshot-testing-paparazzi-sample/src/test/java/com/airbnb/android/showkase/screenshot/testing/paparazzi/sample/PaparazziSampleScreenshotTest.kt * BMA: Inspired from https://github.com/airbnb/Showkase/blob/master/showkase-screenshot-testing-paparazzi-sample/src/test/java/com/airbnb/android/showkase/screenshot/testing/paparazzi/sample/PaparazziSampleScreenshotTest.kt
*/ *
/*
* Credit to Alex Vanyo for creating this sample in the Now In Android app by Google. * Credit to Alex Vanyo for creating this sample in the Now In Android app by Google.
* PR here - https://github.com/android/nowinandroid/pull/101. Modified the test from that PR to * PR here - https://github.com/android/nowinandroid/pull/101. Modified the test from that PR to
* my own needs for this sample. * my own needs for this sample.
*
* *Note*: keep the class name as short as possible to get shorter filename for generated screenshot.
* Long name was ScreenshotTest.
*/ */
@RunWith(TestParameterInjector::class) @RunWith(TestParameterInjector::class)
class ScreenshotTest { class S {
object PreviewProvider : TestParameter.TestParameterValuesProvider { object PreviewProvider : TestParameter.TestParameterValuesProvider {
override fun provideValues(): List<TestPreview> { override fun provideValues(): List<TestPreview> {
@ -79,8 +80,12 @@ class ScreenshotTest {
renderingMode = SessionParams.RenderingMode.NORMAL, renderingMode = SessionParams.RenderingMode.NORMAL,
) )
/**
* *Note*: keep the method name as short as possible to get shorter filename for generated screenshot.
* Long name was preview_test.
*/
@Test @Test
fun preview_tests( fun t(
@TestParameter(valuesProvider = PreviewProvider::class) componentTestPreview: TestPreview, @TestParameter(valuesProvider = PreviewProvider::class) componentTestPreview: TestPreview,
@TestParameter baseDeviceConfig: BaseDeviceConfig, @TestParameter baseDeviceConfig: BaseDeviceConfig,
@TestParameter(value = ["1.0"/*, "1.5"*/]) fontScale: Float, @TestParameter(value = ["1.0"/*, "1.5"*/]) fontScale: Float,

2
tests/uitests/src/test/kotlin/io/element/android/tests/uitests/TestPreview.kt → tests/uitests/src/test/kotlin/ui/TestPreview.kt

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package io.element.android.tests.uitests package ui
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview

2
tests/uitests/src/test/kotlin/io/element/android/tests/uitests/TypographyTestPreview.kt → tests/uitests/src/test/kotlin/ui/TypographyTestPreview.kt

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package io.element.android.tests.uitests package ui
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
Loading…
Cancel
Save