Skip to content

Commit

Permalink
Merge branch 'release/5.190.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
daxtheduck committed Feb 22, 2024
2 parents 974244a + 118d282 commit 97bb029
Show file tree
Hide file tree
Showing 201 changed files with 3,487 additions and 1,114 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/e2e-nightly-autofill.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Autofill Feature Critical Path End-to-End tests

on:
schedule:
- cron: '30 6 * * *' # run at 6.30 AM UTC
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
instrumentation_tests:
runs-on: ubuntu-latest
name: Autofill Critical Path End-to-End Tests

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'

- name: Create folder
if: always()
run: mkdir apk

- name: Decode keys
uses: davidSchuppa/base64Secret-toFile-action@v2
with:
secret: ${{ secrets.FAKE_RELEASE_PROPERTIES }}
fileName: ddg_android_build.properties
destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/

- name: Decode key file
uses: davidSchuppa/base64Secret-toFile-action@v2
with:
secret: ${{ secrets.FAKE_RELEASE_KEY }}
fileName: android
destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/

- name: Assemble APK which does not require auth to use Autofill
uses: gradle/gradle-build-action@v2
with:
arguments: assemblePlayRelease -Pautofill-disable-auth-requirement -Pforce-default-variant -x lint

- name: Move APK to new folder
if: always()
run: find . -name "*.apk" -exec mv '{}' apk/release.apk \;

- name: Autofill Critical Path E2E Flows
uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
app-file: apk/release.apk
android-api-level: 30
workspace: .maestro
include-tags: autofillNoAuthTests

- name: Create Asana task when workflow failed
if: ${{ failure() }}
id: create-failure-task
uses: duckduckgo/[email protected]
with:
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
asana-project: ${{ vars.GH_ANDROID_APP_PROJECT_ID }}
asana-section: ${{ vars.GH_ANDROID_APP_INCOMING_SECTION_ID }}
asana-task-name: GH Workflow Failure - Autofill Critical Path E2E Flows
asana-task-description: Autofill critical path tests have failed. See https://github.com/duckduckgo/Android/actions/runs/${{ github.run_id }}
action: 'create-asana-task'
13 changes: 3 additions & 10 deletions .maestro/autofill/0_all.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
appId: com.duckduckgo.mobile.android
name: "Autofill: Run all tests"
tags:
- autofillNoAuthTests
---
# Pre-requisite: the app is installed on an autofill-eligible device with a special build flag set to bypass device-authentication requirement
# This should only be run locally, as Maestro cloud will likely timeout trying to run them all as one flow.

- launchApp:
clearState: true
- runFlow: ../shared/onboarding.yaml
- runFlow: 1_autofill_shown_in_overflow.yaml

# Everything below requires a device has device-level authentication set (e.g., a PIN/Password etc...)
- runFlow: 2_autofill_reach_creds_management.yaml
- runFlow: 3_autofill_manually_add_cred.yaml
- runFlow: 4_search_logins.yaml
- runFlow: 5_autofill_manually_updating_an_existing_credential.yaml
- runFlow: 6_delete_logins.yaml
- runFlow: 7_autofill_prompted_to_save_creds_on_form.yaml
- runFlow: 2_autofill_add_search_update_delete_creds.yaml
- runFlow: 3_autofill_prompted_to_save_creds_on_form.yaml
12 changes: 7 additions & 5 deletions .maestro/autofill/1_autofill_shown_in_overflow.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
appId: com.duckduckgo.mobile.android
name: "Autofill: Autofill screen is reachable from overflow menu"
tags:
- autofillNoAuthTests
---
# Pre-requisite: the user has cleared onboarding and is on the new tab page
# Pre-requisite: None (can be run whether auth is required or not)

- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- assertVisible: "Passwords"
- tapOn: "Passwords"
- launchApp:
clearState: true
- runFlow: ../shared/onboarding.yaml
- runFlow: steps/access_passwords_screen.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
appId: com.duckduckgo.mobile.android
name: "Autofill: Manually add credentials"
tags:
- autofillNoAuthTests
---
# Pre-requisite: the user is viewing the password manager screen with no saved passwords, on an autofill-eligible device
# Pre-requisite: on an autofill-eligible device

- runScript: 3_script.js
- launchApp:
clearState: true
- runFlow: ../shared/onboarding.yaml
- runFlow: steps/access_passwords_screen.yaml

- assertVisible:
text: "No passwords saved yet"
- assertNotVisible:
id: searchLogins

- runScript: steps/2_script.js

- repeat:
while:
Expand Down Expand Up @@ -60,4 +72,9 @@ name: "Autofill: Manually add credentials"
text: "fill.dev"

