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

Disallowing Test Plans with Incomplete Tests #512

Draft
wants to merge 56 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
d83957b
Update some major dependencies, webpack config and proxy management f…
howard-e Jan 5, 2023
7afe41b
Update icon packs
howard-e Jan 5, 2023
512ada5
webpack config changes
howard-e Jan 6, 2023
420c822
Update bootstrap
howard-e Jan 8, 2023
6ab5746
Update eslint & jest
howard-e Jan 9, 2023
d5c71f3
More dependency updates
howard-e Jan 9, 2023
c9ff257
Update connect-pg-simple
howard-e Jan 9, 2023
2e72491
Update dependencies and css
howard-e Jan 9, 2023
8f87f12
Update css
howard-e Jan 9, 2023
e6f15f3
Remove query-string dependency
howard-e Jan 9, 2023
c786f57
Update React
howard-e Jan 10, 2023
787a473
jest.setup.js update
howard-e Jan 10, 2023
9a916e6
Fix attempt for @react-hook/resize-observer library import
howard-e Jan 10, 2023
944130e
Revert "Update React"
howard-e Jan 24, 2023
fce646d
Update runtest.yml to use Node v18
howard-e Jan 24, 2023
8aed201
Updating form text (#485)
evmiguel Feb 8, 2023
7f2c2b2
Update dependencies test (#484)
evmiguel Feb 8, 2023
f922a69
Update React
howard-e Jan 10, 2023
56c2208
Revert "Update React"
howard-e Jan 24, 2023
e436a2d
Remove nodegit dependency
alflennik Feb 8, 2023
b7f2012
Address PR feedback
alflennik Feb 8, 2023
0ccd643
Fix files affected by revert on source branch
howard-e Feb 13, 2023
f9bac4a
Update React
howard-e Jan 10, 2023
944c873
Revert "Update React"
howard-e Jan 24, 2023
5e45a58
Fix fake data seeder
alflennik Feb 8, 2023
d7b9fff
Fix files affected by revert on source branch
howard-e Feb 13, 2023
059980a
Update React
howard-e Jan 10, 2023
d791f17
Revert "Update React"
howard-e Jan 24, 2023
e88c2b3
Remove sass dependency
alflennik Feb 8, 2023
ab00ba6
Fix files affected by revert on source branch
howard-e Feb 13, 2023
e8d03fa
Merge pull request #487 from w3c/update-dependencies-fake-data
alflennik Feb 13, 2023
9717984
Merge pull request #486 from w3c/update-dependencies-nodegit
alflennik Feb 13, 2023
40d759f
Fix misspellings in the readme (#490)
alflennik Feb 13, 2023
905e690
Merge branch 'update-dependencies' into update-dependencies-sass
alflennik Feb 15, 2023
91f7ef0
Merge pull request #488 from w3c/update-dependencies-sass
alflennik Feb 15, 2023
be33702
Update sequelize
Paul-Clue Feb 21, 2023
19298fd
Remove dominoe patch
Paul-Clue Feb 21, 2023
1f989ba
Update gitUpdatedDateToString function arguments
Paul-Clue Feb 22, 2023
63df985
Updating react deps (#502)
aleenaloves Feb 27, 2023
324b2b1
Update rest of dependencies 2 (#503)
evmiguel Feb 27, 2023
e35f1f4
Merge branch 'update-dependencies' into update-sequelize
Paul-Clue Feb 28, 2023
7bdc230
Merge pull request #501 from w3c/update-sequelize
Paul-Clue Feb 28, 2023
eec1b68
Update sequelize-cli version (#508)
Paul-Clue Feb 28, 2023
94e313a
Updating More Dependencies (#506)
aleenaloves Mar 1, 2023
85b7486
disabled incomplete tests
aleenaloves Mar 2, 2023
0153159
draft2
aleenaloves Mar 2, 2023
08d4f66
missing return added
aleenaloves Mar 2, 2023
61dd8dc
complete
aleenaloves Mar 2, 2023
774ddb1
in progress
aleenaloves Mar 2, 2023
4813296
cleaned up logic
aleenaloves Mar 2, 2023
b7412ae
adding in missing null check
aleenaloves Mar 2, 2023
ad93ff7
fix for testQueueRow
aleenaloves Mar 6, 2023
c13c1bb
Merge branch 'main' into issue-493-candidate-test-page
aleenaloves Mar 8, 2023
8a30aa4
Merge branch 'main' into issue-493-candidate-test-page
aleenaloves Mar 9, 2023
f4571ae
adding in alert
aleenaloves Mar 9, 2023
2812e66
fixed tests + --> statusbar instead of alert
aleenaloves Mar 9, 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
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,12 @@
position: relative;
top: -5px;
}

.incomplete-test-plan-information-text {
margin-top: 5%;
}

.status-bar {
display: flex;
align-items: center;
}
73 changes: 56 additions & 17 deletions client/components/CandidateTests/CandidateTestPlanRun/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import ThankYouModal from '../CandidateModals/ThankYouModal';
import getMetrics from '../../Reports/getMetrics';
import FeedbackListItem from '../FeedbackListItem';
import DisclosureComponent from '../../common/DisclosureComponent';
import StatusBar from '../../TestRun/StatusBar';

// https://codesandbox.io/s/react-hookresize-observer-example-ft88x
function useSize(target) {
Expand Down Expand Up @@ -165,6 +166,21 @@ const CandidateTestPlanRun = () => {
setThankYouModalShowing(true);
};

const handleIncompleteTestPlans = () => {
const runnableTests = testPlanReport.runnableTests;
const finalizedTests = testPlanReport.finalizedTestResults;
const finalizedTestIds = finalizedTests.map(x => x.test.id);

const hasIncompleteTests =
runnableTests.length != finalizedTests.length;

const viewedCompleteTests = viewedTests.filter(viewedTest =>
finalizedTestIds.includes(viewedTest)
);

return { hasIncompleteTests, viewedCompleteTests };
};

useEffect(() => {
if (data) {
if (
Expand Down Expand Up @@ -345,6 +361,9 @@ const CandidateTestPlanRun = () => {
}
};

const { hasIncompleteTests, viewedCompleteTests } =
handleIncompleteTestPlans();

const heading = (
<div className="test-info-heading">
<div className="sr-only" aria-live="polite" aria-atomic="true">
Expand All @@ -369,6 +388,10 @@ const CandidateTestPlanRun = () => {
</Badge>
)}
</h1>
{hasIncompleteTests &&
(
<StatusBar isCandidateTestRun={true} hasIncompleteTestRuns={true} />
)}
</div>
);

Expand Down Expand Up @@ -492,21 +515,34 @@ const CandidateTestPlanRun = () => {
testPlanReport.finalizedTestResults[
currentTestIndex
];
const { testsPassedCount } = getMetrics({ testResult });
return (
<>
<h2 className="test-results-header">
Test Result:{' '}
{testsPassedCount ? 'PASS' : 'FAIL'}
</h2>
<TestPlanResultsTable
tableClassName="test-results-table"
key={`${testPlanReport.id} + ${testResult.id}`}
test={currentTest}
testResult={testResult}
/>
</>
);

if (testResult) {
const { testsPassedCount } = getMetrics({
testResult
});
return (
<>
<h2 className="test-results-header">
Test Result:{' '}
{testsPassedCount ? 'PASS' : 'FAIL'}
</h2>
<TestPlanResultsTable
tableClassName="test-results-table"
key={`${testPlanReport.id} + ${testResult.id}`}
test={currentTest}
testResult={testResult}
/>
</>
);
} else {
return (
<>
<h2 className="test-results-header">
Test Result: INCOMPLETE
</h2>
</>
);
}
})
]}
stacked
Expand Down Expand Up @@ -542,7 +578,7 @@ const CandidateTestPlanRun = () => {
currentTestIndex={currentTestIndex}
toggleShowClick={toggleTestNavigator}
handleTestClick={handleTestClick}
viewedTests={viewedTests}
viewedTests={viewedCompleteTests}
/>
<Col
className="candidate-test-area"
Expand Down Expand Up @@ -601,7 +637,10 @@ const CandidateTestPlanRun = () => {
true
);
}}
disabled={!isLastTest}
disabled={
!isLastTest ||
hasIncompleteTests
}
>
Finish
</Button>
Expand Down
8 changes: 8 additions & 0 deletions client/components/TestQueueRow/TestQueueRow.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ button.more-actions:active {
width: initial;
}

.next-report-status-information-text {
font-size: small;
text-align: center;
display: block;
margin: 5%;
color:gray;
}

/* tr.test-queue-run-row td:first-child {
padding: 0.75rem;
} */
77 changes: 55 additions & 22 deletions client/components/TestQueueRow/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,20 @@ const TestQueueRow = ({
};

const evaluateNewReportStatus = () => {
const { status, conflictsLength } = testPlanReport;
const { status, conflictsLength, runnableTestsLength, draftTestPlanRuns } =
testPlanReport;

const conflictsCount = conflictsLength;
const draftTestPlansTestResultsLengths = draftTestPlanRuns.map(x => x.testResultsLength);

const hasIncompleteTests = draftTestPlansTestResultsLengths.filter(x => x != runnableTestsLength).length > 0

// If there are no conflicts OR the test has been marked as "final",
// and admin can mark a test run as "draft"
let newStatus;
let newStatusCanContinue;
let newStatusInformationText;

if (
(status !== 'IN_REVIEW' &&
conflictsCount === 0 &&
Expand All @@ -450,11 +458,24 @@ const TestQueueRow = ({
) {
newStatus = 'CANDIDATE';
}
return newStatus;

if (newStatus === 'CANDIDATE' && hasIncompleteTests) {
newStatusCanContinue = false;
newStatusInformationText =
'Incomplete test plans cannot transition to the candidate report status.';
} else {
newStatusCanContinue = true;
}

return { newStatus, newStatusCanContinue, newStatusInformationText };
};

const { status, results } = evaluateStatusAndResults();
const nextReportStatus = evaluateNewReportStatus();
const {
newStatus: nextReportStatus,
newStatusCanContinue: nextReportStatusCanContinue,
newStatusInformationText: nextReportStatusInformationText
} = evaluateNewReportStatus();

const getRowId = tester =>
[
Expand Down Expand Up @@ -533,25 +554,37 @@ const TestQueueRow = ({
<div className="status-wrapper">{status}</div>
{isSignedIn && isTester && (
<div className="secondary-actions">
{isAdmin && !isLoading && nextReportStatus && (
<>
<Button
ref={updateTestPlanStatusButtonRef}
variant="secondary"
onClick={async () => {
focusButtonRef.current =
updateTestPlanStatusButtonRef.current;
await updateReportStatus(
nextReportStatus
);
}}
>
Mark as{' '}
{capitalizeEachWord(nextReportStatus, {
splitChar: '_'
})}
</Button>
</>
{isAdmin &&
!isLoading &&
nextReportStatus &&
nextReportStatusCanContinue && (
<>
<Button
ref={updateTestPlanStatusButtonRef}
variant="secondary"
onClick={async () => {
focusButtonRef.current =
updateTestPlanStatusButtonRef.current;
await updateReportStatus(
nextReportStatus
);
}}
>
Mark as{' '}
{capitalizeEachWord(
nextReportStatus,
{
splitChar: '_'
}
)}
</Button>
</>
)}

{nextReportStatusInformationText && (
<span className="next-report-status-information-text">
{nextReportStatusInformationText}
</span>
)}
{results}
</div>
Expand Down
15 changes: 15 additions & 0 deletions client/components/TestRun/StatusBar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import nextId from 'react-id-generator';

const StatusBar = ({
hasConflicts = false,
hasIncompleteTestRuns = false,
isCandidateTestRun = false,
handleReviewConflictsButtonClick = () => {}
}) => {
const [statuses, setStatuses] = useState([]);
Expand Down Expand Up @@ -34,6 +36,17 @@ const StatusBar = ({
});
}

if(hasIncompleteTestRuns && isCandidateTestRun) {
const variant = 'warning';
const icon = 'alert';
const message = 'This Candidate Test Plan has incomplete test results and cannot be finished. Please move this Test Plan back to Draft and complete recording all test results.';
statuses.push({
icon,
message,
variant
});
}

setStatuses(statuses);
}, []);

Expand All @@ -59,6 +72,8 @@ const StatusBar = ({
StatusBar.propTypes = {
issues: PropTypes.array,
hasConflicts: PropTypes.bool,
hasIncompleteTestRuns: PropTypes.bool,
isCandidateTestRun: PropTypes.bool,
handleReviewConflictsButtonClick: PropTypes.func
};

Expand Down