Skip to content

Commit

Permalink
Merge pull request #42060 from margelo/fix/notification-permissions-h…
Browse files Browse the repository at this point in the history
…andle-failure

[NoQA] fix: handle push-notifications permission granting failure
  • Loading branch information
mountiny authored May 13, 2024
2 parents 3bdb08d + d5d9d02 commit 09a4c05
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/e2e/utils/installApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ export default function (packageName: string, path: string, platform = 'android'
})
// install and grant push notifications permissions right away (the popup may block e2e tests sometimes)
// eslint-disable-next-line @typescript-eslint/no-misused-promises
.finally(() => execAsync(`adb install ${path}`).then(() => execAsync(`adb shell pm grant ${packageName.split('/')[0]} android.permission.POST_NOTIFICATIONS`)))
.finally(() =>
// install the app
execAsync(`adb install ${path}`).then(() =>
// and grant push notifications permissions right away (the popup may block e2e tests sometimes)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
execAsync(`adb shell pm grant ${packageName.split('/')[0]} android.permission.POST_NOTIFICATIONS`).catch((_: ExecException) =>
// in case of error - just log it and continue (if we request this permission on Android < 13 it'll fail because there is no such permission)
Logger.warn(
'Failed to grant push notifications permissions. It might be due to the fact that push-notifications permission type is not supported on this OS version yet. Continue tests execution...',
),
),
),
)
);
}

0 comments on commit 09a4c05

Please sign in to comment.