Skip to content

Commit

Permalink
chore: fix e2e failure on not finding the info button randomly (#1157)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexey Alter-Pesotskiy <[email protected]>
  • Loading branch information
santhoshvai and testableapple authored Oct 24, 2023
1 parent b9dc360 commit 10e2c2d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const ParticipantsInfoBadge = ({
},
participantInfoBadge.participantCountContainer,
]}
testID={ButtonTestIds.PARTICIPANTS_COUNT_VIEW}
>
<Text
style={[
Expand All @@ -90,6 +91,7 @@ export const ParticipantsInfoBadge = ({
typefaces.subtitle,
participantInfoBadge.participantsCountText,
]}
testID={ButtonTestIds.PARTICIPANTS_COUNT_TEXT}
>
{count}
</Text>
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-sdk/src/constants/TestIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export enum ComponentTestIds {

export enum ButtonTestIds {
PARTICIPANTS_INFO = 'participants-info-button',
PARTICIPANTS_COUNT_VIEW = 'participants-count-view',
PARTICIPANTS_COUNT_TEXT = 'participants-count-text',
HANG_UP_CALL = 'hang-up-call',
REACTION = 'call-controls-reaction',
}
Expand Down
14 changes: 2 additions & 12 deletions sample-apps/react-native/dogfood/e2e/js/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,17 @@ output.pages = {
chooseFlowButton: 'choose-mode',
logOutButton: 'log-out',
confirmSignOutButton: 'OK',
signOutModalTitle: 'Sign out as.*',
},
lobby: {
joinButton: 'Join',
},
activeCall: {
participantsInfoButton: 'participants-info-button',
participantsCount: 'participants-count-.*',
hangupButton: 'hang-up-call',
},
participantsInfo: {
exitButton: 'exit-participants-info',
},
};
output.assertions = {
participantsInfo: {
participantsCountIs1: 'Participants (1)',
participantsCountIs6: 'Participants (6)',
},
joinMeeting: {
signOutModalTitle: 'Sign out as.*',
},
login: {
customUserInputField: 'Enter custom user',
},
};
11 changes: 11 additions & 0 deletions sample-apps/react-native/dogfood/e2e/js/sleep.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(function (sec) {
var duration = sec * 1000;
var now = new Date().getTime();
while (new Date().getTime() < now + duration) {
/* sleep */
}
})(
seconds !== undefined && seconds !== null && typeof seconds === 'number'
? seconds
: 5,
);
23 changes: 15 additions & 8 deletions sample-apps/react-native/dogfood/e2e/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ appId: io.getstream.rnvideosample
---
- runScript: js/setup.js
- launchApp
#- waits for ios system alert to pop up, then waits for maestro to handle it
- runScript:
file: js/sleep.js
env:
seconds: 5
#- Log in as a custom user
- tapOn: ${output.pages.login.customUserInputField}
- inputText: ${output.pages.login.userName}
Expand All @@ -15,9 +20,11 @@ appId: io.getstream.rnvideosample
#- Join the call
- tapOn: ${output.pages.lobby.joinButton}
#- Assert that user is alone in the call
- tapOn:
id: ${output.pages.activeCall.participantsInfoButton}
- assertVisible: ${output.assertions.participantsInfo.participantsCountIs1}
- extendedWaitUntil:
visible:
text: "1"
id: ${output.pages.activeCall.participantsCount}
timeout: 80000
#- Add 5 participants to the call via Stream Video Buddy CLI
- runScript:
file: js/videoBuddy.js
Expand All @@ -28,10 +35,10 @@ appId: io.getstream.rnvideosample
camera: true
#- Assert that there are 6 participants in the call
- extendedWaitUntil:
visible: ${output.assertions.participantsInfo.participantsCountIs6}
visible:
text: "6"
id: ${output.pages.activeCall.participantsCount}
timeout: 80000
- longPressOn:
id: ${output.pages.participantsInfo.exitButton}
#- Leave the call
- tapOn:
id: ${output.pages.activeCall.hangupButton}
Expand All @@ -40,7 +47,7 @@ appId: io.getstream.rnvideosample
id: ${output.pages.joinMeeting.chooseFlowButton}
- tapOn:
id: ${output.pages.joinMeeting.logOutButton}
- assertVisible: ${output.assertions.joinMeeting.signOutModalTitle}
- assertVisible: ${output.pages.joinMeeting.signOutModalTitle}
- tapOn: ${output.pages.joinMeeting.confirmSignOutButton}
#- Assert that user is logged out
- assertVisible: ${output.assertions.login.customUserInputField}
- assertVisible: ${output.pages.login.customUserInputField}

0 comments on commit 10e2c2d

Please sign in to comment.