-
Notifications
You must be signed in to change notification settings - Fork 20
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
[VBLOCKS-1715] feat: outgoing call test #64
Changes from 6 commits
ba4b370
02a0cb3
ac4b46c
62c1d89
530fb38
7e35563
42508f2
d4a9a8e
26cd3c0
577b789
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { by, element, expect, waitFor, device } from 'detox'; | ||
|
||
describe('Outgoing Call', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's continue the discussion here regarding the following test case, so we can separate the thread
I don't think we need to. We can just wait until the current call times out? It's only 10s long right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes call is only 10s. Ok will add a 12s timer to make sure call is no longer in progress |
||
beforeAll(async () => { | ||
await global.device.launchApp(); | ||
}); | ||
|
||
const navigateToDialer = async () => { | ||
await element(by.id('login_button')).tap(); | ||
await element(by.id('dialer_button')).tap(); | ||
}; | ||
|
||
beforeEach(async () => { | ||
await global.device.reloadReactNative(); | ||
await navigateToDialer(); | ||
}); | ||
|
||
it('should allow user to enter PTSN number', async () => { | ||
await element(by.id('dialpad_button_1')).tap(); | ||
await element(by.id('dialpad_button_2')).tap(); | ||
await element(by.id('dialpad_button_3')).tap(); | ||
await element(by.id('dialpad_button_4')).tap(); | ||
await element(by.id('dialpad_button_4')).tap(); | ||
await element(by.id('dialpad_button_4')).tap(); | ||
await element(by.id('dialpad_button_8')).tap(); | ||
await element(by.id('dialpad_button_8')).tap(); | ||
await element(by.id('dialpad_button_8')).tap(); | ||
await element(by.id('dialpad_button_8')).tap(); | ||
await expect(element(by.id('formatted_number'))).toHaveText('+1234448888'); | ||
}); | ||
|
||
it('should allow user to enter Client-ID', async () => { | ||
await element(by.text('Client')).tap(); | ||
await element(by.id('client_text_input')).typeText('Client-Web'); | ||
await expect(element(by.id('client_text_input'))).toHaveText('Client-Web'); | ||
}); | ||
|
||
if (device.getPlatform() === 'android') { | ||
describe('Android: successful connect', () => { | ||
it('should make a successful PTSN call', async () => { | ||
await element(by.id('dialpad_button_3')).tap(); | ||
await element(by.id('dialpad_button_1')).tap(); | ||
await element(by.id('dialpad_button_5')).tap(); | ||
await element(by.id('dialpad_button_6')).tap(); | ||
await element(by.id('dialpad_button_7')).tap(); | ||
await element(by.id('dialpad_button_0')).tap(); | ||
await element(by.id('dialpad_button_3')).tap(); | ||
await element(by.id('dialpad_button_5')).tap(); | ||
await element(by.id('dialpad_button_4')).tap(); | ||
await element(by.id('dialpad_button_1')).tap(); | ||
await element(by.id('call_button')).tap(); | ||
await waitFor(element(by.id('active_call'))).toBeVisible(); | ||
await waitFor(element(by.id('call_status'))).toHaveText('ringing'); | ||
await waitFor(element(by.id('call_status'))).toHaveText('00:05'); | ||
charliesantos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
await waitFor(element(by.id('active_call'))).not.toBeVisible(); | ||
}); | ||
}); | ||
|
||
describe('disconnect', () => { | ||
it('should disconnect if invalid number', async () => { | ||
await element(by.id('dialpad_button_1')).tap(); | ||
await element(by.id('dialpad_button_2')).tap(); | ||
await element(by.id('dialpad_button_3')).tap(); | ||
await element(by.id('call_button')).tap(); | ||
await waitFor(element(by.id('active_call'))).toBeVisible(); | ||
await waitFor(element(by.id('call_status'))).toHaveText('ringing'); | ||
await waitFor(element(by.id('call_status'))).toHaveText('disconnected'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also check that the call gets disconnected right away? It should get disconnected in less than 3s, is that correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it can be right away, since the UI still needs time to switch Views. That is why I used a waitFor, since without it the test fails. Where does the 3s come from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By "right away" I mean, it should not feel like it's stuck. 3s is just an estimate. What we want is, we need to fail this test if it exceeds a certain threshold. For example, if it does not disconnect after 20s, there must be something wrong. 20s is too extreme, so I estimated around 3s. How long do you think we should wait before we consider this as a fail? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get what you mean now. Okay will add another testcase. 3s sounds like a good time to me 👍 |
||
await waitFor(element(by.id('active_call'))).not.toBeVisible(); | ||
}); | ||
|
||
it('should disconnect if invalid Client-ID', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, we should check that the call has been disconnected right away. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disconnect still doesn't happen right away. We still have the user see texts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as my response here #64 (comment) |
||
await element(by.text('Client')).tap(); | ||
await element(by.id('client_text_input')).typeText('hi\n'); | ||
await element(by.id('call_button')).tap(); | ||
await waitFor(element(by.id('active_call'))).toBeVisible(); | ||
await waitFor(element(by.id('call_status'))).toHaveText('ringing'); | ||
await waitFor(element(by.id('call_status'))).toHaveText('disconnected'); | ||
await waitFor(element(by.id('active_call'))).not.toBeVisible(); | ||
}); | ||
}); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's continue the discussion here regarding the following test case, so we can separate the thread
Clicking the end button behaves the same as when the call is disconnected correct? Can we assert that the active call screen is not visible anymore and that it will transition to the next screen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had tried various methods earlier in the week, so I didn't think this was possible. But I tried a few more methods yesterday and today, now I have one that works. I have now included a test for your test case.