2850 Commits

Author SHA1 Message Date
MohitMaliFtechiz
29287df550 Improved ObjectBoxToLibkiwixMigratorTest and clearing the application data before running the test cases. 2024-03-19 20:57:26 +05:30
MohitMaliFtechiz
3ae2793949 Added the 'testDirectory' to our scanning process, as on API level 33, the app-specific path is occasionally treated as READ_ONLY. Additionally, for certain test cases where we need to load the zim file in the LocalLibraryScreen, we've included the test directory in our scanning process, as it will be automatically handled by the OS. 2024-03-18 16:43:56 +05:30
MohitMaliFtechiz
efb1d8e2e3 Changed the Timeout to 20 second instead of 40 seconds.
* Improved the functionality of closing dialog where any system dialog is visible on the window.
2024-03-18 15:42:04 +05:30
MohitMaliFtechiz
52159608e5 Added timeout for waiting for the idle state of emulator since by default it has 10 second but the API level 33 emulator is heavy and takes more time to become idle so we have increased the timeout to properly come in the idle state. 2024-03-18 13:25:56 +05:30
MohitMaliFtechiz
9d79e4b515 Improved the filePath for creating temp files in our test cases since sometimes the emulator treats app-specific directory as READ_ONLY_FILESYSTEM. 2024-03-18 13:18:18 +05:30
MohitMaliFtechiz
e1c69aa259 Restricting testExtractDocumentId and testDocumentProviderContentQuery test cases on API level 33 since numerous security updates have been included, preventing us from modifying the default behavior of ContentResolver. So running the test case on this APi level leads to test failure. 2024-03-16 20:06:30 +05:30
MohitMaliFtechiz
df59ed19a3 Improved the ObjectBoxToLibkiwixMigratorTest test case, as it occasionally crashes during testing on API level 33 due to emulator lag on google_apis. The extensive data migration exacerbates the emulator's performance issues, leading to crashes during subsequent test processes. To address this issue, we have reduced the migration volume from 10K to 1K.
* Increased the disk size of API level 33 emulator since emulator is crashing on this api level while performing the test cases so it might require more resource to run smoothly.
* Clearing the previous installed application data when launching the test cases for the first time to properly run the test cases.
* Removed the enabling wifi for adb as it is unused now because sometimes API level 33 emulator does not have the wifi, and we have introduced this for API level 33 emulator.
* Removed the APK sharing in test cases since if a text case fails it crashed all the test cases even we re-run that test case in second run.
2024-03-15 23:27:52 +05:30
MohitMaliFtechiz
0d6d76b5db Increased retry count to 5 for flaky test cases on API level 33, where failures occurred multiple times due to the heavy google_apis. so to address this we have increased it to 5 to properly run the test cases.
* We are removing the `ZimHostFragment` test from the API level 33 because, most of the time, the emulator does not have WiFi service. Running this test on this emulator is not worthwhile, as we are testing this code on WiFi.
2024-03-15 12:19:16 +05:30
MohitMaliFtechiz
f0eb680d21 Added Notification permission in our test cases for API level 33.
* Improved our `ZimHostFragmentTest` test to boost the test case speed. It was running in 2 minutes, but after this change, it now completes in 27 seconds.
2024-03-15 12:19:09 +05:30
MohitMaliFtechiz
bfdf5c6e88 Improved ObjectBoxToLibkiwixMigratorTest for clearing the previous saved bookmarks.
* Refresh the data before checking the loaded data in DownloadTest.
* Increasing the Retry count for loading data and downloading start to properly work with low internet connection.
2024-03-15 12:19:01 +05:30
MohitMaliFtechiz
91b9f955d8 Using uiDevice.waitForIdle() method instead of BaristaSleepInteractions.sleep in our test cases. Because BaristaSleepInteractions.sleep runs everytime even the view is displaying on the screen which takes the extra time to run the test case, but now we are using uiDevice.waitForIdle() method which perform the further operation if desired view is already displaying otherwise wait for that view.
* Improved the deleting of zim files in localibrary, since we already pause for a second to check if the delete dialog is displayed or not, and again we are waiting before clicking on it. The same issue for while clicking on the PlayStoreRestrictionDialogTest where we are first waiting for the dialog to visible and then waiting for clicking on it. So we have removed the second wait since this dialog is displaying in both test cases.
* Improved the TopLevelDestinationTest. Because we were testing the drawer options fragments (Settings, Bookmarks etc) from the download screen and when we pressed the back button it came to the download screen and refreshed its data due to this our next functionality had to wait to finish this. Now we are testing all the navigation screens from the LocalLibraryScreen which makes this test case faster.
2024-03-15 12:18:54 +05:30
MohitMaliFtechiz
2808d5d63a Fixed: Speed up Automated Tests by sharing apks.
* Improved our CI to generate the test apk, we are using this in our all test cases.
* Added apk to `testInstrumentationRunnerArguments` option which takes the test apk when running the test cases.
2024-03-15 12:18:31 +05:30
MohitMaliFtechiz
b680b1afce Fixed: ZIM file is not deleting from LocalLibraryFragment if we do not have the storage permission in non-playstore variant, which is fine but it should ask permission.
* Added permission check when selecting the ZIM file to delete or share, which fixes this problem.
2024-03-14 07:23:25 +01:00
MohitMaliFtechiz
8828a8b917 Fixed: Lint Issue - Unconditional Logging.
* Re-enabled the `LogConditional` lint check.
* Introduced a `Log` class that exclusively handles logging operations in the debug variant.
* Removed unnecessary `if (BuildConfig.DEBUG)` conditions from the project.
2024-03-11 11:46:17 +05:30
MohitMaliFtechiz
10e1022865 Improved the LibkiwixBookmarkTest, we are now opening the Bookmark screen via the navigation drawer instead of long clicking on the bottom_toolbar_bookmark button because sometimes the screen scrolls down and this button hides and our test case fails on API level 33.
* Improved the NoteFragmentTest. Sometimes it didn't find the `overFlowOptionMenu` since we immediately clicked on that menu while opening the readerFragment, and sometimes this menu was not shown, because it was preparing its data to show.
2024-03-09 19:39:13 +05:30
MohitMaliFtechiz
9fb5adb37a Added an condition for checking if any system dialog is visible method to handle all the dialog shown by the system. 2024-03-09 19:39:05 +05:30
MohitMaliFtechiz
606bea4405 Improved our instrumentation.sh bash script, if our test fails then after restarting the emulator if our application is installed we clear its cache data so that test cases will perform properly. We have made this change to fix a scenario that comes locally after testing so many times where downloading is stuck due to lag of emulator.
* * Improved the LibkiwixBookmarkTest. In this, before performing the test case we are removing the existing bookmarks if any so that the saved bookmark will not go outside the screen(We faced an occurrence of this type locally).
* Improved the ZIM file path in many scenarios so that the created ZIM file will show in the LocalLibraryScreen and we can delete it so that we can free up the memory.
2024-03-09 19:38:58 +05:30
MohitMaliFtechiz
d5305b6856 Improved the SearchFragmentTest that are sometimes failing on API level 30. 2024-03-09 19:38:51 +05:30
MohitMaliFtechiz
afaf1a487a Improved DownloadTest, InitialDownloadTest and ZimHostFragmentTest.
* Remove all the ZIM files showing in the LocalLibrary screen before performing the test operation, this will free up the memory and unwanted behaviour like if the any other ZIM file already contains in this screen then it can affect our these test cases.
2024-03-09 19:38:44 +05:30
MohitMaliFtechiz
291a063747 Fixed: Test cases are frequently failing on API level 33.
* Refreshed the ZIM files list before deleting/checking for downloaded ZIM files in `DownloadTest` and `InitialDownloadTest` because sometimes data doesn't show on the `LocalLibraryScreen` after downloading the ZIM file, leading to test failures.
* Hiding the `Storage Restriction` dialog in `LibkiwixBookTest` and `MimeTypeTest` to not show this dialog in these test cases.
* Improved the temporary ZIM file path in `NoteFragmentTest` to properly display the ZIM file in the LocalLibrary screen so that it can be deleted in our test case.
* Enhanced the loading of ZIM files in `LocalLibraryTest`.
2024-03-09 19:38:35 +05:30
translatewiki.net
4f5d66dbd7 Localisation updates from https://translatewiki.net. 2024-03-07 13:07:14 +01:00
MohitMaliFtechiz
49e7116781 Updated the ZIM file url for downloading the ZIM file.
* Refactored the search test according to this new ZIM file.
2024-03-05 13:47:04 +01:00
MohitMaliFtechiz
63acf5768a Added test cases for the search functionality.
* In this updated test case, we have addressed scenarios involving fast typing/deleting for search queries. Additionally, we implemented a test case where the user types with both short and long delays to ensure the following:
 1. Short delay: Properly tests the cancellation of the previously searching task.
 2. Long delay: Properly executes the search query letter by letter and ensures that there is no crash during the search.
