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

Video 5756 browser check #9

Merged
merged 44 commits into from Aug 18, 2021
Merged

Video 5756 browser check #9

merged 44 commits into from Aug 18, 2021

Conversation

olipyskoty
Copy link
Contributor

Contributing to Twilio

All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

Pull Request Details

JIRA link(s):

Description

This PR adds the BrowserTest pane to the Video Diagnostics App. We used the UAParser library to get the user's Browser and OS information. Note, the .getResult() method from the library provides a lot of information about the user agent and I figured that we could include the returned object in the final results JSON object (I'll tackle this part in a future PR). If you have a different approach let me know!

Also, I included some super small missing tests for action types set-audio-input-test-report and set-audio-output-test-report in AppStateProvider.test.tsx.

Supported Browser
5756Supported

Unsupported Browser
5756Unsupported

Burndown

Before review

  • Updated CHANGELOG.md if necessary
  • Added unit tests if necessary
  • Updated affected documentation
  • Verified locally with npm test
  • Manually sanity tested running locally
  • Included screenshot as PR comment (if needed)
  • Ready for review

Before merge

  • Got one or more +1s
  • Re-tested if necessary

@@ -272,5 +273,22 @@ describe('the MainContent component', () => {

expect(wrapper.find('div').at(1).prop('className')).toContain('hideAfter');
});

it('should hide the following item when browser is unsupported and active pane is BrowserTest', () => {
jest.mock('twilio-video', () => ({ version: '1.2' }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, jest.mock doesn't work as we expect. These jest.mock statements are automatically hoisted to the top of their scope when the tests run. Normally, they are hoisted to the very top of the file, before the import statements. This is what makes them work - the dependency is mocked before it's imported. Here, the mock is hoisted to the top of the it() block, so we're mocking twilio-video after the original is already imported. There's some good info in this thread: jestjs/jest#2582

All that said, it looks like we don't even need to mock twilio-video. Seems like Video.isSupported = false; is enough. So I think we can get rid of line 278. Same goes for Maincontent.test.tsx and BrowserTest.test.tsx.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know! thanks for sharing 👍

paper: {
padding: '1.5em',
borderRadius: '8px',
width: '388px',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like 388px is used in three different spots. I'd say this should be moved to the theme, but I think that this hardcoded pixel value won't work when we add the responsive layout. I think this can stay the same for now, but it's something to think about when we build the responsive designs.

Oh no, your browser isn't supported! Download and install a new one from the list, copy this url and paste
it into your new browser to restart the test.
</Typography>
<TextField
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the designs nicely, but I do have a question for Corrine: Should this field be wider?

This is what the field looks like when the app is deployed to https://rtc-diagnostics-video-zheyb5a8-1552-dev.twil.io.

Just seems like we could use more space to show the URL.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per Corinne in slack, we'll make the text field width 100% (as wide as parent container).

Comment on lines 43 to 47
const appURL = `${window.location.href}`;

const copyAppLink = () => {
navigator.clipboard.writeText(appURL);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appURL doesn't seem to do much. We could probably just do this:

Suggested change
const appURL = `${window.location.href}`;
const copyAppLink = () => {
navigator.clipboard.writeText(appURL);
};
const copyAppLink = () => {
navigator.clipboard.writeText(window.location.href);
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kept appURL but remove the unnecessary template literal


describe('the UnsupportedBrowser component', () => {
it('should render correctly', () => {
const wrapper = mount(<UnsupportedBrowser />);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mount produces a huge shapshot. Can we use shallow here?`

@olipyskoty olipyskoty merged commit 7d2778a into main Aug 18, 2021
@olipyskoty olipyskoty deleted the VIDEO-5756-browser-check branch August 18, 2021 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants