-
Notifications
You must be signed in to change notification settings - Fork 10
VIDSOL-248: Add PreCall Test page #243
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
Open
behei-vonage
wants to merge
50
commits into
develop
Choose a base branch
from
behei-vonage/precall-testr
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
8537384
implement precall test page, add unit tests, translations
behei-vonage da00e60
// eslint-disable-next-line @cspell/spellchecker
behei-vonage f8bb1d1
usenetwork tests
behei-vonage 4612f06
landing.spec.ts
behei-vonage c925383
try again
behei-vonage 57286c0
eslint
behei-vonage d2e8723
copy-pasta fix
behei-vonage 9b69676
some cleanup
behei-vonage 8c50349
let me push?
behei-vonage f2ae901
renaming
behei-vonage 48768cd
some changes
behei-vonage 167be97
ugh only
behei-vonage 9d11a71
remove comments
behei-vonage eb4c64e
comments
behei-vonage 122cc5b
some more renaming
behei-vonage 281582c
alright redone?
behei-vonage 29754c8
missed this one
behei-vonage b93ee6a
missed this
behei-vonage be78163
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 6d111be
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] bf1826f
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 00619f6
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 8158409
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] bc50736
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] e7d7dae
translate some
behei-vonage dd73b88
Merge branch 'behei-vonage/precall-testr' of github.com:Vonage/vonage…
behei-vonage 5914c5c
one component mui-ed
behei-vonage 53c1dd4
few more mui-ed
behei-vonage db0aacd
testprogress
behei-vonage c420ca2
mui one more thing
behei-vonage ec95dfb
removing console log
behei-vonage f611ca6
Update frontend/src/components/WaitingRoom/UserNameInput/UserNameInpu…
behei-vonage 3c69431
some renaming and configurability
behei-vonage 8b9998e
component rename and test
behei-vonage 0b5eb19
change to mui
behei-vonage ce54f39
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 7a70be4
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] f464fa6
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] b3483ff
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] d4e6b65
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 8a1f3e7
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] e118703
Merge branch 'develop' into behei-vonage/precall-testr
behei-vonage 2c96e14
comma comma comma comma
behei-vonage e14ec25
oh lord
behei-vonage 5702a60
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 293ece8
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 4607d5d
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 9dd0114
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 4571e17
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] 25f711d
Commit screenshot file: integration-tests/tests/visualComparisons.spe…
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,3 +9,4 @@ NOSONAR | |
| jiraiOSComponentId | ||
| supportedLngs | ||
| applinks | ||
| precall | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
203 changes: 203 additions & 0 deletions
203
frontend/src/components/PreCall/ConnectivityResults/ConnectivityResults.spec.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,203 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
| import { beforeEach, describe, expect, it, vi } from 'vitest'; | ||
| import ConnectivityResults from './ConnectivityResults'; | ||
| import { ConnectivityResults as ConnectivityResultsType } from '../../../hooks/useNetworkTest'; | ||
| import enTranslations from '../../../locales/en.json'; | ||
|
|
||
| // Mock react-i18next | ||
| vi.mock('react-i18next', () => ({ | ||
| useTranslation: () => ({ | ||
| t: (key: string) => { | ||
| const translations: Record<string, string> = { | ||
| 'precallTest.connectivityResults': enTranslations['precallTest.connectivityResults'], | ||
| 'precallTest.status': enTranslations['precallTest.status'], | ||
| 'precallTest.success': enTranslations['precallTest.success'], | ||
| 'precallTest.failed': enTranslations['precallTest.failed'], | ||
| 'precallTest.issues': enTranslations['precallTest.issues'], | ||
| }; | ||
| return translations[key] || key; | ||
| }, | ||
| }), | ||
| })); | ||
|
|
||
| describe('ConnectivityResults', () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('renders the connectivity results title', () => { | ||
| const mockResults: ConnectivityResultsType = { | ||
| success: true, | ||
| }; | ||
|
|
||
| render(<ConnectivityResults results={mockResults} />); | ||
|
|
||
| expect(screen.getByText(enTranslations['precallTest.connectivityResults'])).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('displays success status when connectivity test passes', () => { | ||
| const mockResults: ConnectivityResultsType = { | ||
| success: true, | ||
| }; | ||
|
|
||
| render(<ConnectivityResults results={mockResults} />); | ||
|
|
||
| expect( | ||
| screen.getByText((content) => content.includes(enTranslations['precallTest.status'])) | ||
| ).toBeInTheDocument(); | ||
| expect( | ||
| screen.getByText((content) => content.includes(enTranslations['precallTest.success'])) | ||
| ).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('displays failed status when connectivity test fails', () => { | ||
| const mockResults: ConnectivityResultsType = { | ||
| success: false, | ||
| }; | ||
|
|
||
| render(<ConnectivityResults results={mockResults} />); | ||
|
|
||
| expect( | ||
| screen.getByText((content) => content.includes(enTranslations['precallTest.status'])) | ||
| ).toBeInTheDocument(); | ||
| expect( | ||
| screen.getByText((content) => content.includes(enTranslations['precallTest.failed'])) | ||
| ).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('displays failed tests when failedTests array is provided', () => { | ||
| const mockResults: ConnectivityResultsType = { | ||
| success: false, | ||
| failedTests: [ | ||
| { | ||
| type: 'ConnectToSession', | ||
| error: { | ||
| message: 'Failed to connect to session', | ||
| name: 'CONNECTION_ERROR', | ||
| }, | ||
| }, | ||
| { | ||
| type: 'PublishToSession', | ||
| error: { | ||
| message: 'Failed to publish stream', | ||
| name: 'PUBLISH_ERROR', | ||
| }, | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| render(<ConnectivityResults results={mockResults} />); | ||
|
|
||
| expect( | ||
| screen.getByText((content) => content.includes(enTranslations['precallTest.issues'])) | ||
| ).toBeInTheDocument(); | ||
| expect(screen.getByText('ConnectToSession: Failed to connect to session')).toBeInTheDocument(); | ||
| expect(screen.getByText('PublishToSession: Failed to publish stream')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('does not display issues section when test is successful', () => { | ||
| const mockResults: ConnectivityResultsType = { | ||
| success: true, | ||
| }; | ||
|
|
||
| render(<ConnectivityResults results={mockResults} />); | ||
|
|
||
| expect(screen.queryByText(enTranslations['precallTest.issues'])).not.toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('does not display issues section when failedTests array is empty', () => { | ||
| const mockResults: ConnectivityResultsType = { | ||
| success: false, | ||
| failedTests: [], | ||
| }; | ||
|
|
||
| render(<ConnectivityResults results={mockResults} />); | ||
|
|
||
| expect(screen.queryByText(enTranslations['precallTest.issues'])).not.toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('handles single failed test correctly', () => { | ||
| const mockResults: ConnectivityResultsType = { | ||
| success: false, | ||
| failedTests: [ | ||
| { | ||
| type: 'MediaAccess', | ||
| error: { | ||
| message: 'Camera access denied', | ||
| name: 'MEDIA_ACCESS_DENIED', | ||
| }, | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| render(<ConnectivityResults results={mockResults} />); | ||
|
|
||
| expect( | ||
| screen.getByText((content) => content.includes(enTranslations['precallTest.issues'])) | ||
| ).toBeInTheDocument(); | ||
| expect(screen.getByText('MediaAccess: Camera access denied')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('handles multiple failed tests with different error types', () => { | ||
| const mockResults: ConnectivityResultsType = { | ||
| success: false, | ||
| failedTests: [ | ||
| { | ||
| type: 'NetworkLatency', | ||
| error: { | ||
| message: 'High network latency detected', | ||
| name: 'LATENCY_ERROR', | ||
| }, | ||
| }, | ||
| { | ||
| type: 'Bandwidth', | ||
| error: { | ||
| message: 'Insufficient bandwidth', | ||
| name: 'BANDWIDTH_ERROR', | ||
| }, | ||
| }, | ||
| { | ||
| type: 'FirewallBlocking', | ||
| error: { | ||
| message: 'Firewall blocking connection', | ||
| name: 'FIREWALL_ERROR', | ||
| }, | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| render(<ConnectivityResults results={mockResults} />); | ||
|
|
||
| expect( | ||
| screen.getByText((content) => content.includes(enTranslations['precallTest.issues'])) | ||
| ).toBeInTheDocument(); | ||
| expect(screen.getByText('NetworkLatency: High network latency detected')).toBeInTheDocument(); | ||
| expect(screen.getByText('Bandwidth: Insufficient bandwidth')).toBeInTheDocument(); | ||
| expect(screen.getByText('FirewallBlocking: Firewall blocking connection')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('renders failed status with issues when both conditions are met', () => { | ||
| const mockResults: ConnectivityResultsType = { | ||
| success: false, | ||
| failedTests: [ | ||
| { | ||
| type: 'TestType', | ||
| error: { | ||
| message: 'Test error message', | ||
| name: 'TEST_ERROR', | ||
| }, | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| render(<ConnectivityResults results={mockResults} />); | ||
|
|
||
| expect( | ||
| screen.getByText((content) => content.includes(enTranslations['precallTest.issues'])) | ||
| ).toBeInTheDocument(); | ||
| expect( | ||
| screen.getByText((content) => content.includes(enTranslations['precallTest.failed'])) | ||
| ).toBeInTheDocument(); | ||
| expect(screen.getByText('TestType: Test error message')).toBeInTheDocument(); | ||
| }); | ||
| }); |
43 changes: 43 additions & 0 deletions
43
frontend/src/components/PreCall/ConnectivityResults/ConnectivityResults.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { ReactElement } from 'react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import { ConnectivityResults as ConnectivityResultsType } from '../../../hooks/useNetworkTest'; | ||
|
|
||
| export type ConnectivityResultsProps = { | ||
| results: ConnectivityResultsType; | ||
| }; | ||
|
|
||
| /** | ||
| * ConnectivityResults Component | ||
| * | ||
| * This component displays the results of the connectivity test. | ||
| * @param {ConnectivityResultsProps} props - The props for the component. | ||
| * @property {ConnectivityResultsType} results - The connectivity test results to display. | ||
| * @returns {ReactElement} The connectivity results component. | ||
| */ | ||
| const ConnectivityResults = ({ results }: ConnectivityResultsProps): ReactElement => { | ||
| const { t } = useTranslation(); | ||
|
|
||
| return ( | ||
| <div className="mb-6 rounded-lg border bg-white p-4 text-left"> | ||
| <h3 className="mb-2 font-bold">{t('precallTest.connectivityResults')}</h3> | ||
| <p> | ||
| {t('precallTest.status')}:{' '} | ||
| {results.success ? `✅ ${t('precallTest.success')}` : `❌ ${t('precallTest.failed')}`} | ||
| </p> | ||
| {results.failedTests && results.failedTests.length > 0 && ( | ||
| <div className="mt-2"> | ||
| <h4 className="font-semibold">{t('precallTest.issues')}:</h4> | ||
| {results.failedTests.map((test) => ( | ||
| <div key={test.type} className="ml-4 text-sm"> | ||
| <p> | ||
| {test.type}: {test.error.message} | ||
| </p> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default ConnectivityResults; | ||
3 changes: 3 additions & 0 deletions
3
frontend/src/components/PreCall/ConnectivityResults/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import ConnectivityResults from './ConnectivityResults'; | ||
|
|
||
| export default ConnectivityResults; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
NIT: Could we take profit of MUI components instead of native HTML? MUI will be used to allow the user to use custom colors, so, using MUI components will make it much easier🙏
I can think of
<h3>for example being replaced by something like this:Many of this component could be replaced by MUI components?
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.
hey @OscarFava, I actually ended up getting rid off this file but I followed your suggestions in
QualityResultscomponent. Please let me know if it looks good to you and I'll change it in other placesThere 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.
actually, I went ahead and changed all of them to use MUI. let me know if you have any other concerns there 🙏