* We are downloading the "stack exchange" ZIM file in our test case because this ZIM file yields many search results. Therefore, we download and perform all search operations on this file to simulate a real-world scenario, as our test ZIM file only contains three search results.
* The temporary ZIM file is deleted after performing the test to free up device storage.
2024-03-05 13:47:04 +01:00
MohitMaliFtechiz
0a8735cbb1 Fixed: [Bug] Pop-up Function does not work correctly (fails to automatically “detect” headword and show results).
* Fixed the scenario where "Search kiwix" on any text does not show the expected result. Because we were passing the activity's intent instead of the actual intent we are getting to open the search, which leads to unexpected results. So now we are passing the actual intent to process the request that fixes this issue.
*  Fixed one more scenario that occurred after placing this fix, where one more instance is created of the search screen because the activity has the intent with this type, and we are processing this intent in our `onViewCreated` for the scenario where our application launched(it is not running in the background). So when we close the search screen for then our `onViewCreated` method is called, and the activity has the intent so it creates one more search instance. So to fix this issue we are setting both intents as null after using them.
2024-03-05 08:19:28 +01:00
MohitMaliFtechiz
f2e44e02c4 Upgraded many dependencies of our project.
* Upgraded test cases and project dependencies.
* Refactor test cases and project code according to the new changes in dependencies.
2024-03-04 21:18:04 +05:30
MohitMaliFtechiz
7671a3be7b Added necessary comments and removed unnecessary logs. 2024-03-01 07:07:15 +01:00
MohitMaliFtechiz
a64e58ea16 Added test cases for extractDocumentId and documentProviderContentQuery to comprehensively test all scenarios for URIs.
* Implemented `DocumentResolverWrapper` to facilitate mocking of values for `DocumentsContract` and `ContentResolver` methods, considering the inability to directly mock these methods in our test class.
* Included test cases covering various types of download URIs utilized in our `documentProviderContentQuery` method.
* Removed `getAssetFileDescriptorFromUri` method from FileUtils class as now it is unused.
* Removed the `getAssetFileDescriptorFromUri` method from FileUtils class as now it is unused.
2024-03-01 07:07:15 +01:00
MohitMaliFtechiz
abdd966c1d Added code to handle the exception when the provided download URI is invalid, as we encountered this issue in the test case for API level 24. 2024-03-01 07:07:15 +01:00
MohitMaliFtechiz
c830e1acf0 Added Test cases for getLocalFilePathByUri method that we are using for getting the filePath from the given uri.
* This test ensure that every uri will return the expected filePath. e.g. for download uri, older device compatibility, internal/external/USB-STICK uri, and if a invalid uri is given then it will return the null.
2024-03-01 07:07:15 +01:00
MohitMaliFtechiz
5d483f555e Fixed: we can't discover the peers for sending/receiving ZIM files if we disallow the location/nearby or storage permission twice.
* Improved the message shown in `NearbyWifiPermission` dialog.
* Removed the unused and extra translation from project.
2024-02-26 12:05:43 +05:30
MohitMaliFtechiz
e6b10c03d4 Resolved the issue where discovering peers did not automatically start after granting the NEARBY_WIFI_DEVICES permission on Android 13 like it starts after giving the ACCESS_FINE_LOCATION on below Android 13. 2024-02-26 11:42:28 +05:30
MohitMaliFtechiz
1083a86f42 Fixed: Security and trust issue reported by the playStore.
* Removed the `ACCESS_COARSE_LOCATION` from the application as it is unnecessary in project. Since this permission was used in the ZimHostFragment to host the ZIM files on server, but this permission is not required for this feature. Hence, we have removed this permission from project.
* Removed this permission from test cases.
* Removed the unused code from project related to this permission.
2024-02-26 11:42:19 +05:30
MohitMaliFtechiz
69392506bf Fixed: Selected files count is not showing initially in LocalLibrary screen.
* Initially `ActionMode` is null when we are selecting ZIM files that's why it is not showing the selected book count in the ActionMode title. So to fix this we are setting the value when the actionMode is created.
2024-02-25 21:00:35 +01:00
translatewiki.net
ebdc5443fe Localisation updates from https://translatewiki.net. 2024-02-22 19:04:26 +01:00
MohitMaliFtechiz
211056c4ff Fixed the close tab icon size issue.
* Created an extension function to set up the SearchView. It now configures the toolTipText and width for the close icon of the SearchView.
* With this extension function, we have applied these properties to every SearchView used in the application, such as in LanguageFragment, SearchFragment, (History/Bookmark/Notes), and OnlineLibraryFragment.
2024-02-21 13:13:43 +05:30
MohitMaliFtechiz
e860cf9aa0 Fixed: Addressed the touch target size issue reported by the Play Store.
* Increased the height and width of the views to align with Play Store policies, while ensuring no impact on the UI (as illustrated in the images below).
2024-02-21 13:05:59 +05:30
MohitMaliFtechiz
31cefdc1a9 Fixed: Low contrast issue reported by the PlayStore.
* Enhanced the contrast of the `mine_shaft_gray600` color to comply with Play Store's recommendation of `4.50.1`. This color is utilized in the book's itemView.
* Implemented the updated color in `IntroScreens` subHeading to resolve the low contrast issue.
* To rectify the contrast issue in the `LanguageFragment`, we increased the opacity of views to align with the recommended contrast.
2024-02-21 07:00:39 +01:00
MohitMaliFtechiz
046f10f465 Added contentDescription for all backButtons/closeButtons of toolbar.
* Added `contentDescription` for "+" button in TabSwitcher.
2024-02-21 06:59:01 +01:00
MohitMaliFtechiz
0b7756cf57 Fixed: Content labeling issue reported by the playstore.
* Added content descriptions for all views reported by the Play Store, including RecyclerView, dialog's itemView, pause/resume/stop buttons, and many more.
* Created an extension function to handle both setting the content description to address Play Store accessibility issues and displaying hints to the user using ToolTipText. This function consolidates these tasks in one place, eliminating code duplication.
2024-02-21 06:59:01 +01:00
MohitMaliFtechiz
da897a104e Fixed: Added the ability to press Enter to expedite the search.
* If the search/enter button is pressed and an article is found with the same query, it will directly open that article. Otherwise, it will proceed with the regular search operation as before.
2024-02-16 08:28:12 +01:00
MohitMaliFtechiz
287503746e Fixed: Version 3.9.1 experienced occasional crashes when setting the SuggestionSearcher.
* The crashes occurred in the Play Store version due to insufficient permissions for opening a file via `fileDescriptor`. To address this issue, we have modified the implementation to use the `file` instead of `fileDescriptor`. This adjustment ensures smooth operation in the non-Play Store version where we have permission to open a file via its path. In the Play Store version, it will display a proper error message to the user, preventing errors thrown by libkiwix.
2024-02-07 11:29:50 +01:00
MohitMaliFtechiz
81994805b7 Upgraded java-libkiwix to 2.0.0
* Re-enabled test case for migrating bookmarks more then 512 to test it properly on API level 24.
2024-02-07 11:44:56 +05:30
MohitMaliFtechiz
1460e0d4e5 Fixed Migration test was failing on the API level 24. 2024-02-07 11:44:28 +05:30
MohitMaliFtechiz
ed2a9e0ec9 Fixed the failing LibkiwixBookmarkTest on Android 33 and 30. 2024-02-07 11:44:16 +05:30
MohitMaliFtechiz
50f92beeb1 Fixed the failing LibkiwixBookmarkTest.
* Enhanced the process of adding books to the library to prevent unnecessary data loading from libkiwix.
* Released the memory occupied by bookmarks and archives to resolve potential issues when running migrations on lower-end devices.
2024-02-07 11:44:08 +05:30
MohitMaliFtechiz
99cf75bf59 Improved the large data migration.
* Refined test cases to thoroughly assess the migration process.
* Enhanced the migration logic to effectively manage large datasets during migration.
* Optimized the Bookmark functionality to minimize unnecessary data loading on libkiwix. Retrieving data from libkiwix is now performed only when there is a change in the bookmark, reducing redundant data fetches. Otherwise, the previously loaded data is returned to minimize unnecessary resource access.
2024-02-07 11:44:00 +05:30
MohitMaliFtechiz
efd8caf244 Enhanced the migration process to handle exceptions more effectively. 2024-02-07 11:43:47 +05:30
MohitMaliFtechiz
f45e321655 Refactored the test cases.
* Improved the instrumentation test cases.
* Improved the migration test case.
2024-02-07 11:43:37 +05:30
MohitMali
a78c4562f2 Removed the unnecessary wrapper classes of libkiwix from the codebase since we don't need these classes as saving/deleting functionality will be tested in java-libkiwix.
* Added instrumentation test case for testing the UI part with libkiwix bookmark functionality.
2024-02-07 11:34:33 +05:30
MohitMaliFtechiz
94a529cdf9 Introducing the writeFile method of the Library class allows us to save the library, which contains information about books, their file paths, and favicons, into a file.
* We now save this library information into a file named `library.txt` and subsequently read from it to retrieve file paths and favicons.
* The test cases have been refactored to accommodate this new functionality.
* The `ObjectBoxToLibkiwiMigrator` code has also been enhanced. With this change, we now save books in the library for their favicon and zimFilePath, resulting in a refactor and improvement of this class's functionality and its associated test cases.
* The process of writing bookmarks and library data to file has been enhanced. Now, this is performed asynchronously in a background thread to mitigate potential data loss.
* Additionally, several other improvements have been made throughout the codebase.
2024-02-07 11:34:21 +05:30