Skip to content

Commit 7b04617

Browse files
jasnooMarkTeetsminzo-kimyuanjackie1
committed
created tutorial steps for webmetrics page
Co-authored-by: Mark Teets <[email protected]> Co-authored-by: Jasmine Noor <[email protected]> Co-authored-by: Minzo Kim <[email protected]> Co-authored-by: Jackie Yuan <[email protected]>
1 parent 06726c4 commit 7b04617

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

src/app/__tests__/WebMetrics.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ import React from 'react';
22
import { render } from '@testing-library/react';
33
import '@testing-library/jest-dom/extend-expect';
44
import WebMetrics from '../components/WebMetrics';
5+
import { useStoreContext } from '../store';
56

67
jest.mock('react-apexcharts', () => ({ __esModule: true, default: () => <div /> }));
8+
const dispatch = jest.fn();
9+
// jest.spyOn(React, 'useEffect').mockImplementation(() => jest.fn());
10+
jest.mock('../store');
11+
const mockedStoreContext = jest.mocked(useStoreContext);
12+
mockedStoreContext.mockImplementation(() => [, dispatch]);
713

814
describe('WebMetrics graph testing', () => {
915
test('should have 1 div with class name "metric" ', () => {

src/app/components/Tutorial.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,47 @@ export default class Tutorial extends React.Component<tutorialProps, tutorialSta
237237
},
238238
];
239239
break;
240+
case 'webmetrics':
241+
steps = [
242+
{
243+
title: 'Webmetrics Tab',
244+
element: '.web-metrics-container',
245+
intro: 'This section will show 4 webmetrics for your page.',
246+
position: 'top',
247+
},
248+
{
249+
title: 'LCP',
250+
element: document.querySelectorAll('.metric')[0],
251+
intro:
252+
'<strong>Largest Contentful Paint</strong><br/>The amount of time it takes for the largest image, video or text block within the viewport to be fully rendered and interactive.',
253+
position: 'top',
254+
},
255+
256+
{
257+
title: 'FID',
258+
element: document.querySelectorAll('.metric')[1],
259+
intro:
260+
'<strong>First Input Delay</strong><br/>A measurement of load responsiveness, the time from the first user interaction (for example, a click) to the browser responding to that interaction.',
261+
position: 'top',
262+
},
263+
264+
{
265+
title: 'FCP',
266+
element: document.querySelectorAll('.metric')[2],
267+
intro:
268+
'<strong>First Contentful Paint</strong><br/>The amount of time it takes to render the first DOM element of any variety',
269+
position: 'top',
270+
},
271+
272+
{
273+
title: 'TTFB',
274+
element: document.querySelectorAll('.metric')[3],
275+
intro:
276+
"<strong>Time to first Byte</strong><br/>The amount of time it takes for a user's browser to receive the first byte of page content from the server.",
277+
position: 'top',
278+
},
279+
];
280+
break;
240281
default:
241282
steps = [
242283
{

src/app/components/WebMetrics.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ const radialGraph = (props) => {
9090

9191
// This updates currentTabInApp which is used to determine what tutorial to display (depending on the active tab within Reactime)
9292
// Code is commented out because it interferes with the testing suite
93-
// const [ store, dispatch] = useStoreContext();
94-
// useEffect(() => {
95-
// dispatch(setCurrentTabInApp('history'));
96-
// }, []);
93+
const [store, dispatch] = useStoreContext();
94+
useEffect(() => {
95+
dispatch(setCurrentTabInApp('webmetrics'));
96+
}, []);
9797

9898
const optionsCursorTrueWithMargin = {
9999
followCursor: true,

0 commit comments

Comments
 (0)