-
Notifications
You must be signed in to change notification settings - Fork 0
[RELEASE] New version 1.2.0 #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
fabd33a
Added hilt test modules
xavierpellvidal 7bb66d3
Added hilt activity debug to tests
xavierpellvidal d77ccfd
Modified screenshot test to add end to end integration test
xavierpellvidal ff5253d
Removed test api singletons
xavierpellvidal 1f09ff3
New approach to handle error events
xavierpellvidal 2d52a91
Bumped app version
xavierpellvidal a82e024
Injected dispatchers into hilt data module
xavierpellvidal 083543b
Moved main dispatcher rule
xavierpellvidal d190a5e
Added VM integration test
xavierpellvidal d6c05bd
Added error state to let retry loading users
xavierpellvidal 6ad3abe
Refactored previews
xavierpellvidal 791a57e
Merge pull request #12 from xavierpellvidal/feature/user-refactor-and…
xavierpellvidal 731b48e
Merge branch 'develop' into feature/integration-tests
xavierpellvidal b2bf0ea
Changed one time events to Channel
xavierpellvidal b722d83
Fixed screenshot test
xavierpellvidal a97252b
Clean dependencies
xavierpellvidal 3a15908
Merge pull request #11 from xavierpellvidal/feature/integration-tests
xavierpellvidal cf0e0b7
Improved tests
xavierpellvidal 4b9b89c
Changed README.md
xavierpellvidal 3c8c1c6
Bump project version
xavierpellvidal 48eae12
First action version
xavierpellvidal ad394c7
Added cache to action
xavierpellvidal 1c42d3c
Test screenshot tests in CI
xavierpellvidal 073e924
Final workflow version
xavierpellvidal 6cf9124
Copilot typo comment
xavierpellvidal 21258bd
Merge pull request #13 from xavierpellvidal/feature/final-version
xavierpellvidal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Check tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - develop | ||
| - main | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build: | ||
| name: 📲 Build Android Project | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: recursive | ||
|
|
||
| - name: Setup build cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| key: $gradle-build-cache | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| ~/.gradle/gradle-build-cache | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x gradlew | ||
|
|
||
| - name: Run tests | ||
| id: run_tests | ||
| run: ./gradlew test | ||
| continue-on-error: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
core/api/src/main/kotlin/com/random/users/api/di/TestApiModule.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package com.random.users.api.di | ||
|
|
||
| import arrow.retrofit.adapter.either.EitherCallAdapterFactory | ||
| import com.random.users.api.api.UsersApi | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.components.SingletonComponent | ||
| import dagger.hilt.testing.TestInstallIn | ||
| import okhttp3.OkHttpClient | ||
| import okhttp3.logging.HttpLoggingInterceptor | ||
| import okhttp3.mockwebserver.MockWebServer | ||
| import retrofit2.Retrofit | ||
| import retrofit2.converter.gson.GsonConverterFactory | ||
| import javax.inject.Singleton | ||
|
|
||
| @Module | ||
| @TestInstallIn( | ||
| components = [SingletonComponent::class], | ||
| replaces = [ApiModule::class], | ||
| ) | ||
| object TestApiModule { | ||
| @Provides | ||
| @Singleton | ||
| fun provideOkHttpClient(): OkHttpClient { | ||
| val logging = HttpLoggingInterceptor() | ||
| logging.setLevel(HttpLoggingInterceptor.Level.BODY) | ||
| return OkHttpClient | ||
| .Builder() | ||
| .addInterceptor(logging) | ||
| .build() | ||
| } | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideUsersApi(retrofit: Retrofit): UsersApi = retrofit.create(UsersApi::class.java) | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideRetrofit( | ||
| okHttpClient: OkHttpClient, | ||
| mockWebServer: MockWebServer, | ||
| ): Retrofit { | ||
| mockWebServer.start() | ||
| return Retrofit | ||
| .Builder() | ||
| .baseUrl(mockWebServer.url("/")) | ||
| .addConverterFactory(GsonConverterFactory.create()) | ||
| .addCallAdapterFactory(EitherCallAdapterFactory.create()) | ||
| .client(okHttpClient) | ||
| .build() | ||
| } | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideMockWebServer(): MockWebServer = MockWebServer() | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
core/database/src/main/kotlin/com/random/users/database/di/TestDatabaseModule.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.random.users.database.di | ||
|
|
||
| import android.content.Context | ||
| import androidx.room.Room | ||
| import com.random.users.database.RandomUsersDatabase | ||
| import com.random.users.database.dao.UserDao | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import dagger.hilt.components.SingletonComponent | ||
| import dagger.hilt.testing.TestInstallIn | ||
| import javax.inject.Singleton | ||
|
|
||
| @Module | ||
| @TestInstallIn( | ||
| components = [SingletonComponent::class], | ||
| replaces = [DatabaseModule::class], | ||
| ) | ||
| object TestDatabaseModule { | ||
| @Provides | ||
| @Singleton | ||
| fun provideDatabase( | ||
| @ApplicationContext appContext: Context, | ||
| ) = Room | ||
| .inMemoryDatabaseBuilder(appContext, RandomUsersDatabase::class.java) | ||
| .allowMainThreadQueries() | ||
| .build() | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideUserDao(db: RandomUsersDatabase): UserDao = db.userDao() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
core/preferences/src/main/kotlin/com/random/users/preferences/di/TestPreferencesModule.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package com.random.users.preferences.di | ||
|
|
||
| import android.content.Context | ||
| import android.content.SharedPreferences | ||
| import com.random.users.preferences.manager.PreferencesManager | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import dagger.hilt.components.SingletonComponent | ||
| import dagger.hilt.testing.TestInstallIn | ||
| import javax.inject.Singleton | ||
|
|
||
| @Module | ||
| @TestInstallIn( | ||
| components = [SingletonComponent::class], | ||
| replaces = [PreferencesModule::class], | ||
| ) | ||
| object TestPreferencesModule { | ||
| private const val TEST_PREFERENCES_NAME = "test_preferences" | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun provideFakeSharedPreferences( | ||
| @ApplicationContext context: Context, | ||
| ): SharedPreferences = context.getSharedPreferences(TEST_PREFERENCES_NAME, Context.MODE_PRIVATE) | ||
|
|
||
| @Provides | ||
| @Singleton | ||
| fun providePreferencesManager(sharedPreferences: SharedPreferences): PreferencesManager = | ||
| PreferencesManager(sharedPreferences) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.