Skip to content

Commit

Permalink
bug/9746-rachael-detox-fix-nightly-build-errors (#9747)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbontrager authored Oct 4, 2024
1 parent de30b5a commit 7650bd2
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/e2e_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ jobs:
id: run_e2e_tests
run: |
if [[ "${{needs.output_detox_tests_to_run.outputs.output2}}" == "" ]]; then
yarn e2e:ios-test /e2e/tests/${{matrix.testsuite}} --updateSnapshot
yarn e2e:ios-test /e2e/tests/${{matrix.testsuite}} --updateSnapshot --debug-synchronization 15000
echo "NAV_AF_TEST_RUN=" >> "$GITHUB_OUTPUT"
else
echo "NAV_AF_TEST_RUN=true" >> "$GITHUB_OUTPUT"
yarn e2e:ios-test /e2e/tests/Navigation.e2e AvailabilityFramework.e2e ${{matrix.testsuite}}.e2e --updateSnapshot
yarn e2e:ios-test /e2e/tests/Navigation.e2e AvailabilityFramework.e2e ${{matrix.testsuite}}.e2e --updateSnapshot --debug-synchronization 15000
fi
continue-on-error: true

Expand All @@ -206,9 +206,9 @@ jobs:
run: |
yarn jest:clear;
if [[ "${{ steps.run_e2e_tests.outputs.NAV_AF_TEST_RUN}}" != "" ]]; then
yarn e2e:ios-test /e2e/tests/Navigation.e2e AvailabilityFramework.e2e ${{matrix.testsuite}}.e2e --updateSnapshot
yarn e2e:ios-test /e2e/tests/Navigation.e2e AvailabilityFramework.e2e ${{matrix.testsuite}}.e2e --updateSnapshot --debug-synchronization 15000
else
yarn e2e:ios-test /e2e/tests/${{matrix.testsuite}} --updateSnapshot
yarn e2e:ios-test /e2e/tests/${{matrix.testsuite}} --updateSnapshot --debug-synchronization 15000
fi
- name: Upload e2e-junit
Expand Down
1 change: 1 addition & 0 deletions VAMobile/e2e/tests/Appeals.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ describe('Appeals', () => {
await device.launchApp({ newInstance: false })
await device.disableSynchronization()
await element(by.id(CommonE2eIdConstants.GO_TO_VA_GOV_LINK_ID)).tap()
await setTimeout(2000)
await element(by.text(CommonE2eIdConstants.LEAVING_APP_LEAVE_TEXT)).tap()
await setTimeout(5000)
await device.takeScreenshot('AppealsNeedHelpGoToVAScreen')
Expand Down
12 changes: 12 additions & 0 deletions VAMobile/e2e/tests/LoginScreen.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ export const LoginE2eIdConstants = {

describe('Login Screen', () => {
it('should show login page content', async () => {
try {
await waitFor(element(by.id(CommonE2eIdConstants.VA_LOGO_ICON_ID)))
.toExist()
.withTimeout(120000)
} catch (ex) {
await device.uninstallApp()
await device.installApp()
await device.launchApp({ newInstance: true, permissions: { notifications: 'YES' } })
await waitFor(element(by.id(CommonE2eIdConstants.VA_LOGO_ICON_ID)))
.toExist()
.withTimeout(60000)
}
await waitFor(element(by.id(LoginE2eIdConstants.LOGIN_PAGE_ID)))
.toExist()
.withTimeout(60000)
Expand Down
13 changes: 10 additions & 3 deletions VAMobile/e2e/tests/Messages.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ export const MessagesE2eIdConstants = {
}

const tapItems = async (items: string, type: string) => {
if (type === 'url' || type === 'map' || type === 'email') {
await element(by.id(MessagesE2eIdConstants.VIEW_MESSAGE_ID)).scrollTo('bottom')
}
// if (type === 'url' || type === 'map' || type === 'email') {
// if (items != 'https://www.va.gov/') {
// await element(by.id(MessagesE2eIdConstants.VIEW_MESSAGE_ID)).scrollTo('bottom')
// }
// }
await waitFor(element(by.text(items)))
.toBeVisible()
.whileElement(by.id(MessagesE2eIdConstants.VIEW_MESSAGE_ID))
.scroll(50, 'down')
await device.disableSynchronization()
await element(by.text(items)).tap()
if (type === 'url' || type === 'map') {
Expand Down Expand Up @@ -156,6 +162,7 @@ describe('Messages Screen', () => {
await tapItems('+18006982411', 'phone')
await tapItems('1-800-698-2411.', 'phone')
})

//Currently broken on iOS. Will be fixed with ticket 7679
it(':android: verify url links open', async () => {
await tapItems('https://www.va.gov/', 'url')
Expand Down
2 changes: 1 addition & 1 deletion VAMobile/e2e/tests/PushNotifications.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe(':ios: Push Notifications', () => {
newInstance: true,
userNotification: mockNotification,
})
await loginToDemoMode()
await loginToDemoMode(true, true)
await waitFor(element(by.text(PushNotificationsConstants.REVIEW_MESSAGE_SCREEN_TITLE)))
.toExist()
.withTimeout(8000)
Expand Down
15 changes: 12 additions & 3 deletions VAMobile/e2e/tests/SignIn.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@ export const SignE2eIdConstants = {

describe('Sign In', () => {
it('should show sign in page content', async () => {
await waitFor(element(by.id(SignE2eIdConstants.LOGIN_PAGE_ID)))
.toExist()
.withTimeout(20000)
try {
await waitFor(element(by.id(CommonE2eIdConstants.VA_LOGO_ICON_ID)))
.toExist()
.withTimeout(120000)
} catch (ex) {
await device.uninstallApp()
await device.installApp()
await device.launchApp({ newInstance: true, permissions: { notifications: 'YES' } })
await waitFor(element(by.id(CommonE2eIdConstants.VA_LOGO_ICON_ID)))
.toExist()
.withTimeout(60000)
}

await element(by.id(CommonE2eIdConstants.SIGN_IN_BTN_ID)).tap()
await expect(element(by.text(CommonE2eIdConstants.VETERAN_CRISIS_LINE_BTN_TEXT))).toExist()
Expand Down
42 changes: 31 additions & 11 deletions VAMobile/e2e/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ const fs = require('fs')
jestExpect.extend({ toMatchImageSnapshot })

const { DEMO_PASSWORD } = getEnv()
const mockNotification = {
trigger: {
type: 'push',
},
title: 'New Secure Message',
body: 'Review your messages in the health care section of the VA app',
payload: {
url: 'vamobile://messages/2092809',
},
}

export const CommonE2eIdConstants = {
VA_LOGO_ICON_ID: 'va-icon',
Expand Down Expand Up @@ -70,18 +80,28 @@ export const CommonE2eIdConstants = {

/** Log the automation into demo mode
* */
export async function loginToDemoMode(skipOnboarding = true) {
await waitFor(element(by.id(CommonE2eIdConstants.VA_LOGO_ICON_ID)))
.toExist()
.withTimeout(60000)
export async function loginToDemoMode(skipOnboarding = true, pushNotifications?: boolean) {
try {
await element(
by.text(
"[react-native-gesture-handler] Seems like you're using an old API with gesture components, check out new Gestures system!",
),
).tap()
await element(by.text('Dismiss')).tap()
} catch (e) {}
await waitFor(element(by.id(CommonE2eIdConstants.VA_LOGO_ICON_ID)))
.toExist()
.withTimeout(120000)
} catch (ex) {
await device.uninstallApp()
await device.installApp()
if (pushNotifications) {
await device.launchApp({
delete: true,
permissions: { notifications: 'YES' },
newInstance: true,
userNotification: mockNotification,
})
} else {
await device.launchApp({ newInstance: true, permissions: { notifications: 'YES' } })
}
await waitFor(element(by.id(CommonE2eIdConstants.VA_LOGO_ICON_ID)))
.toExist()
.withTimeout(60000)
}
await element(by.id(CommonE2eIdConstants.VA_LOGO_ICON_ID)).multiTap(7)

if (DEMO_PASSWORD !== undefined) {
Expand Down

0 comments on commit 7650bd2

Please sign in to comment.