- assertNotVisible:
text: "fill.dev/example"
text: "fill.dev/example"


- runFlow: steps/search_logins.yaml
- runFlow: steps/manual_update.yaml
- runFlow: steps/delete_logins.yaml
9 changes: 0 additions & 9 deletions .maestro/autofill/2_autofill_reach_creds_management.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
appId: com.duckduckgo.mobile.android
name: "Autofill: Prompted to save and update credentials on web form"
tags:
- autofillNoAuthTests
---
# Pre-requisite: the user is viewing the new tab screen, on an autofill-eligible device
# Pre-requisite: on an autofill-eligible device

- launchApp:
clearState: true
- runFlow: ../shared/onboarding.yaml

- tapOn:
text: "search or type URL"
id: "omnibarTextInput"
- eraseText
- inputText: "fill.dev/form/login-simple"
- pressKey: enter
Expand Down Expand Up @@ -32,9 +38,9 @@ name: "Autofill: Prompted to save and update credentials on web form"
text: "Login"
- assertVisible: "Update Password"
- tapOn: "Update Password"
- tapOn:
id: "browserMenu"
- tapOn: "Passwords"

- runFlow: steps/access_passwords_screen.yaml

- tapOn: "user"
- tapOn:
id: "internal_password_icon"
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions .maestro/autofill/steps/access_passwords_screen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
appId: com.duckduckgo.mobile.android
name: "Autofill: Autofill screen is reachable from overflow menu"
---
# Pre-requisite: the user has cleared onboarding and is on the new tab page

- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- assertVisible: "Passwords"
- tapOn: "Passwords"
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,4 @@ name: "Autofill: Delete credentials"
- tapOn: "Delete"

- assertVisible:
text: "No passwords saved yet"

- tapOn: "Navigate up"
text: "No passwords saved yet"
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions .maestro/sync_flows/create_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ tags:
timeout: 5000
- tapOn: "Next"
- tapOn: "Done"
- assertVisible:
id: "com.duckduckgo.mobile.android:id/qrCodeImageView"
- assertVisible: "Synced Devices"
2 changes: 1 addition & 1 deletion .maestro/sync_flows/delete_server_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ tags:
direction: DOWN
- assertVisible: "Turn Off and Delete Server Data…"
- tapOn: "Turn Off and Delete Server Data…"
- tapOn: "Turn Off"
- tapOn: "Delete Data"
- assertVisible: "Sync and Back Up This Device"
10 changes: 7 additions & 3 deletions .maestro/sync_flows/recover_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ tags:
clearState: true
stopApp: true
- runFlow: create_account.yaml
- tapOn: "Show Text Code"
- copyTextFrom:
id: "com.duckduckgo.mobile.android:id/recoveryCode"
- tapOn: "Sync With Another Device"
- runFlow:
when:
visible: "Don't allow"
commands:
- tapOn: "Don't allow"
- tapOn: "Can't Scan? Share Text Code"
- tapOn: "Navigate up"
- tapOn: "Turn Off Sync & Backup…"
- tapOn: "Turn Off"
Expand Down
14 changes: 12 additions & 2 deletions .maestro/sync_flows/steps/action_add_bookmarks_and_folders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,20 @@ appId: com.duckduckgo.mobile.android
- tapOn:
id: "com.duckduckgo.mobile.android:id/item_container"
index: 1
- tapOn:
id: "com.duckduckgo.mobile.android:id/touch_outside"
- runFlow:
when:
visible:
id: "com.duckduckgo.mobile.android:id/touch_outside"
commands:
- tapOn:
id: "com.duckduckgo.mobile.android:id/touch_outside"
# Now, we create a new folder
- runFlow: ../../shared/open_bookmarks.yaml
- runFlow:
when:
visible: "Download Missing Icons?"
commands:
- tapOn: "Not Now"
- tapOn: "Add Folder"
- tapOn: "Title"
- inputText: "${output.bookmarks.folders[0]}"
Expand Down
3 changes: 1 addition & 2 deletions .maestro/sync_flows/steps/action_add_new_device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ name: "Sync Critical Path: Devices can be added to an existing account"
text: "Sync & Backup"
direction: UP
- tapOn: "Sync & Backup"
- assertVisible:
id: "com.duckduckgo.mobile.android:id/qrCodeImageView"
- assertVisible: "Synced Devices"
- tapOn: "Navigate up"
- tapOn: "Navigate up"
3 changes: 1 addition & 2 deletions .maestro/sync_flows/steps/action_recover_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ appId: com.duckduckgo.mobile.android
timeout: 5000
- tapOn: "Next"
- tapOn: "Done"
- assertVisible:
id: "com.duckduckgo.mobile.android:id/qrCodeImageView"
- assertVisible: "Synced Devices"
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.duckduckgo.adclick.store.AdClickDatabase.Companion.ALL_MIGRATIONS
import com.duckduckgo.adclick.store.AdClickFeatureToggleRepository
import com.duckduckgo.adclick.store.RealAdClickAttributionRepository
import com.duckduckgo.app.di.AppCoroutineScope
import com.duckduckgo.app.di.IsMainProcess
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.di.scopes.AppScope
import com.squareup.anvil.annotations.ContributesTo
Expand Down Expand Up @@ -51,8 +52,9 @@ class AdClickModule {
database: AdClickDatabase,
@AppCoroutineScope appCoroutineScope: CoroutineScope,
dispatcherProvider: DispatcherProvider,
@IsMainProcess isMainProcess: Boolean,
): AdClickAttributionRepository {
return RealAdClickAttributionRepository(database, appCoroutineScope, dispatcherProvider)
return RealAdClickAttributionRepository(database, appCoroutineScope, dispatcherProvider, isMainProcess)
}

