Merge pull request #3921 from vector-im/feature/bma/integ_test_fix

Test on intermediate API levels
This commit is contained in:
Benoit Marty 2021-09-06 09:57:20 +02:00 committed by GitHub
commit 167298735e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 115 additions and 29 deletions

View file

@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
api-level: [21, 30]
api-level: [21, 28, 30]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8

50
.github/workflows/sanity_test.yml vendored Normal file
View file

@ -0,0 +1,50 @@
name: Sanity Test
on:
pull_request: { }
push:
branches: [ main, develop ]
jobs:
integration-tests:
name: Sanity Tests (Synapse)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
api-level: [28]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Start synapse server
run: |
python3 -m venv .synapse
source .synapse/bin/activate
pip install synapse matrix-synapse
curl -sL https://raw.githubusercontent.com/matrix-org/synapse/develop/demo/start.sh --no-rate-limit \
| sed s/127.0.0.1/0.0.0.0/g | bash
- name: Run sanity tests on API ${{ matrix.api-level }}
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
script: ./gradlew -PallWarningsAsErrors=false connectedGplayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=im.vector.app.ui.UiAllScreensSanityTest

View file

@ -91,6 +91,7 @@ class CommonTestHelper(context: Context) {
*
* @param session the session to sync
*/
@Suppress("EXPERIMENTAL_API_USAGE")
fun syncSession(session: Session, timeout: Long = TestConstants.timeOutMillis) {
val lock = CountDownLatch(1)
@ -327,6 +328,7 @@ class CommonTestHelper(context: Context) {
assertTrue(latch.await(timeout ?: TestConstants.timeOutMillis, TimeUnit.MILLISECONDS))
}
@Suppress("EXPERIMENTAL_API_USAGE")
fun retryPeriodicallyWithLatch(latch: CountDownLatch, condition: (() -> Boolean)) {
GlobalScope.launch {
while (true) {

View file

@ -84,6 +84,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
/**
* @return alice and bob sessions
*/
@Suppress("EXPERIMENTAL_API_USAGE")
fun doE2ETestWithAliceAndBobInARoom(encryptedRoom: Boolean = true): CryptoTestData {
val cryptoTestData = doE2ETestWithAliceInARoom(encryptedRoom)
val aliceSession = cryptoTestData.firstSession
@ -255,6 +256,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
)
}
@Suppress("EXPERIMENTAL_API_USAGE")
fun createDM(alice: Session, bob: Session): String {
val roomId = mTestHelper.runBlockingTest {
alice.createDirectRoom(bob.myUserId)

View file

@ -60,6 +60,7 @@ class QuadSTests : InstrumentedTest {
}
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun test_Generate4SKey() {
val aliceSession = mTestHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
@ -275,6 +276,7 @@ class QuadSTests : InstrumentedTest {
mTestHelper.signOutAndClose(aliceSession)
}
@Suppress("EXPERIMENTAL_API_USAGE")
private fun assertAccountData(session: Session, type: String): UserAccountDataEvent {
val accountDataLock = CountDownLatch(1)
var accountData: UserAccountDataEvent? = null

View file

@ -139,7 +139,7 @@ class TimelineForwardPaginationTest : InstrumentedTest {
// Alice can see the first event of the room (so Back pagination has worked)
snapshot.lastOrNull()?.root?.getClearType() == EventType.STATE_ROOM_CREATE
// 6 for room creation item (backward pagination), 1 for the context, and 50 for the forward pagination
&& snapshot.size == 6 + 1 + 50
&& snapshot.size == 57 // 6 + 1 + 50
}
aliceTimeline.addListener(aliceEventsListener)

View file

@ -189,7 +189,7 @@ class TimelinePreviousLastForwardTest : InstrumentedTest {
Timber.w(" event ${it.root}")
}
snapshot.size == 8 + 1 + 35
snapshot.size == 44 // 8 + 1 + 35
}
bobTimeline.addListener(eventsListener)
@ -218,7 +218,7 @@ class TimelinePreviousLastForwardTest : InstrumentedTest {
// Bob can see the first event of the room (so Back pagination has worked)
snapshot.lastOrNull()?.root?.getClearType() == EventType.STATE_ROOM_CREATE
// 8 for room creation item 60 message from Alice
&& snapshot.size == 8 + 60
&& snapshot.size == 68 // 8 + 60
&& snapshot.checkSendOrder(secondMessage, 30, 0)
&& snapshot.checkSendOrder(firstMessage, 30, 30)
}

View file

@ -50,6 +50,7 @@ class SpaceCreationTest : InstrumentedTest {
private val commonTestHelper = CommonTestHelper(context())
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun createSimplePublicSpace() {
val session = commonTestHelper.createAccount("Hubble", SessionTestParams(true))
val roomName = "My Space"
@ -133,6 +134,7 @@ class SpaceCreationTest : InstrumentedTest {
}
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun testSimplePublicSpaceWithChildren() {
val aliceSession = commonTestHelper.createAccount("alice", SessionTestParams(true))
val bobSession = commonTestHelper.createAccount("bob", SessionTestParams(true))

View file

@ -47,6 +47,7 @@ class SpaceHierarchyTest : InstrumentedTest {
private val commonTestHelper = CommonTestHelper(context())
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun createCanonicalChildRelation() {
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
val spaceName = "My Space"
@ -171,6 +172,7 @@ class SpaceHierarchyTest : InstrumentedTest {
// }
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun testFilteringBySpace() {
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
@ -179,7 +181,7 @@ class SpaceHierarchyTest : InstrumentedTest {
Triple("A2", true, true)
))
val spaceBInfo = createPublicSpace(session, "SpaceB", listOf(
/* val spaceBInfo = */ createPublicSpace(session, "SpaceB", listOf(
Triple("B1", true /*auto-join*/, true/*canonical*/),
Triple("B2", true, true),
Triple("B3", true, true)
@ -254,6 +256,7 @@ class SpaceHierarchyTest : InstrumentedTest {
}
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun testBreakCycle() {
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
@ -301,6 +304,7 @@ class SpaceHierarchyTest : InstrumentedTest {
}
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun testLiveFlatChildren() {
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
@ -389,6 +393,7 @@ class SpaceHierarchyTest : InstrumentedTest {
val roomIds: List<String>
)
@Suppress("EXPERIMENTAL_API_USAGE")
private fun createPublicSpace(session: Session,
spaceName: String,
childInfo: List<Triple<String, Boolean, Boolean?>>
@ -433,7 +438,7 @@ class SpaceHierarchyTest : InstrumentedTest {
fun testRootSpaces() {
val session = commonTestHelper.createAccount("John", SessionTestParams(true))
val spaceAInfo = createPublicSpace(session, "SpaceA", listOf(
/* val spaceAInfo = */ createPublicSpace(session, "SpaceA", listOf(
Triple("A1", true /*auto-join*/, true/*canonical*/),
Triple("A2", true, true)
))

View file

@ -32,6 +32,7 @@ class CoroutineSequencersTest: MatrixTest {
private val dispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun sequencer_should_run_sequential() {
val sequencer = SemaphoreCoroutineSequencer()
val results = ArrayList<String>()
@ -60,6 +61,7 @@ class CoroutineSequencersTest: MatrixTest {
}
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun sequencer_should_run_parallel() {
val sequencer1 = SemaphoreCoroutineSequencer()
val sequencer2 = SemaphoreCoroutineSequencer()
@ -86,6 +88,7 @@ class CoroutineSequencersTest: MatrixTest {
}
@Test
@Suppress("EXPERIMENTAL_API_USAGE")
fun sequencer_should_jump_to_next_when_current_job_canceled() {
val sequencer = SemaphoreCoroutineSequencer()
val results = ArrayList<String>()

View file

@ -521,7 +521,7 @@ dependencies {
// Plant Timber tree for test
androidTestImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1'
// "The one who serves a great Espresso"
androidTestImplementation('com.schibsted.spain:barista:3.9.0') {
androidTestImplementation('com.adevinta.android:barista:4.1.0') {
exclude group: 'org.jetbrains.kotlin'
}
}

View file

@ -107,6 +107,7 @@ abstract class VerificationTestBase {
return result!!
}
@Suppress("EXPERIMENTAL_API_USAGE")
private fun syncSession(session: Session) {
val lock = CountDownLatch(1)

View file

@ -30,18 +30,20 @@ import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.schibsted.spain.barista.assertion.BaristaListAssertions.assertListItemCount
import com.schibsted.spain.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
import com.schibsted.spain.barista.interaction.BaristaClickInteractions.clickBack
import com.schibsted.spain.barista.interaction.BaristaClickInteractions.clickOn
import com.schibsted.spain.barista.interaction.BaristaClickInteractions.longClickOn
import com.schibsted.spain.barista.interaction.BaristaDialogInteractions.clickDialogNegativeButton
import com.schibsted.spain.barista.interaction.BaristaDialogInteractions.clickDialogPositiveButton
import com.schibsted.spain.barista.interaction.BaristaEditTextInteractions.writeTo
import com.schibsted.spain.barista.interaction.BaristaListInteractions.clickListItem
import com.schibsted.spain.barista.interaction.BaristaListInteractions.clickListItemChild
import com.schibsted.spain.barista.interaction.BaristaMenuClickInteractions.clickMenu
import com.schibsted.spain.barista.interaction.BaristaMenuClickInteractions.openMenu
import com.adevinta.android.barista.assertion.BaristaListAssertions.assertListItemCount
import com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickBack
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import com.adevinta.android.barista.interaction.BaristaClickInteractions.longClickOn
import com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickDialogNegativeButton
import com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickDialogPositiveButton
import com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDrawer
import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo
import com.adevinta.android.barista.interaction.BaristaListInteractions.clickListItem
import com.adevinta.android.barista.interaction.BaristaListInteractions.clickListItemChild
import com.adevinta.android.barista.interaction.BaristaMenuClickInteractions.clickMenu
import com.adevinta.android.barista.interaction.BaristaMenuClickInteractions.openMenu
import im.vector.app.BuildConfig
import im.vector.app.EspressoHelper
import im.vector.app.R
import im.vector.app.SleepViewAction
@ -169,9 +171,13 @@ class UiAllScreensSanityTest {
}
clickOn(R.string.create_new_room)
// Room access bottom sheet
clickOn(R.string.room_settings_room_access_private_title)
pressBack()
// Create
assertListItemCount(R.id.createRoomForm, 10)
clickListItemChild(R.id.createRoomForm, 9, R.id.form_submit_button)
assertListItemCount(R.id.createRoomForm, 12)
clickListItemChild(R.id.createRoomForm, 11, R.id.form_submit_button)
waitUntilActivityVisible<RoomDetailActivity> {
assertDisplayed(R.id.roomDetailContainer)
@ -229,6 +235,8 @@ class UiAllScreensSanityTest {
// Wait a bit for the keyboard layout to update
sleep(30)
clickOn(R.id.sendButton)
// Wait for the UI to update
sleep(1000)
// Open edit history
longClickOnMessage("Hello universe! (edited)")
clickOn(R.string.message_view_edit_history)
@ -355,7 +363,8 @@ class UiAllScreensSanityTest {
}
private fun navigateToSettings() {
clickOn(R.id.groupToolbarAvatarImageView)
// clickOn(R.id.groupToolbarAvatarImageView)
openDrawer()
clickOn(R.id.homeDrawerHeaderSettingsView)
clickOn(R.string.settings_general_title)
@ -458,8 +467,18 @@ class UiAllScreensSanityTest {
}
private fun navigateToSettingsNotifications() {
clickOn(R.string.settings_notification_advanced)
pressBack()
if (BuildConfig.USE_NOTIFICATION_SETTINGS_V2) {
clickOn(R.string.settings_notification_default)
pressBack()
clickOn(R.string.settings_notification_mentions_and_keywords)
// TODO Test adding a keyword?
pressBack()
clickOn(R.string.settings_notification_other)
pressBack()
} else {
clickOn(R.string.settings_notification_advanced)
pressBack()
}
/*
clickOn(R.string.settings_noisy_notifications_preferences)
TODO Cannot go back

View file

@ -20,11 +20,11 @@ import androidx.test.espresso.Espresso.closeSoftKeyboard
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withId
import com.schibsted.spain.barista.assertion.BaristaEnabledAssertions.assertDisabled
import com.schibsted.spain.barista.assertion.BaristaEnabledAssertions.assertEnabled
import com.schibsted.spain.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
import com.schibsted.spain.barista.interaction.BaristaClickInteractions.clickOn
import com.schibsted.spain.barista.interaction.BaristaEditTextInteractions.writeTo
import com.adevinta.android.barista.assertion.BaristaEnabledAssertions.assertDisabled
import com.adevinta.android.barista.assertion.BaristaEnabledAssertions.assertEnabled
import com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo
import im.vector.app.R
import im.vector.app.espresso.tools.waitUntilActivityVisible
import im.vector.app.features.home.HomeActivity