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

Updating react deps #502

Merged
merged 55 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
aa4ffb7
Update React
howard-e Jan 10, 2023
d4a1b55
Revert "Update React"
howard-e Jan 24, 2023
36a4ae2
Updating jest environment and babel configuration
evmiguel Feb 1, 2023
e7d8fed
New github config to fix builds
evmiguel Feb 2, 2023
28f73bf
Cacheing nodegit and fixing failing tests
evmiguel Feb 2, 2023
c4505e4
update react in package.json
evmiguel Feb 2, 2023
ef163f2
Updating React-Testing-Library and removing acts (default now)
aleenaloves Feb 2, 2023
9591c3d
adding text encoder, which is not added to jsdom
evmiguel Feb 2, 2023
9c21e82
fixing error
aleenaloves Feb 6, 2023
62f18f6
updating react testing library dom
evmiguel Feb 7, 2023
49810bf
fixing error
aleenaloves Feb 6, 2023
6fcec89
updating react testing library dom
evmiguel Feb 7, 2023
6294873
Update yarn.lock
howard-e Feb 16, 2023
5217e74
Update React
howard-e Jan 10, 2023
487af36
Revert "Update React"
howard-e Jan 24, 2023
e1974c5
Updating jest environment and babel configuration
evmiguel Feb 1, 2023
2bc1874
update react in package.json
evmiguel Feb 2, 2023
1e2f866
adding text encoder, which is not added to jsdom
evmiguel Feb 2, 2023
b6eedc0
in prog
aleenaloves Feb 7, 2023
0c14562
fixing tests
aleenaloves Feb 7, 2023
b9a7683
fixes
aleenaloves Feb 7, 2023
8927357
pushing in changesss
aleenaloves Feb 7, 2023
f579e32
pages working
aleenaloves Feb 8, 2023
836ecb2
cleaning up confirmAuth + candidateTests + routes index.js
aleenaloves Feb 9, 2023
0fe6d1f
descendent routing in progress
aleenaloves Feb 9, 2023
11504a9
fixed candidate tests + test reports. TODO: test queue
aleenaloves Feb 13, 2023
d49f844
fixing typo: propotypes --> proptypes
aleenaloves Feb 15, 2023
0710891
undoing irrelevant commits
aleenaloves Feb 15, 2023
9e6fb39
undoing uneccesary whitespaces
aleenaloves Feb 15, 2023
88ee3e3
removing unnecessary imports
aleenaloves Feb 15, 2023
bbf4940
in prog
aleenaloves Feb 7, 2023
5e5ccba
fixing tests
aleenaloves Feb 7, 2023
caefbd3
pushing in changesss
aleenaloves Feb 7, 2023
1f48ae2
pages working
aleenaloves Feb 8, 2023
e115f6f
cleaning up confirmAuth + candidateTests + routes index.js
aleenaloves Feb 9, 2023
7872871
descendent routing in progress
aleenaloves Feb 9, 2023
6ddff50
undoing irrelevant commits
aleenaloves Feb 15, 2023
500c8dc
undoing uneccesary whitespaces
aleenaloves Feb 15, 2023
7833d2a
removing unnecessary imports
aleenaloves Feb 15, 2023
a93e3a1
Update yarn.lock
howard-e Feb 16, 2023
27967e9
report fixings
aleenaloves Feb 16, 2023
8998bfe
fixing jest test expected
aleenaloves Feb 16, 2023
7e6169c
removing unused import
aleenaloves Feb 16, 2023
4346484
updated runtest.yml
aleenaloves Feb 16, 2023
6f4c9bf
removing resize observer
aleenaloves Feb 16, 2023
d9e5e63
confirmed test expected is different per machine, reverting
aleenaloves Feb 16, 2023
8fcf431
fixing resize-observer
aleenaloves Feb 16, 2023
c794439
check for null | undefined testplanreports
aleenaloves Feb 22, 2023
f06035d
summarizetestplanversion reverts
aleenaloves Feb 22, 2023
27d9618
Merge pull request #498 from w3c/updating-react-router
aleenaloves Feb 22, 2023
7f58510
Re-enabling test on App.test.jsx
evmiguel Feb 22, 2023
97326a5
updated testing library
aleenaloves Feb 22, 2023
736bab2
adding yarn lock
aleenaloves Feb 22, 2023
b580444
yarn prettier
aleenaloves Feb 22, 2023
e26b111
Removing comment
evmiguel Feb 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/runtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
- name: lighthouseci
run: |
npm install -g @lhci/[email protected]
yarn workspace client lighthouse
yarn workspace client lighthouse
5 changes: 1 addition & 4 deletions client/components/App/App.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from 'react';
import { useQuery } from '@apollo/client';
import { renderRoutes } from 'react-router-config';
import { Link, useLocation } from 'react-router-dom';
import Container from 'react-bootstrap/Container';
import Navbar from 'react-bootstrap/Navbar';
Expand Down Expand Up @@ -163,9 +162,7 @@ const App = () => {
</Navbar.Collapse>
</Navbar>
</Container>
<Container fluid>
<div>{renderRoutes(routes)}</div>
</Container>
<Container fluid>{routes()}</Container>
</ScrollFixer>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Container from 'react-bootstrap/Container';
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';
import Button from 'react-bootstrap/Button';
import { useParams, Redirect, useHistory } from 'react-router-dom';
import { useParams, useNavigate, Navigate } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import './CandidateTestPlanRun.css';
import '../../TestRun/TestRun.css';
Expand Down Expand Up @@ -45,7 +45,7 @@ function useSize(target) {

const CandidateTestPlanRun = () => {
const { atId, testPlanVersionId } = useParams();
const history = useHistory();
const navigate = useNavigate();

const { loading, data, error, refetch } = useQuery(
CANDIDATE_REPORTS_QUERY,
Expand Down Expand Up @@ -254,7 +254,7 @@ const CandidateTestPlanRun = () => {
const at = atMap[atId];

const testPlanReports = data.testPlanReports;
if (testPlanReports.length === 0) return <Redirect to="/404" />;
if (testPlanReports.length === 0) return <Navigate to="/404" replace />;

const testPlanReport = testPlanReports.find(
each => each.testPlanVersion.id === testPlanVersionId
Expand Down Expand Up @@ -699,7 +699,7 @@ const CandidateTestPlanRun = () => {
show={true}
handleAction={async () => {
setThankYouModalShowing(false);
history.push('/candidate-tests');
navigate('/candidate-tests');
}}
githubUrl={generateGithubUrl(
false,
Expand Down
18 changes: 4 additions & 14 deletions client/components/CandidateTests/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { useQuery } from '@apollo/client';
import { Redirect, Route, Switch } from 'react-router';
import PageStatus from '../common/PageStatus';
import TestPlans from './TestPlans';
import { CANDIDATE_TESTS_PAGE_QUERY } from './queries';
Expand Down Expand Up @@ -36,19 +35,10 @@ const CandidateTests = () => {
if (!data) return null;

return (
<Switch>
<Route
exact
path="/candidate-tests"
render={() => (
<TestPlans
testPlanReports={data.testPlanReports}
triggerPageUpdate={refetch}
/>
)}
/>
<Redirect to="/404" />
</Switch>
<TestPlans
testPlanReports={data.testPlanReports}
triggerPageUpdate={refetch}
/>
);
};

Expand Down
23 changes: 8 additions & 15 deletions client/components/ConfirmAuth/index.jsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
import { Navigate } from 'react-router-dom';
import PropTypes from 'prop-types';
import { useQuery } from '@apollo/client';
import { ME_QUERY } from '../App/queries';
import { evaluateAuth } from '../../utils/evaluateAuth';

const ConfirmAuth = ({ children, requiredPermission, ...rest }) => {
const ConfirmAuth = ({ children, requiredPermission }) => {
const { data } = useQuery(ME_QUERY);

const auth = evaluateAuth(data && data.me ? data.me : {});
const { roles, username, isAdmin, isSignedIn } = auth;

if (!username) return <Redirect to={{ pathname: '/invalid-request' }} />;
if (!username) return <Navigate to={{ pathname: '/invalid-request' }} />;

// If you are an admin, you can access all other role actions by default
const authConfirmed =
isSignedIn && (roles.includes(requiredPermission) || isAdmin);

return (
<Route
{...rest}
render={() => {
return authConfirmed ? (
children
) : (
<Redirect to={{ pathname: '/404' }} />
);
}}
/>
);
if (!authConfirmed) {
return <Navigate to="/404" replace />;
}

return children;
};

ConfirmAuth.propTypes = {
Expand Down
84 changes: 32 additions & 52 deletions client/components/Reports/Report.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import { useQuery } from '@apollo/client';
import { Route, Switch } from 'react-router';
import { Redirect, useRouteMatch } from 'react-router-dom';
import { Route, Routes, Navigate } from 'react-router';
import SummarizeTestPlanVersion from './SummarizeTestPlanVersion';
import SummarizeTestPlanReport from './SummarizeTestPlanReport';
import PageStatus from '../common/PageStatus';
import { REPORT_PAGE_QUERY } from './queries';
import './Reports.css';
import { useParams } from 'react-router-dom';

const Reports = () => {
const match = useRouteMatch('/report/:testPlanVersionId');
const Report = () => {
const { testPlanVersionId } = useParams();

let testPlanVersionIds = [];
let testPlanVersionId = match?.params?.testPlanVersionId;

if (testPlanVersionId.includes(','))
testPlanVersionIds = testPlanVersionId.split(',');

Expand Down Expand Up @@ -45,6 +45,12 @@ const Reports = () => {

if (!data) return null;

const testPlanReports = data.testPlanReports.filter(
each =>
each.testPlanVersion.id === testPlanVersionId ||
testPlanVersionIds.includes(each.testPlanVersion.id)
);

const combineArray = testPlanReports => {
let testPlanTargetsById = {};
testPlanReports.forEach(testPlanReport => {
Expand Down Expand Up @@ -76,58 +82,32 @@ const Reports = () => {
});
};

if (!testPlanReports || testPlanReports.length < 1) {
return <Navigate to="/404" replace />;
}

return (
<Switch>
<Routes>
<Route
exact
path="/report/:testPlanVersionId"
render={({ match: { params } }) => {
const { testPlanVersionId } = params;

let testPlanVersionIds = [];
if (testPlanVersionId.includes(','))
testPlanVersionIds = testPlanVersionId.split(',');

const testPlanReports = data.testPlanReports.filter(
each =>
each.testPlanVersion.id === testPlanVersionId ||
testPlanVersionIds.includes(each.testPlanVersion.id)
);

if (!testPlanReports.length) return <Redirect to="/404" />;

return (
<SummarizeTestPlanVersion
testPlanVersion={testPlanReports[0].testPlanVersion}
testPlanReports={combineArray(testPlanReports)}
/>
);
}}
index
element={
<SummarizeTestPlanVersion
testPlanVersion={testPlanReports[0].testPlanVersion}
testPlanReports={combineArray(testPlanReports)}
/>
}
/>
<Route
exact
path="/report/:testPlanVersionId/targets/:testPlanReportId"
render={({ match: { params } }) => {
const { testPlanVersionId, testPlanReportId } = params;

const testPlanReport = data.testPlanReports.find(
each =>
each.testPlanVersion.id === testPlanVersionId &&
each.id == testPlanReportId
);

if (!testPlanReport) return <Redirect to="/404" />;

return (
<SummarizeTestPlanReport
testPlanReport={testPlanReport}
/>
);
}}
path="targets/:testPlanReportId"
element={
<SummarizeTestPlanReport
testPlanReports={testPlanReports}
/>
}
/>
<Redirect to="/404" />
</Switch>
<Route path="*" element={<Navigate to="/404" replace />} />
</Routes>
);
};

export default Reports;
export default Report;
115 changes: 64 additions & 51 deletions client/components/Reports/SummarizeTestPlanReport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { convertDateToString } from '../../utils/formatter';
import DisclaimerInfo from '../DisclaimerInfo';
import TestPlanResultsTable from './TestPlanResultsTable';
import DisclosureComponent from '../common/DisclosureComponent';
import { Navigate } from 'react-router';
import { useParams } from 'react-router-dom';

const getTestersRunHistory = (
testPlanReport,
Expand Down Expand Up @@ -74,7 +76,15 @@ const getTestersRunHistory = (
);
};

const SummarizeTestPlanReport = ({ testPlanReport }) => {
const SummarizeTestPlanReport = ({ testPlanReports }) => {
const { testPlanReportId } = useParams();

const testPlanReport = testPlanReports.find(
each => each.id == testPlanReportId
);

if (!testPlanReport) return <Navigate to="/404" />;

const { testPlanVersion, at, browser } = testPlanReport;

// Construct testPlanTarget
Expand Down Expand Up @@ -226,60 +236,63 @@ const SummarizeTestPlanReport = ({ testPlanReport }) => {
};

SummarizeTestPlanReport.propTypes = {
testPlanReport: PropTypes.shape({
id: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
testPlanVersion: PropTypes.object.isRequired,
runnableTests: PropTypes.arrayOf(PropTypes.object.isRequired)
.isRequired,
at: PropTypes.shape({
testPlanReports: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired
}).isRequired,
browser: PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired
}).isRequired,
finalizedTestResults: PropTypes.arrayOf(
PropTypes.shape({
status: PropTypes.string.isRequired,
testPlanVersion: PropTypes.object.isRequired,
runnableTests: PropTypes.arrayOf(PropTypes.object.isRequired)
.isRequired,
at: PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired
}).isRequired,
browser: PropTypes.shape({
id: PropTypes.string.isRequired,
test: PropTypes.shape({
title: PropTypes.string.isRequired,
renderedUrl: PropTypes.string.isRequired
}).isRequired,
scenarioResults: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
output: PropTypes.string.isRequired,
assertionResults: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
passed: PropTypes.bool.isRequired,
failedReason: PropTypes.string,
assertion: PropTypes.shape({
text: PropTypes.string.isRequired
name: PropTypes.string.isRequired
}).isRequired,
finalizedTestResults: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
test: PropTypes.shape({
title: PropTypes.string.isRequired,
renderedUrl: PropTypes.string.isRequired
}).isRequired,
scenarioResults: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
output: PropTypes.string.isRequired,
assertionResults: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
passed: PropTypes.bool.isRequired,
failedReason: PropTypes.string,
assertion: PropTypes.shape({
text: PropTypes.string.isRequired
}).isRequired
}).isRequired
).isRequired,
unexpectedBehaviors: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
otherUnexpectedBehaviorText:
PropTypes.string
}).isRequired
}).isRequired
).isRequired,
unexpectedBehaviors: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
otherUnexpectedBehaviorText: PropTypes.string
}).isRequired
).isRequired
}).isRequired
).isRequired
}).isRequired
).isRequired,
draftTestPlanRuns: PropTypes.arrayOf(
PropTypes.shape({
tester: PropTypes.shape({
username: PropTypes.string.isRequired
).isRequired
}).isRequired
).isRequired
}).isRequired
).isRequired,
draftTestPlanRuns: PropTypes.arrayOf(
PropTypes.shape({
tester: PropTypes.shape({
username: PropTypes.string.isRequired
})
})
})
)
}).isRequired
)
}).isRequired
)
};

export default SummarizeTestPlanReport;
Loading