- Fix integration tests (still not perfect while github actions are very very limited for that)
- Split them in msdk and app test along with multiple smaller steps. - Mark the not working tests with @Ignore so that they will not run neither local or on github actions - Add user friendly comment on PR to view the results
This commit is contained in:
		
							parent
							
								
									5efe1f4bd8
								
							
						
					
					
						commit
						261030f51e
					
				
							
								
								
									
										86
									
								
								.github/workflows/integration.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										86
									
								
								.github/workflows/integration.yml
									
									
									
									
										vendored
									
									
								
							@ -1,86 +0,0 @@
 | 
			
		||||
name: Integration Test
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  pull_request: { }
 | 
			
		||||
  push:
 | 
			
		||||
    branches: [ main, develop ]
 | 
			
		||||
 | 
			
		||||
# Enrich gradle.properties for CI/CD
 | 
			
		||||
env:
 | 
			
		||||
  CI_GRADLE_ARG_PROPERTIES: >
 | 
			
		||||
    -Porg.gradle.jvmargs=-Xmx2g
 | 
			
		||||
    -Porg.gradle.parallel=false
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  # Temporary add build of Android tests, which cannot be run on the CI right now, but they need to at least compile
 | 
			
		||||
  # So it will be mandatory for this action to be successful on every PRs
 | 
			
		||||
  compile-android-test:
 | 
			
		||||
    name: Compile Android tests
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - 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: Compile Android tests
 | 
			
		||||
        run: ./gradlew clean assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace -PallWarningsAsErrors=false
 | 
			
		||||
 | 
			
		||||
  integration-tests:
 | 
			
		||||
    name: Integration Tests (Synapse)
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        api-level: [28]
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - uses: gradle/wrapper-validation-action@v1
 | 
			
		||||
      - uses: actions/setup-java@v2
 | 
			
		||||
        with:
 | 
			
		||||
          distribution: 'adopt'
 | 
			
		||||
          java-version: 11
 | 
			
		||||
      - 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 integration tests on API ${{ matrix.api-level }}
 | 
			
		||||
        uses: reactivecircus/android-emulator-runner@v2
 | 
			
		||||
        with:
 | 
			
		||||
          api-level: ${{ matrix.api-level }}
 | 
			
		||||
          #arch: x86_64
 | 
			
		||||
          #disable-animations: true
 | 
			
		||||
          # script: ./gradlew -PallWarningsAsErrors=false vector:connectedAndroidTest matrix-sdk-android:connectedAndroidTest
 | 
			
		||||
          arch: x86
 | 
			
		||||
          profile: Nexus 5X
 | 
			
		||||
          force-avd-creation: false
 | 
			
		||||
          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
 | 
			
		||||
          emulator-build: 7425822
 | 
			
		||||
          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false connectedCheck --stacktrace
 | 
			
		||||
							
								
								
									
										209
									
								
								.github/workflows/integration_tests.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										209
									
								
								.github/workflows/integration_tests.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,209 @@
 | 
			
		||||
name: Integration Tests
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  pull_request: { }
 | 
			
		||||
  push:
 | 
			
		||||
    branches: [ main, develop ]
 | 
			
		||||
 | 
			
		||||
# Enrich gradle.properties for CI/CD
 | 
			
		||||
env:
 | 
			
		||||
  CI_GRADLE_ARG_PROPERTIES: >
 | 
			
		||||
    -Porg.gradle.jvmargs=-Xmx2g
 | 
			
		||||
    -Porg.gradle.parallel=false
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  # Build Android Tests [Matrix SDK]
 | 
			
		||||
  build-android-test-matrix-sdk:
 | 
			
		||||
    name: Matrix SDK - Build Android Tests
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - 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: Build Android Tests for matrix-sdk-android
 | 
			
		||||
        run: ./gradlew clean matrix-sdk-android:assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace -PallWarningsAsErrors=false
 | 
			
		||||
 | 
			
		||||
  # Build Android Tests [Matrix APP]
 | 
			
		||||
  build-android-test-app:
 | 
			
		||||
    name: App - Build Android Tests
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - 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: Build Android Tests for vector
 | 
			
		||||
        run: ./gradlew clean vector:assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace -PallWarningsAsErrors=false
 | 
			
		||||
 | 
			
		||||
 # Run Android Tests
 | 
			
		||||
  integration-tests:
 | 
			
		||||
    name: Matrix SDK - Running Integration Tests
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        api-level: [ 28 ]
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - uses: gradle/wrapper-validation-action@v1
 | 
			
		||||
      - uses: actions/setup-java@v2
 | 
			
		||||
        with:
 | 
			
		||||
          distribution: 'adopt'
 | 
			
		||||
          java-version: 11
 | 
			
		||||
      - 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 https://raw.githubusercontent.com/matrix-org/synapse/develop/demo/start.sh -o start.sh
 | 
			
		||||
          chmod 777 start.sh
 | 
			
		||||
          ./start.sh --no-rate-limit
 | 
			
		||||
# package: org.matrix.android.sdk.session
 | 
			
		||||
      - name: Run integration tests for  Matrix SDK [org.matrix.android.sdk.session] API[${{ matrix.api-level }}]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        uses: reactivecircus/android-emulator-runner@v2
 | 
			
		||||
        with:
 | 
			
		||||
          api-level: ${{ matrix.api-level }}
 | 
			
		||||
          arch: x86
 | 
			
		||||
          profile: Nexus 5X
 | 
			
		||||
          force-avd-creation: false
 | 
			
		||||
          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
 | 
			
		||||
          emulator-build: 7425822
 | 
			
		||||
          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES  -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.session' matrix-sdk-android:connectedDebugAndroidTest --info
 | 
			
		||||
      - name: Read Results [org.matrix.android.sdk.session]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        id: get-comment-body-session
 | 
			
		||||
        run: |
 | 
			
		||||
          body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")"
 | 
			
		||||
          echo "::set-output name=session::passed=$body"
 | 
			
		||||
