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

@perunt/e2e fix empty account 2 #25

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
const handleViewableItemsChanged = useMemo(
() =>
({viewableItems}: {viewableItems: ViewToken[]}) => {
console.log('ROOT.onViewableItemsChanged', JSON.stringify(viewableItems?.at(0)));

Check failure on line 18 in src/components/InvertedFlatList/BaseInvertedFlatList/index.e2e.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unexpected console statement

Check failure on line 18 in src/components/InvertedFlatList/BaseInvertedFlatList/index.e2e.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unexpected console statement
DeviceEventEmitter.emit('onViewableItemsChanged', viewableItems);
},
[],
Expand Down
1 change: 1 addition & 0 deletions src/libs/E2E/reactNativeLaunchingTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const tests: Tests = {
[E2EConfig.TEST_NAMES.ChatOpening]: require<TestModule>('./tests/chatOpeningTest.e2e').default,
[E2EConfig.TEST_NAMES.ReportTyping]: require<TestModule>('./tests/reportTypingTest.e2e').default,
[E2EConfig.TEST_NAMES.Linking]: require<TestModule>('./tests/linkingTest.e2e').default,
[E2EConfig.TEST_NAMES.ChatRerenering]: require<TestModule>('./tests/chatRerenderingTest.e2e').default,
};

// Once we receive the TII measurement we know that the app is initialized and ready to be used:
Expand Down
10 changes: 6 additions & 4 deletions src/libs/E2E/tests/linkingTest.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@

// update the last visible message
lastVisibleMessageId = res?.at(0)?.item?.reportActionID;
console.debug('[E2E] Current visible message:', lastVisibleMessageId);

console.debug('[E2E] Current visible message:', lastVisibleMessageId, verificationStarted, linkedReportActionID);
console.log('TEST_onViewableItemsChanged.1', JSON.stringify(res?.at(0)?.item, null, 2));

Check failure on line 48 in src/libs/E2E/tests/linkingTest.e2e.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Unexpected console statement

Check failure on line 48 in src/libs/E2E/tests/linkingTest.e2e.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unexpected console statement
if (!verificationStarted && lastVisibleMessageId === linkedReportActionID) {
console.debug('[E2E] Target message found, starting verification');
verificationStarted = true;

console.log('TEST_onViewableItemsChanged.2');

Check failure on line 53 in src/libs/E2E/tests/linkingTest.e2e.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Unexpected console statement

Check failure on line 53 in src/libs/E2E/tests/linkingTest.e2e.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unexpected console statement
setTimeout(() => {
console.debug('[E2E] Verification timeout completed');
console.debug('[E2E] Last visible message ID:', lastVisibleMessageId);
Expand All @@ -63,11 +64,12 @@
console.debug('[E2E] Linked message not found, failing test!');
E2EClient.submitTestResults({
branch: Config.E2E_BRANCH,
error: 'Linked message not found',
// error: 'Linked message not found',
error: `Linked message not found. Current visible message: ${lastVisibleMessageId}, expected message: ${linkedReportActionID}`,
name: `${name} test can't find linked message`,
}).then(() => E2EClient.submitTestDone());
}
}, 3000);
}, 7000);
}
});

Expand Down
12 changes: 11 additions & 1 deletion src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import clearReportNotifications from '@libs/Notification/clearReportNotifications';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import Performance from '@libs/Performance';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
Expand Down Expand Up @@ -284,11 +285,16 @@
const [transactionThreadReportActions = {}] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`);
const combinedReportActions = ReportActionsUtils.getCombinedReportActions(reportActions, transactionThreadReportID ?? null, Object.values(transactionThreadReportActions));
const lastReportAction = [...combinedReportActions, parentReportAction].find((action) => ReportUtils.canEditReportAction(action) && !ReportActionsUtils.isMoneyRequestAction(action));
const isSingleTransactionView = ReportUtils.isMoneyRequest(report) || ReportUtils.isTrackExpenseReport(report);

Check failure on line 288 in src/pages/home/ReportScreen.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unexpected console statement

Check failure on line 288 in src/pages/home/ReportScreen.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unexpected console statement
const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? '-1'}`];
const isTopMostReportId = currentReportID === reportIDFromRoute;
const didSubscribeToReportLeavingEvents = useRef(false);

const renderCount = useRef(0);
useEffect(() => {
renderCount.current += 1;
console.log(`+++++++++++ Unique rerenders: SCREEN #${renderCount.current}`);
});
useEffect(() => {
if (!report?.reportID || shouldHideReport) {
wasReportAccessibleRef.current = false;
Expand Down Expand Up @@ -873,9 +879,13 @@
</FullPageNotFoundView>
</ScreenWrapper>
</ReactionListContext.Provider>
</ActionListContext.Provider>

Check failure on line 882 in src/pages/home/ReportScreen.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type '(props: Omit<CurrentReportIDContextValue & ReportScreenNavigationProps, keyof CurrentReportIDContextValue> & RefAttributes<...>) => ReactElement<...> | null' is not assignable to parameter of type 'ComponentType<Record<string, unknown>>'.
);
}

ReportScreen.displayName = 'ReportScreen';
export default withCurrentReportID(memo(ReportScreen, (prevProps, nextProps) => prevProps.currentReportID === nextProps.currentReportID && lodashIsEqual(prevProps.route, nextProps.route)));
const MemoizedReportScreen = memo(ReportScreen, (prevProps, nextProps) => prevProps.currentReportID === nextProps.currentReportID && lodashIsEqual(prevProps.route, nextProps.route));
const WithCurrentReportID = withCurrentReportID(MemoizedReportScreen);

export default Performance.withRenderTrace({id: '<ReportScreen> rendering'})(WithCurrentReportID);
export type {ReportScreenProps, ReportScreenNavigationProps};
8 changes: 8 additions & 0 deletions tests/e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const TEST_NAMES = {
ReportTyping: 'Report typing',
ChatOpening: 'Chat opening',
Linking: 'Linking',
ChatRerenering: 'Chat rerendering',
};

/**
Expand Down Expand Up @@ -100,6 +101,13 @@ export default {
linkedReportID: '5421294415618529',
linkedReportActionID: '2845024374735019929',
},
[TEST_NAMES.ChatRerenering]: {
name: TEST_NAMES.ChatRerenering,
reportScreen: {
autoFocus: false,
},
reportID: '8268282951170052',
},
},
};

Expand Down
Loading