Skip to content
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

[NoQA] fix: handle push-notifications permission granting failure #42060

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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...',
),
),
),
)
);
}
Loading