# package: org.matrix.android.sdk.account
 | 
			
		||||
      - name: Run integration tests for  Matrix SDK [org.matrix.android.sdk.account] API[${{ matrix.api-level }}]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        uses: reactivecircus/android-emulator-runner@v2
 | 
			
		||||
        with:
 | 
			
		||||
          api-level: ${{ matrix.api-level }}
 | 
			
		||||
          arch: x86
 | 
			
		||||
          profile: Nexus 5X
 | 
			
		||||
          force-avd-creation: false
 | 
			
		||||
          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
 | 
			
		||||
          emulator-build: 7425822
 | 
			
		||||
          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES  -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.account' matrix-sdk-android:connectedDebugAndroidTest --info
 | 
			
		||||
      - name: Read Results [org.matrix.android.sdk.account]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        id: get-comment-body-account
 | 
			
		||||
        run: |
 | 
			
		||||
          body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")"
 | 
			
		||||
          echo "::set-output name=account::passed=$body"
 | 
			
		||||
# package: org.matrix.android.sdk.internal
 | 
			
		||||
      - name: Run integration tests for Matrix SDK [org.matrix.android.sdk.internal] API[${{ matrix.api-level }}]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        uses: reactivecircus/android-emulator-runner@v2
 | 
			
		||||
        with:
 | 
			
		||||
          api-level: ${{ matrix.api-level }}
 | 
			
		||||
          arch: x86
 | 
			
		||||
          profile: Nexus 5X
 | 
			
		||||
          force-avd-creation: false
 | 
			
		||||
          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
 | 
			
		||||
          emulator-build: 7425822
 | 
			
		||||
          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES  -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.internal' matrix-sdk-android:connectedDebugAndroidTest --info
 | 
			
		||||
      - name: Read Results [org.matrix.android.sdk.internal]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        id: get-comment-body-internal
 | 
			
		||||
        run: |
 | 
			
		||||
          body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")"
 | 
			
		||||
          echo "::set-output name=internal::passed=$body"
 | 
			
		||||
# package: org.matrix.android.sdk.ordering
 | 
			
		||||
      - name: Run integration tests for Matrix SDK [org.matrix.android.sdk.ordering] API[${{ matrix.api-level }}]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        uses: reactivecircus/android-emulator-runner@v2
 | 
			
		||||
        with:
 | 
			
		||||
          api-level: ${{ matrix.api-level }}
 | 
			
		||||
          arch: x86
 | 
			
		||||
          profile: Nexus 5X
 | 
			
		||||
          force-avd-creation: false
 | 
			
		||||
          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
 | 
			
		||||
          emulator-build: 7425822
 | 
			
		||||
          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES  -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.ordering' matrix-sdk-android:connectedDebugAndroidTest --info
 | 
			
		||||
      - name: Read Results [org.matrix.android.sdk.ordering]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        id: get-comment-body-ordering
 | 
			
		||||
        run: |
 | 
			
		||||
          body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")"
 | 
			
		||||
          echo "::set-output name=ordering::passed=$body"
 | 
			
		||||
# package: class PermalinkParserTest
 | 
			
		||||
      - name: Run integration tests for Matrix SDK class [org.matrix.android.sdk.PermalinkParserTest] API[${{ matrix.api-level }}]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        uses: reactivecircus/android-emulator-runner@v2
 | 
			
		||||
        with:
 | 
			
		||||
          api-level: ${{ matrix.api-level }}
 | 
			
		||||
          arch: x86
 | 
			
		||||
          profile: Nexus 5X
 | 
			
		||||
          force-avd-creation: false
 | 
			
		||||
          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
 | 
			
		||||
          emulator-build: 7425822
 | 
			
		||||
          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES  -Pandroid.testInstrumentationRunnerArguments.class='org.matrix.android.sdk.PermalinkParserTest' matrix-sdk-android:connectedDebugAndroidTest --info
 | 
			
		||||
      - name: Read Results [org.matrix.android.sd.PermalinkParserTest]
 | 
			
		||||
        continue-on-error: true
 | 
			
		||||
        id: get-comment-body-permalink
 | 
			
		||||
        run: |
 | 
			
		||||
          body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")"
 | 
			
		||||
          echo "::set-output name=permalink::passed=$body"
 | 
			
		||||
      - name: Find Comment
 | 
			
		||||
        uses: peter-evans/find-comment@v1
 | 
			
		||||
        id: fc
 | 
			
		||||
        with:
 | 
			
		||||
          issue-number: ${{ github.event.pull_request.number }}
 | 
			
		||||
          comment-author: 'github-actions[bot]'
 | 
			
		||||
          body-includes: Integration Tests Results
 | 
			
		||||
      - name: Publish results to PR
 | 
			
		||||
        uses: peter-evans/create-or-update-comment@v1
 | 
			
		||||
        with:
 | 
			
		||||
          comment-id: ${{ steps.fc.outputs.comment-id }}
 | 
			
		||||
          issue-number: ${{ github.event.pull_request.number }}
 | 
			
		||||
          body: |
 | 
			
		||||
            ### Matrix SDK
 | 
			
		||||
            ## Integration Tests Results:
 | 
			
		||||
            - `[org.matrix.android.sdk.session]`<br>${{ steps.get-comment-body-session.outputs.session }}
 | 
			
		||||
            - `[org.matrix.android.sdk.account]`<br>${{ steps.get-comment-body-account.outputs.account }}
 | 
			
		||||
            - `[org.matrix.android.sdk.intrernal]`<br>${{ steps.get-comment-body-intrernal.outputs.intrernal }}
 | 
			
		||||
            - `[org.matrix.android.sdk.ordering]`<br>${{ steps.get-comment-body-ordering.outputs.ordering }}
 | 
			
		||||
            - `[org.matrix.android.sdk.PermalinkParserTest]`<br>${{ steps.get-comment-body-permalink.outputs.permalink }}
 | 
			
		||||
          reactions: rocket
 | 
			
		||||
          edit-mode: replace
 | 
			
		||||
## Useful commands
 | 
			
		||||
#          script: ./integration_tests_script.sh
 | 
			
		||||
#          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES  -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.session' matrix-sdk-android:connectedDebugAndroidTest --info
 | 
			
		||||
#          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES matrix-sdk-android:connectedAndroidTest --info
 | 
			
		||||
#          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false connectedCheck --stacktrace
 | 
			
		||||
#          script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.ChunkEntityTest matrix-sdk-android:connectedAndroidTest --info
 | 
			
		||||
@ -29,6 +29,7 @@ def vanniktechEmoji = "0.8.0"
 | 
			
		||||
def mockk = "1.12.1"
 | 
			
		||||
def espresso = "3.4.0"
 | 
			
		||||
def androidxTest = "1.4.0"
 | 
			
		||||