@SingleInstanceIn(AppScope::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class RealAdClickAttributionRepository(
val database: AdClickDatabase,
coroutineScope: CoroutineScope,
dispatcherProvider: DispatcherProvider,
isMainProcess: Boolean,
) : AdClickAttributionRepository {

private val adClickAttributionDao: AdClickDao = database.adClickDao()
Expand All @@ -49,7 +50,9 @@ class RealAdClickAttributionRepository(

init {
coroutineScope.launch(dispatcherProvider.io()) {
loadToMemory()
if (isMainProcess) {
loadToMemory()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class RealAdClickAttributionRepositoryTest {
database = mockDatabase,
coroutineScope = TestScope(),
dispatcherProvider = coroutineRule.testDispatcherProvider,
isMainProcess = true,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ class ContributesRemoteFeatureCodeGenerator : CodeGenerator {
val concatMethodNames = this.feature.get().javaClass
.declaredMethods
.map { it.name }
.sorted()
.joinToString(separator = "")
val hash = %T().writeUtf8(concatMethodNames).md5().hex()
return hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FakeVpnNetworkStack(override val name: String) : VpnNetworkStack {
}

override suspend fun onPrepareVpn(): Result<VpnNetworkStack.VpnTunnelConfig> {
return Result.success(VpnNetworkStack.VpnTunnelConfig(1500, emptyMap(), emptySet(), emptyMap(), emptySet()))
return Result.success(VpnNetworkStack.VpnTunnelConfig(1500, emptyMap(), emptySet(), emptySet(), emptyMap(), emptySet()))
}

override fun onStartVpn(tunfd: ParcelFileDescriptor): Result<Unit> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ interface VpnNetworkStack {
val mtu: Int,
val addresses: Map<InetAddress, Int>,
val dns: Set<InetAddress>,
val customDns: Set<InetAddress>,
val routes: Map<String, Int>,
val appExclusionList: Set<String>,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class NgVpnNetworkStack @Inject constructor(
InetAddress.getByName("fd00:1:fd00:1:fd00:1:fd00:1") to 128, // Add IPv6 Unique Local Address
),
dns = getDns(),
customDns = emptySet(),
routes = emptyMap(),
appExclusionList = trackingProtectionAppsRepository.getExclusionAppsList().toSet(),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ class TrackerBlockingVpnService : VpnService(), CoroutineScope by MainScope(), V
logcat { "VPN log: NEW network ${vpnNetworkStack.name}" }
}
dnsChangeCallback.unregister()
// cancel previous monitor
alwaysOnStateJob.cancel()

vpnServiceStateStatsDao.insert(createVpnState(state = ENABLING))

Expand Down Expand Up @@ -443,7 +445,9 @@ class TrackerBlockingVpnService : VpnService(), CoroutineScope by MainScope(), V
allowFamily(AF_INET6)
}

val dnsToConfigure = checkAndReturnDns(tunnelConfig.dns)
val tunnelDns = checkAndReturnDns(tunnelConfig.dns)
val customDns = checkAndReturnDns(tunnelConfig.customDns).filterIsInstance<Inet4Address>()
val dnsToConfigure = customDns.ifEmpty { tunnelDns }

// TODO: eventually routes will be set by remote config
if (appBuildConfig.isPerformanceTest && appBuildConfig.isInternalBuild()) {
Expand Down
Loading

0 comments on commit 97bb029

Please sign in to comment.