Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple committed Nov 25, 2024
1 parent 99cd278 commit b624c1c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Snapshot Tests
on:
# pull_request: # FIXME: https://github.com/pedrovgs/Shot/issues/326

push: # TESTING NOW

workflow_dispatch:
inputs:
record:
Expand All @@ -19,14 +21,11 @@ jobs:
- name: Check out code
uses: actions/[email protected]
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/setup-ruby
- uses: ./.github/actions/gradle-cache
with:
key-prefix: gradle-test

- name: Enable recording
if: ${{ github.event.inputs.record == 'true' }}
run: echo 'RECORD_SNAPSHOTS_IF_REQUIRED=-Precord' >> $GITHUB_ENV

- name: Snapshot tests
uses: reactivecircus/android-emulator-runner@v2
timeout-minutes: 60
Expand All @@ -36,7 +35,7 @@ jobs:
profile: pixel
arch : x86_64
emulator-options: ${{ vars.EMULATOR_OPTIONS }}
script: ./gradlew stream-chat-android-ui-uitests:executeScreenshotTests ${{ env.RECORD_SNAPSHOTS_IF_REQUIRED }} -Pandroid.testInstrumentationRunnerArguments.filter=io.getstream.chat.android.uitests.util.SnapshotTestFilter -Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED"
script: bundle exec fastlane run_snapshot_test record:${{ github.event.inputs.record }}

- name: Upload test results
if: failure()
Expand Down
16 changes: 15 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ lane :stop_mock_server do
Net::HTTP.get_response(URI("http://localhost:#{mock_server_driver_port}/stop")) rescue nil
end

lane :run_snapshot_test do |options|
next unless is_check_required(sources: sources_matrix[:ui], force_check: @force_check)

cmd = [
'./gradlew',
'stream-chat-android-ui-uitests:executeScreenshotTests',
'-Pandroid.testInstrumentationRunnerArguments.filter=io.getstream.chat.android.uitests.util.SnapshotTestFilter',
'-Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED"'
]
cmd << '-Precord' unless options[:record].to_s.empty?
sh(cmd.join(' '))
end

lane :build_and_run_e2e_test do |options|
build_e2e_test
run_e2e_test(batch: options[:batch], batch_count: options[:batch_count])
Expand Down Expand Up @@ -115,7 +128,8 @@ end

private_lane :sources_matrix do
{
e2e: ['buildSrc', 'stream-chat-android', '.github/workflows/e2e-tests'],
ui: ['stream-chat-android-ui', '.github/workflows/snapshot-test'],
e2e: ['buildSrc', 'stream-chat-android', '.github/workflows/e2e-test'],
ruby: ['fastlane', 'Gemfile', 'Gemfile.lock']
}
end
Expand Down

0 comments on commit b624c1c

Please sign in to comment.