def androidxOrchestrator = "1.4.1"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ext.libs = [
 | 
			
		||||
@ -63,7 +64,7 @@ ext.libs = [
 | 
			
		||||
                'pagingRuntimeKtx'        : "androidx.paging:paging-runtime-ktx:2.1.2",
 | 
			
		||||
                'coreTesting'             : "androidx.arch.core:core-testing:2.1.0",
 | 
			
		||||
                'testCore'                : "androidx.test:core:$androidxTest",
 | 
			
		||||
                'orchestrator'            : "androidx.test:orchestrator:$androidxTest",
 | 
			
		||||
                'orchestrator'            : "androidx.test:orchestrator:$androidxOrchestrator",
 | 
			
		||||
                'testRunner'              : "androidx.test:runner:$androidxTest",
 | 
			
		||||
                'testRules'               : "androidx.test:rules:$androidxTest",
 | 
			
		||||
                'espressoCore'            : "androidx.test.espresso:espresso-core:$espresso",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3
									
								
								integration_tests_script.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								integration_tests_script.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
./gradlew  -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.ChunkEntityTest matrix-sdk-android:connectedAndroidTest
 | 
			
		||||
./gradlew  -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.TimelineForwardPaginationTest matrix-sdk-android:connectedAndroidTest
 | 
			
		||||
							
								
								
									
										3
									
								
								integration_tests_script_github.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								integration_tests_script_github.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.ChunkEntityTest matrix-sdk-android:connectedAndroidTest
 | 
			
		||||
./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.TimelineForwardPaginationTest matrix-sdk-android:connectedAndroidTest
 | 
			
		||||
@ -45,7 +45,7 @@ android {
 | 
			
		||||
 | 
			
		||||
    testOptions {
 | 
			
		||||
        // Comment to run on Android 12
 | 
			
		||||
        execution 'ANDROIDX_TEST_ORCHESTRATOR'
 | 
			
		||||
//        execution 'ANDROIDX_TEST_ORCHESTRATOR'
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    buildTypes {
 | 
			
		||||
@ -64,6 +64,7 @@ android {
 | 
			
		||||
 | 
			
		||||
    adbOptions {
 | 
			
		||||
        installOptions "-g"
 | 
			
		||||
        timeOutInMs 180 * 1000
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    compileOptions {
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,9 @@
 | 
			
		||||
 | 
			
		||||
package org.matrix.android.sdk.account
 | 
			
		||||
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.JUnit4
 | 
			
		||||
@ -29,6 +31,7 @@ import org.matrix.android.sdk.common.TestConstants
 | 
			
		||||
 | 
			
		||||
@RunWith(JUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@LargeTest
 | 
			
		||||
class AccountCreationTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
@ -42,6 +45,7 @@ class AccountCreationTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun createAccountAndLoginAgainTest() {
 | 
			
		||||
        val session = commonTestHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(withInitialSync = true))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,7 @@ package org.matrix.android.sdk.account
 | 
			
		||||
 | 
			
		||||
import org.amshove.kluent.shouldBeTrue
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.JUnit4
 | 
			
		||||
@ -30,6 +31,7 @@ import org.matrix.android.sdk.common.TestConstants
 | 
			
		||||
 | 
			
		||||
@RunWith(JUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
class ChangePasswordTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,58 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright 2022 The Matrix.org Foundation C.I.C.
 | 
			
		||||
 *
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package org.matrix.android.sdk.common
 | 
			
		||||
 | 
			
		||||
import android.util.Log
 | 
			
		||||
import org.junit.rules.TestRule
 | 
			
		||||
import org.junit.runner.Description
 | 
			
		||||
import org.junit.runners.model.Statement
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Retry test rule used to retry test that failed.
 | 
			
		||||
 * Retry failed test 3 times
 | 
			
		||||
 */
 | 
			
		||||
class RetryTestRule(val retryCount: Int = 3) : TestRule {
 | 
			
		||||
 | 
			
		||||
    private val TAG = RetryTestRule::class.java.simpleName
 | 
			
		||||
 | 
			
		||||
    override fun apply(base: Statement, description: Description): Statement {
 | 
			
		||||
        return statement(base, description)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun statement(base: Statement, description: Description): Statement {
 | 
			
		||||
        return object : Statement() {
 | 
			
		||||
            @Throws(Throwable::class)
 | 
			
		||||
            override fun evaluate() {
 | 
			
		||||
                var caughtThrowable: Throwable? = null
 | 
			
		||||
 | 
			
		||||
                // implement retry logic here
 | 
			
		||||
                for (i in 0 until retryCount) {
 | 
			
		||||
                    try {
 | 
			
		||||
                        base.evaluate()
 | 
			
		||||
                        return
 | 
			
		||||
                    } catch (t: Throwable) {
 | 
			
		||||
                        caughtThrowable = t
 | 
			
		||||
                        Log.e(TAG, description.displayName + ": run " + (i + 1) + " failed")
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                Log.e(TAG, description.displayName + ": giving up after " + retryCount + " failures")
 | 
			
		||||
                throw caughtThrowable!!
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -23,7 +23,7 @@ object TestConstants {
 | 
			
		||||
    const val TESTS_HOME_SERVER_URL = "http://10.0.2.2:8080"
 | 
			
		||||
 | 
			
		||||
    // Time out to use when waiting for server response. 20s
 | 
			
		||||
    private const val AWAIT_TIME_OUT_MILLIS = 20_000
 | 
			
		||||
    private const val AWAIT_TIME_OUT_MILLIS = 30_000
 | 
			
		||||
 | 
			
		||||
    // Time out to use when waiting for server response, when the debugger is connected. 10 minutes
 | 
			
		||||
    private const val AWAIT_TIME_OUT_WITH_DEBUGGER_MILLIS = 10 * 60_000
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
 | 
			
		||||
import org.junit.Assert.assertEquals
 | 
			
		||||
import org.junit.Assert.assertNotNull
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.MethodSorters
 | 
			
		||||
@ -40,6 +41,7 @@ class PreShareKeysTest : InstrumentedTest {
 | 
			
		||||
    private val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun ensure_outbound_session_happy_path() {
 | 
			
		||||
        val testData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom(true)
 | 
			
		||||
        val e2eRoomID = testData.roomId
 | 
			
		||||
@ -97,7 +99,6 @@ class PreShareKeysTest : InstrumentedTest {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        testHelper.signOutAndClose(aliceSession)
 | 
			
		||||
        testHelper.signOutAndClose(bobSession)
 | 
			
		||||
        testData.cleanUp(testHelper)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ import org.amshove.kluent.shouldBe
 | 
			
		||||
import org.junit.Assert
 | 
			
		||||
import org.junit.Before
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.MethodSorters
 | 
			
		||||
@ -84,6 +85,7 @@ class UnwedgingTest : InstrumentedTest {
 | 
			
		||||
     * -> This is automatically fixed after SDKs restarted the olm session
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun testUnwedging() {
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,7 @@
 | 
			
		||||
package org.matrix.android.sdk.internal.crypto.crosssigning
 | 
			
		||||
 | 
			
		||||
import androidx.test.ext.junit.runners.AndroidJUnit4
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import org.junit.Assert.assertEquals
 | 
			
		||||
import org.junit.Assert.assertFalse
 | 
			
		||||
import org.junit.Assert.assertNotNull
 | 
			
		||||
@ -24,6 +25,7 @@ import org.junit.Assert.assertNull
 | 
			
		||||
import org.junit.Assert.assertTrue
 | 
			
		||||
import org.junit.Assert.fail
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.MethodSorters
 | 
			
		||||
@ -43,6 +45,7 @@ import kotlin.coroutines.resume
 | 
			
		||||
 | 
			
		||||
@RunWith(AndroidJUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 | 
			
		||||
@LargeTest
 | 
			
		||||
class XSigningTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val testHelper = CommonTestHelper(context())
 | 
			
		||||
@ -124,11 +127,11 @@ class XSigningTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
        assertFalse("Bob keys from alice pov should not be trusted", bobKeysFromAlicePOV.isTrusted())
 | 
			
		||||
 | 
			
		||||
        testHelper.signOutAndClose(aliceSession)
 | 
			
		||||
        testHelper.signOutAndClose(bobSession)
 | 
			
		||||
        cryptoTestData.cleanUp(testHelper)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_CrossSigningTestAliceTrustBobNewDevice() {
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,12 +18,14 @@ package org.matrix.android.sdk.internal.crypto.gossiping
 | 
			
		||||
 | 
			
		||||
import android.util.Log
 | 
			
		||||
import androidx.test.ext.junit.runners.AndroidJUnit4
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import junit.framework.TestCase.assertEquals
 | 
			
		||||
import junit.framework.TestCase.assertNotNull
 | 
			
		||||
import junit.framework.TestCase.assertTrue
 | 
			
		||||
import junit.framework.TestCase.fail
 | 
			
		||||
import org.junit.Assert
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.MethodSorters
 | 
			
		||||
@ -59,11 +61,13 @@ import kotlin.coroutines.resume
 | 
			
		||||
 | 
			
		||||
@RunWith(AndroidJUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@LargeTest
 | 
			
		||||
class KeyShareTests : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_DoNotSelfShareIfNotTrusted() {
 | 
			
		||||
        val aliceSession = commonTestHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
@ -195,6 +199,7 @@ class KeyShareTests : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_ShareSSSSSecret() {
 | 
			
		||||
        val aliceSession1 = commonTestHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
@ -307,6 +312,7 @@ class KeyShareTests : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_ImproperKeyShareBug() {
 | 
			
		||||
        val aliceSession = commonTestHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,8 +18,10 @@ package org.matrix.android.sdk.internal.crypto.gossiping
 | 
			
		||||
 | 
			
		||||
import android.util.Log
 | 
			
		||||
import androidx.test.ext.junit.runners.AndroidJUnit4
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import org.junit.Assert
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.MethodSorters
 | 
			
		||||
@ -39,12 +41,14 @@ import org.matrix.android.sdk.internal.crypto.model.event.WithHeldCode
 | 
			
		||||
 | 
			
		||||
@RunWith(AndroidJUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@LargeTest
 | 
			
		||||
class WithHeldTests : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val testHelper = CommonTestHelper(context())
 | 
			
		||||
    private val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_WithHeldUnverifiedReason() {
 | 
			
		||||
        // =============================
 | 
			
		||||
        // ARRANGE
 | 
			
		||||
@ -129,6 +133,7 @@ class WithHeldTests : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun  test_WithHeldNoOlm() {
 | 
			
		||||
        val testData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
        val aliceSession = testData.firstSession
 | 
			
		||||
@ -199,6 +204,7 @@ class WithHeldTests : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_WithHeldKeyRequest() {
 | 
			
		||||
        val testData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
        val aliceSession = testData.firstSession
 | 
			
		||||
 | 
			
		||||
@ -17,12 +17,14 @@
 | 
			
		||||
package org.matrix.android.sdk.internal.crypto.keysbackup
 | 
			
		||||
 | 
			
		||||
import androidx.test.ext.junit.runners.AndroidJUnit4
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import org.junit.Assert.assertEquals
 | 
			
		||||
import org.junit.Assert.assertFalse
 | 
			
		||||
import org.junit.Assert.assertNotNull
 | 
			
		||||
import org.junit.Assert.assertNull
 | 
			
		||||
import org.junit.Assert.assertTrue
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.MethodSorters
 | 
			
		||||
@ -47,6 +49,7 @@ import java.util.concurrent.CountDownLatch
 | 
			
		||||
 | 
			
		||||
@RunWith(AndroidJUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@LargeTest
 | 
			
		||||
class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val testHelper = CommonTestHelper(context())
 | 
			
		||||
@ -59,6 +62,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - Reset keys backup markers
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun roomKeysTest_testBackupStore_ok() {
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoomWithEncryptedMessages()
 | 
			
		||||
 | 
			
		||||
@ -157,6 +161,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - Check the backup completes
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun backupAfterCreateKeysBackupVersionTest() {
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoomWithEncryptedMessages()
 | 
			
		||||
 | 
			
		||||
@ -197,6 +202,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * Check that backupAllGroupSessions() returns valid data
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun backupAllGroupSessionsTest() {
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoomWithEncryptedMessages()
 | 
			
		||||
 | 
			
		||||
@ -241,6 +247,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - Compare the decrypted megolm key with the original one
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun testEncryptAndDecryptKeysBackupData() {
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoomWithEncryptedMessages()
 | 
			
		||||
 | 
			
		||||
@ -282,6 +289,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - Restore must be successful
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun restoreKeysBackupTest() {
 | 
			
		||||
        val testData = keysBackupTestHelper.createKeysBackupScenarioWithPassword(null)
 | 
			
		||||
 | 
			
		||||
@ -365,6 +373,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - It must be trusted and must have with 2 signatures now
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun trustKeyBackupVersionTest() {
 | 
			
		||||
        // - Do an e2e backup to the homeserver with a recovery key
 | 
			
		||||
        // - And log Alice on a new device
 | 
			
		||||
@ -424,6 +433,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - It must be trusted and must have with 2 signatures now
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun trustKeyBackupVersionWithRecoveryKeyTest() {
 | 
			
		||||
        // - Do an e2e backup to the homeserver with a recovery key
 | 
			
		||||
        // - And log Alice on a new device
 | 
			
		||||
@ -481,6 +491,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - The backup must still be untrusted and disabled
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun trustKeyBackupVersionWithWrongRecoveryKeyTest() {
 | 
			
		||||
        // - Do an e2e backup to the homeserver with a recovery key
 | 
			
		||||
        // - And log Alice on a new device
 | 
			
		||||
@ -522,6 +533,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - It must be trusted and must have with 2 signatures now
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun trustKeyBackupVersionWithPasswordTest() {
 | 
			
		||||
        val password = "Password"
 | 
			
		||||
 | 
			
		||||
@ -581,6 +593,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - The backup must still be untrusted and disabled
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun trustKeyBackupVersionWithWrongPasswordTest() {
 | 
			
		||||
        val password = "Password"
 | 
			
		||||
        val badPassword = "Bad Password"
 | 
			
		||||
@ -621,6 +634,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - It must fail
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun restoreKeysBackupWithAWrongRecoveryKeyTest() {
 | 
			
		||||
        val testData = keysBackupTestHelper.createKeysBackupScenarioWithPassword(null)
 | 
			
		||||
 | 
			
		||||
@ -654,6 +668,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - Restore must be successful
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun testBackupWithPassword() {
 | 
			
		||||
        val password = "password"
 | 
			
		||||
 | 
			
		||||
@ -709,6 +724,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - It must fail
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun restoreKeysBackupWithAWrongPasswordTest() {
 | 
			
		||||
        val password = "password"
 | 
			
		||||
        val wrongPassword = "passw0rd"
 | 
			
		||||
@ -745,6 +761,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - Restore must be successful
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun testUseRecoveryKeyToRestoreAPasswordBasedKeysBackup() {
 | 
			
		||||
        val password = "password"
 | 
			
		||||
 | 
			
		||||
@ -773,6 +790,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - It must fail
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun testUsePasswordToRestoreARecoveryKeyBasedKeysBackup() {
 | 
			
		||||
        val testData = keysBackupTestHelper.createKeysBackupScenarioWithPassword(null)
 | 
			
		||||
 | 
			
		||||
@ -804,6 +822,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * - Check the returned KeysVersionResult is trusted
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun testIsKeysBackupTrusted() {
 | 
			
		||||
        // - Create a backup version
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoomWithEncryptedMessages()
 | 
			
		||||
@ -847,6 +866,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * -> The new alice session must back up to the same version
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun testCheckAndStartKeysBackupWhenRestartingAMatrixSession() {
 | 
			
		||||
        // - Create a backup version
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoomWithEncryptedMessages()
 | 
			
		||||
@ -978,6 +998,7 @@ class KeysBackupTest : InstrumentedTest {
 | 
			
		||||
     * -> It must success
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun testBackupAfterVerifyingADevice() {
 | 
			
		||||
        // - Create a backup version
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoomWithEncryptedMessages()
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,7 @@ import org.junit.Assert.assertEquals
 | 
			
		||||
import org.junit.Assert.assertNotNull
 | 
			
		||||
import org.junit.Assert.assertNull
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.MethodSorters
 | 
			
		||||
@ -47,8 +48,6 @@ import org.matrix.android.sdk.internal.crypto.secrets.DefaultSharedSecretStorage
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
class QuadSTests : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val testHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
    private val emptyKeySigner = object : KeySigner {
 | 
			
		||||
        override fun sign(canonicalJson: String): Map<String, Map<String, String>>? {
 | 
			
		||||
            return null
 | 
			
		||||
@ -57,6 +56,8 @@ class QuadSTests : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun test_Generate4SKey() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        val aliceSession = testHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
        val quadS = aliceSession.sharedSecretStorageService
 | 
			
		||||
@ -108,6 +109,8 @@ class QuadSTests : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun test_StoreSecret() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        val aliceSession = testHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
 | 
			
		||||
        val keyId = "My.Key"
 | 
			
		||||
        val info = generatedSecret(aliceSession, keyId, true)
 | 
			
		||||
@ -151,6 +154,8 @@ class QuadSTests : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun test_SetDefaultLocalEcho() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        val aliceSession = testHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
        val quadS = aliceSession.sharedSecretStorageService
 | 
			
		||||
@ -171,6 +176,8 @@ class QuadSTests : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun test_StoreSecretWithMultipleKey() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        val aliceSession = testHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
 | 
			
		||||
        val keyId1 = "Key.1"
 | 
			
		||||
        val key1Info = generatedSecret(aliceSession, keyId1, true)
 | 
			
		||||
@ -217,7 +224,10 @@ class QuadSTests : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("Test is working locally, not in GitHub actions")
 | 
			
		||||
    fun test_GetSecretWithBadPassphrase() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        val aliceSession = testHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(true))
 | 
			
		||||
        val keyId1 = "Key.1"
 | 
			
		||||
        val passphrase = "The good pass phrase"
 | 
			
		||||
@ -264,6 +274,8 @@ class QuadSTests : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun assertAccountData(session: Session, type: String): UserAccountDataEvent {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        var accountData: UserAccountDataEvent? = null
 | 
			
		||||
        testHelper.waitWithLatch {
 | 
			
		||||
            val liveAccountData = session.accountDataService().getLiveUserAccountDataEvent(type)
 | 
			
		||||
@ -281,6 +293,7 @@ class QuadSTests : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private fun generatedSecret(session: Session, keyId: String, asDefault: Boolean = true): SsssKeyCreationInfo {
 | 
			
		||||
        val quadS = session.sharedSecretStorageService
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        val creationInfo = testHelper.runBlockingTest {
 | 
			
		||||
            quadS.generateKey(keyId, null, keyId, emptyKeySigner)
 | 
			
		||||
@ -300,6 +313,7 @@ class QuadSTests : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private fun generatedSecretFromPassphrase(session: Session, passphrase: String, keyId: String, asDefault: Boolean = true): SsssKeyCreationInfo {
 | 
			
		||||
        val quadS = session.sharedSecretStorageService
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        val creationInfo = testHelper.runBlockingTest {
 | 
			
		||||
            quadS.generateKeyWithPassphrase(
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@ import org.junit.Assert.assertNull
 | 
			
		||||
import org.junit.Assert.assertTrue
 | 
			
		||||
import org.junit.Assert.fail
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.MethodSorters
 | 
			
		||||
@ -53,11 +54,11 @@ import java.util.concurrent.CountDownLatch
 | 
			
		||||
@RunWith(AndroidJUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 | 
			
		||||
class SASTest : InstrumentedTest {
 | 
			
		||||
    private val testHelper = CommonTestHelper(context())
 | 
			
		||||
    private val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun test_aliceStartThenAliceCancel() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
        val aliceSession = cryptoTestData.firstSession
 | 
			
		||||
@ -137,7 +138,10 @@ class SASTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_key_agreement_protocols_must_include_curve25519() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        fail("Not passing for the moment")
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
@ -194,7 +198,10 @@ class SASTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_key_agreement_macs_Must_include_hmac_sha256() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        fail("Not passing for the moment")
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
@ -232,7 +239,10 @@ class SASTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_key_agreement_short_code_include_decimal() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        fail("Not passing for the moment")
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
@ -303,6 +313,8 @@ class SASTest : InstrumentedTest {
 | 
			
		||||
    // If a device has two verifications in progress with the same device, then it should cancel both verifications.
 | 
			
		||||
    @Test
 | 
			
		||||
    fun test_aliceStartTwoRequests() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
        val aliceSession = cryptoTestData.firstSession
 | 
			
		||||
@ -342,7 +354,10 @@ class SASTest : InstrumentedTest {
 | 
			
		||||
     * Test that when alice starts a 'correct' request, bob agrees.
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun test_aliceAndBobAgreement() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
        val aliceSession = cryptoTestData.firstSession
 | 
			
		||||
@ -402,6 +417,8 @@ class SASTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun test_aliceAndBobSASCode() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
        val aliceSession = cryptoTestData.firstSession
 | 
			
		||||
@ -458,6 +475,8 @@ class SASTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun test_happyPath() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
        val aliceSession = cryptoTestData.firstSession
 | 
			
		||||
@ -528,7 +547,6 @@ class SASTest : InstrumentedTest {
 | 
			
		||||
        val aliceDeviceInfoFromBobPOV: CryptoDeviceInfo? = bobSession.cryptoService().getDeviceInfo(aliceSession.myUserId, aliceSession.cryptoService().getMyDevice().deviceId)
 | 
			
		||||
 | 
			
		||||
        // latch wait a bit again
 | 
			
		||||
        Thread.sleep(1000)
 | 
			
		||||
 | 
			
		||||
        assertTrue("alice device should be verified from bob point of view", aliceDeviceInfoFromBobPOV!!.isVerified)
 | 
			
		||||
        assertTrue("bob device should be verified from alice point of view", bobDeviceInfoFromAlicePOV!!.isVerified)
 | 
			
		||||
@ -537,6 +555,8 @@ class SASTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun test_ConcurrentStart() {
 | 
			
		||||
        val testHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
        val aliceSession = cryptoTestData.firstSession
 | 
			
		||||
 | 
			
		||||
@ -40,8 +40,6 @@ import kotlin.coroutines.resume
 | 
			
		||||
@RunWith(AndroidJUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
class VerificationTest : InstrumentedTest {
 | 
			
		||||
    private val testHelper = CommonTestHelper(context())
 | 
			
		||||
    private val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
 | 
			
		||||
    data class ExpectedResult(
 | 
			
		||||
            val sasIsSupported: Boolean = false,
 | 
			
		||||
@ -155,6 +153,8 @@ class VerificationTest : InstrumentedTest {
 | 
			
		||||
                       bobSupportedMethods: List<VerificationMethod>,
 | 
			
		||||
                       expectedResultForAlice: ExpectedResult,
 | 
			
		||||
                       expectedResultForBob: ExpectedResult) {
 | 
			
		||||
         val testHelper = CommonTestHelper(context())
 | 
			
		||||
         val cryptoTestHelper = CryptoTestHelper(testHelper)
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
 | 
			
		||||
 | 
			
		||||
        val aliceSession = cryptoTestData.firstSession
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ import org.commonmark.parser.Parser
 | 
			
		||||
import org.commonmark.renderer.html.HtmlRenderer
 | 
			
		||||
import org.junit.Assert.assertEquals
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.MethodSorters
 | 
			
		||||
@ -131,6 +132,7 @@ class MarkdownParserTest : InstrumentedTest {
 | 
			
		||||
     * Note: the test is not passing, it does not work on Element Web neither
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun parseStrike_not_passing() {
 | 
			
		||||
        testType(
 | 
			
		||||
                name = "strike",
 | 
			
		||||
@ -140,6 +142,7 @@ class MarkdownParserTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun parseStrikeNewLines() {
 | 
			
		||||
        testTypeNewLines(
 | 
			
		||||
                name = "strike",
 | 
			
		||||
@ -159,6 +162,7 @@ class MarkdownParserTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    // TODO. Improve testTypeNewLines function to cover <pre><code class="language-code">test</code></pre>
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun parseCodeNewLines_not_passing() {
 | 
			
		||||
        testTypeNewLines(
 | 
			
		||||
                name = "code",
 | 
			
		||||
@ -178,6 +182,7 @@ class MarkdownParserTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun parseCode2NewLines_not_passing() {
 | 
			
		||||
        testTypeNewLines(
 | 
			
		||||
                name = "code",
 | 
			
		||||
@ -196,6 +201,7 @@ class MarkdownParserTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun parseCode3NewLines_not_passing() {
 | 
			
		||||
        testTypeNewLines(
 | 
			
		||||
                name = "code",
 | 
			
		||||
@ -232,6 +238,7 @@ class MarkdownParserTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun parseQuote_not_passing() {
 | 
			
		||||
        "> quoted\nline2".let { markdownParser.parse(it).expect(it, "<blockquote><p>quoted<br />line2</p></blockquote>") }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,7 @@
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package org.matrix.android.sdk
 | 
			
		||||
package org.matrix.android.sdk.ordering
 | 
			
		||||
 | 
			
		||||
import org.amshove.kluent.internal.assertEquals
 | 
			
		||||
import org.junit.Assert
 | 
			
		||||
@ -14,7 +14,7 @@
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package org.matrix.android.sdk
 | 
			
		||||
package org.matrix.android.sdk.ordering
 | 
			
		||||
 | 
			
		||||
import org.amshove.kluent.internal.assertEquals
 | 
			
		||||
import org.junit.Assert
 | 
			
		||||
@ -16,6 +16,7 @@
 | 
			
		||||
 | 
			
		||||
package org.matrix.android.sdk.session.room.timeline
 | 
			
		||||
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import kotlinx.coroutines.runBlocking
 | 
			
		||||
import org.amshove.kluent.internal.assertEquals
 | 
			
		||||
import org.amshove.kluent.shouldBeFalse
 | 
			
		||||
@ -40,16 +41,20 @@ import java.util.concurrent.CountDownLatch
 | 
			
		||||
 | 
			
		||||
@RunWith(JUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@LargeTest
 | 
			
		||||
class TimelineForwardPaginationTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
    private val cryptoTestHelper = CryptoTestHelper(commonTestHelper)
 | 
			
		||||
//    @Rule
 | 
			
		||||
//    @JvmField
 | 
			
		||||
//    val mRetryTestRule = RetryTestRule()
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This test ensure that if we click to permalink, we will be able to go back to the live
 | 
			
		||||
     */
 | 
			
		||||
    @Test
 | 
			
		||||
    fun forwardPaginationTest() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(commonTestHelper)
 | 
			
		||||
        val numberOfMessagesToSend = 90
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceInARoom(false)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,7 @@
 | 
			
		||||
 | 
			
		||||
package org.matrix.android.sdk.session.room.timeline
 | 
			
		||||
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import org.amshove.kluent.shouldBeFalse
 | 
			
		||||
import org.amshove.kluent.shouldBeTrue
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
@ -38,16 +39,17 @@ import java.util.concurrent.CountDownLatch
 | 
			
		||||
 | 
			
		||||
@RunWith(JUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@LargeTest
 | 
			
		||||
class TimelinePreviousLastForwardTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
    private val cryptoTestHelper = CryptoTestHelper(commonTestHelper)
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This test ensure that if we have a chunk in the timeline which is due to a sync, and we click to permalink, we will be able to go back to the live
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun previousLastForwardTest() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(commonTestHelper)
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom(false)
 | 
			
		||||
 | 
			
		||||
        val aliceSession = cryptoTestData.firstSession
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,7 @@
 | 
			
		||||
 | 
			
		||||
package org.matrix.android.sdk.session.room.timeline
 | 
			
		||||
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import kotlinx.coroutines.runBlocking
 | 
			
		||||
import org.amshove.kluent.internal.assertEquals
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
@ -36,13 +37,13 @@ import org.matrix.android.sdk.common.TestConstants
 | 
			
		||||
 | 
			
		||||
@RunWith(JUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@LargeTest
 | 
			
		||||
class TimelineSimpleBackPaginationTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
    private val cryptoTestHelper = CryptoTestHelper(commonTestHelper)
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun timeline_backPaginate_shouldReachEndOfTimeline() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(commonTestHelper)
 | 
			
		||||
        val numberOfMessagesToSent = 200
 | 
			
		||||
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom(false)
 | 
			
		||||
 | 
			
		||||
@ -16,8 +16,10 @@
 | 
			
		||||
 | 
			
		||||
package org.matrix.android.sdk.session.room.timeline
 | 
			
		||||
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import org.junit.Assert.fail
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.JUnit4
 | 
			
		||||
@ -31,8 +33,13 @@ import org.matrix.android.sdk.common.CommonTestHelper
 | 
			
		||||
import org.matrix.android.sdk.common.CryptoTestHelper
 | 
			
		||||
import java.util.concurrent.CountDownLatch
 | 
			
		||||
 | 
			
		||||
/** !! Not working with the new timeline
 | 
			
		||||
 *  Disabling it until the fix is made
 | 
			
		||||
 */
 | 
			
		||||
@RunWith(JUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
@LargeTest
 | 
			
		||||
class TimelineWithManyMembersTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    companion object {
 | 
			
		||||
@ -45,6 +52,7 @@ class TimelineWithManyMembersTest : InstrumentedTest {
 | 
			
		||||
    /**
 | 
			
		||||
     * Ensures when someone sends a message to a crowded room, everyone can decrypt the message.
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun everyone_should_decrypt_message_in_a_crowded_room() {
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithManyMembers(NUMBER_OF_MEMBERS)
 | 
			
		||||
 | 
			
		||||
@ -37,9 +37,6 @@ class SearchMessagesTest : InstrumentedTest {
 | 
			
		||||
        private const val MESSAGE = "Lorem ipsum dolor sit amet"
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
    private val cryptoTestHelper = CryptoTestHelper(commonTestHelper)
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun sendTextMessageAndSearchPartOfItUsingSession() {
 | 
			
		||||
        doTest { cryptoTestData ->
 | 
			
		||||
@ -76,6 +73,8 @@ class SearchMessagesTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun doTest(block: suspend (CryptoTestData) -> SearchResult) {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val cryptoTestHelper = CryptoTestHelper(commonTestHelper)
 | 
			
		||||
        val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceInARoom(false)
 | 
			
		||||
        val aliceSession = cryptoTestData.firstSession
 | 
			
		||||
        val aliceRoomId = cryptoTestData.roomId
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,7 @@
 | 
			
		||||
 | 
			
		||||
package org.matrix.android.sdk.session.space
 | 
			
		||||
 | 
			
		||||
import androidx.test.filters.LargeTest
 | 
			
		||||
import kotlinx.coroutines.delay
 | 
			
		||||
import kotlinx.coroutines.runBlocking
 | 
			
		||||
import org.junit.Assert.assertEquals
 | 
			
		||||
@ -43,12 +44,12 @@ import org.matrix.android.sdk.common.SessionTestParams
 | 
			
		||||
 | 
			
		||||
@RunWith(JUnit4::class)
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
@LargeTest
 | 
			
		||||
class SpaceCreationTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun createSimplePublicSpace() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val session = commonTestHelper.createAccount("Hubble", SessionTestParams(true))
 | 
			
		||||
        val roomName = "My Space"
 | 
			
		||||
        val topic = "A public space for test"
 | 
			
		||||
@ -58,6 +59,7 @@ class SpaceCreationTest : InstrumentedTest {
 | 
			
		||||
            // wait a bit to let the summary update it self :/
 | 
			
		||||
            it.countDown()
 | 
			
		||||
        }
 | 
			
		||||
        Thread.sleep(4_000)
 | 
			
		||||
 | 
			
		||||
        val syncedSpace = session.spaceService().getSpace(spaceId)
 | 
			
		||||
        commonTestHelper.waitWithLatch {
 | 
			
		||||
@ -99,6 +101,8 @@ class SpaceCreationTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun testJoinSimplePublicSpace() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        val aliceSession = commonTestHelper.createAccount("alice", SessionTestParams(true))
 | 
			
		||||
        val bobSession = commonTestHelper.createAccount("bob", SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
@ -130,6 +134,7 @@ class SpaceCreationTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun testSimplePublicSpaceWithChildren() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val aliceSession = commonTestHelper.createAccount("alice", SessionTestParams(true))
 | 
			
		||||
        val bobSession = commonTestHelper.createAccount("bob", SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,7 @@ import org.junit.Assert.assertEquals
 | 
			
		||||
import org.junit.Assert.assertNotNull
 | 
			
		||||
import org.junit.Assert.assertTrue
 | 
			
		||||
import org.junit.FixMethodOrder
 | 
			
		||||
import org.junit.Ignore
 | 
			
		||||
import org.junit.Test
 | 
			
		||||
import org.junit.runner.RunWith
 | 
			
		||||
import org.junit.runners.JUnit4
 | 
			
		||||
@ -50,10 +51,10 @@ import org.matrix.android.sdk.common.SessionTestParams
 | 
			
		||||
@FixMethodOrder(MethodSorters.JVM)
 | 
			
		||||
class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    private val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun createCanonicalChildRelation() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
 | 
			
		||||
        val session = commonTestHelper.createAccount("John", SessionTestParams(true))
 | 
			
		||||
        val spaceName = "My Space"
 | 
			
		||||
        val topic = "A public space for test"
 | 
			
		||||
@ -170,6 +171,7 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun testFilteringBySpace() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val session = commonTestHelper.createAccount("John", SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
        val spaceAInfo = createPublicSpace(session, "SpaceA", listOf(
 | 
			
		||||
@ -236,7 +238,7 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
            it.countDown()
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Thread.sleep(2_000)
 | 
			
		||||
        Thread.sleep(6_000)
 | 
			
		||||
        val orphansUpdate = session.getRoomSummaries(roomSummaryQueryParams {
 | 
			
		||||
            activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null)
 | 
			
		||||
        })
 | 
			
		||||
@ -244,7 +246,9 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Ignore("This test will be ignored until it is fixed")
 | 
			
		||||
    fun testBreakCycle() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val session = commonTestHelper.createAccount("John", SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
        val spaceAInfo = createPublicSpace(session, "SpaceA", listOf(
 | 
			
		||||
@ -273,8 +277,6 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
            it.countDown()
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Thread.sleep(1000)
 | 
			
		||||
 | 
			
		||||
        // A -> C -> A
 | 
			
		||||
 | 
			
		||||
        val aChildren = session.getFlattenRoomSummaryChildrenOf(spaceAInfo.spaceId)
 | 
			
		||||
@ -288,6 +290,7 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun testLiveFlatChildren() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val session = commonTestHelper.createAccount("John", SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
        val spaceAInfo = createPublicSpace(session, "SpaceA", listOf(
 | 
			
		||||
@ -374,6 +377,7 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
                                  childInfo: List<Triple<String, Boolean, Boolean?>>
 | 
			
		||||
            /** Name, auto-join, canonical*/
 | 
			
		||||
    ): TestSpaceCreationResult {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        var spaceId = ""
 | 
			
		||||
        var roomIds: List<String> = emptyList()
 | 
			
		||||
        commonTestHelper.waitWithLatch { latch ->
 | 
			
		||||
@ -401,6 +405,7 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
                                   childInfo: List<Triple<String, Boolean, Boolean?>>
 | 
			
		||||
            /** Name, auto-join, canonical*/
 | 
			
		||||
    ): TestSpaceCreationResult {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        var spaceId = ""
 | 
			
		||||
        var roomIds: List<String> = emptyList()
 | 
			
		||||
        commonTestHelper.waitWithLatch { latch ->
 | 
			
		||||
@ -435,6 +440,7 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun testRootSpaces() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val session = commonTestHelper.createAccount("John", SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
        /* val spaceAInfo = */ createPublicSpace(session, "SpaceA", listOf(
 | 
			
		||||
@ -459,9 +465,10 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
        runBlocking {
 | 
			
		||||
            val spaceB = session.spaceService().getSpace(spaceBInfo.spaceId)
 | 
			
		||||
            spaceB!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
 | 
			
		||||
            Thread.sleep(6_000)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Thread.sleep(2000)
 | 
			
		||||
//        Thread.sleep(4_000)
 | 
			
		||||
        // + A
 | 
			
		||||
        //   a1, a2
 | 
			
		||||
        // + B
 | 
			
		||||
@ -478,6 +485,7 @@ class SpaceHierarchyTest : InstrumentedTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun testParentRelation() {
 | 
			
		||||
        val commonTestHelper = CommonTestHelper(context())
 | 
			
		||||
        val aliceSession = commonTestHelper.createAccount("Alice", SessionTestParams(true))
 | 
			
		||||
        val bobSession = commonTestHelper.createAccount("Bib", SessionTestParams(true))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -202,9 +202,8 @@ android {
 | 
			
		||||
        animationsDisabled = true
 | 
			
		||||
 | 
			
		||||
        // Comment to run on Android 12
 | 
			
		||||
        execution 'ANDROIDX_TEST_ORCHESTRATOR'
 | 
			
		||||
//        execution 'ANDROIDX_TEST_ORCHESTRATOR'
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    signingConfigs {
 | 
			
		||||
        debug {
 | 
			
		||||
            keyAlias 'androiddebugkey'
 | 
			
		||||
 | 
			
		||||
@ -154,8 +154,6 @@ class SecurityBootstrapTest : VerificationTestBase() {
 | 
			
		||||
        onView(withId(R.id.recoveryCopy))
 | 
			
		||||
                .perform(click())
 | 
			
		||||
 | 
			
		||||
        Thread.sleep(1000)
 | 
			
		||||
 | 
			
		||||
        // Dismiss dialog
 | 
			
		||||
        onView(withText(R.string.ok)).inRoot(RootMatchers.isDialog()).perform(click())
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user