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

fix: Remove TestQueue v1 and update Test Queue e2e tests #1146

Merged
merged 6 commits into from
Jul 10, 2024
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Address TODOs on removing Test Queue v1 vs v2 conditionals
  • Loading branch information
howard-e committed Jul 8, 2024
commit 9080b6a250f7b57b5c9b71ad3b161a639c07e86d
69 changes: 12 additions & 57 deletions client/components/BotRunTestStatusList/index.js
Original file line number Diff line number Diff line change
@@ -5,16 +5,6 @@ import { useQuery } from '@apollo/client';
import styled from '@emotion/styled';
import ReportStatusDot from '../common/ReportStatusDot';

// TODO: Remove when Test Queue v1 is removed
const BotRunTestStatusUnorderedList = styled.ul`
list-style-type: none;
background-color: #f6f8fa;
font-size: 0.9rem !important;
padding: 0.5rem 0;
margin: 0.5rem 0;
white-space: nowrap;
`;

const BotRunTestContainer = styled.div`
font-size: 0.875rem !important;
padding: 0.5rem 0;
@@ -26,7 +16,7 @@ const BotRunTestContainer = styled.div`
white-space: nowrap;
`;

const BotRunTestStatusUnorderedListV2 = styled.ul`
const BotRunTestStatusUnorderedList = styled.ul`
list-style-type: none;
`;

@@ -49,10 +39,7 @@ const testCountString = (count, status) =>

const pollInterval = 2000;

const BotRunTestStatusList = ({
testPlanReportId,
fromTestQueueV2 = false // TODO: Remove when Test Queue v1 is removed
}) => {
const BotRunTestStatusList = ({ testPlanReportId }) => {
const {
data: testPlanRunsQueryResult,
startPolling,
@@ -104,75 +91,43 @@ const BotRunTestStatusList = ({

return (
<>
{fromTestQueueV2 ? (
<BotRunTestContainer>
Bot Status:
<BotRunTestStatusUnorderedListV2 className="text-secondary">
{RUNNING > 0 && (
<li>
<ReportStatusDot className="tests-running" />
{testCountString(RUNNING, 'Running')}
</li>
)}
{ERROR > 0 && (
<li>
<ReportStatusDot className="tests-error" />
{testCountString(ERROR, 'Error')}
</li>
)}
<li>
<ReportStatusDot className="tests-complete" />
{testCountString(COMPLETED, 'Completed')}
</li>
<li>
<ReportStatusDot className="tests-queued" />
{testCountString(QUEUED, 'Queued')}
</li>
{CANCELLED > 0 && (
<li>
<ReportStatusDot className="tests-cancelled" />
{testCountString(CANCELLED, 'Cancelled')}
</li>
)}
</BotRunTestStatusUnorderedListV2>
</BotRunTestContainer>
) : (
<BotRunTestStatusUnorderedList className="text-secondary fs-6">
<BotRunTestContainer>
Bot Status:
<BotRunTestStatusUnorderedList className="text-secondary">
{RUNNING > 0 && (
<li className="m-2">
<li>
<ReportStatusDot className="tests-running" />
{testCountString(RUNNING, 'Running')}
</li>
)}
{ERROR > 0 && (
<li className="m-2">
<li>
<ReportStatusDot className="tests-error" />
{testCountString(ERROR, 'Error')}
</li>
)}
<li className="m-2">
<li>
<ReportStatusDot className="tests-complete" />
{testCountString(COMPLETED, 'Completed')}
</li>
<li className="m-2">
<li>
<ReportStatusDot className="tests-queued" />
{testCountString(QUEUED, 'Queued')}
</li>
{CANCELLED > 0 && (
<li className="m-2">
<li>
<ReportStatusDot className="tests-cancelled" />
{testCountString(CANCELLED, 'Cancelled')}
</li>
)}
</BotRunTestStatusUnorderedList>
)}
</BotRunTestContainer>
</>
);
};

BotRunTestStatusList.propTypes = {
testPlanReportId: PropTypes.string.isRequired,
fromTestQueueV2: PropTypes.bool
testPlanReportId: PropTypes.string.isRequired
};

export default BotRunTestStatusList;
5 changes: 1 addition & 4 deletions client/components/ManageBotRunDialog/WithButton.jsx
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ const ManageBotRunDialogWithButton = ({
testPlanReportId,
runnableTestsLength,
testers,
includeIcon = false,
onChange
}) => {
const { runIsFinished } = useTestPlanRunIsFinished(testPlanRun.id);
@@ -28,8 +27,7 @@ const ManageBotRunDialogWithButton = ({
setShowDialog(true);
}}
>
{/* TODO: Include by default after removing Test Queue v1 content */}
{includeIcon ? <FontAwesomeIcon icon={faRobot} /> : null}
<FontAwesomeIcon icon={faRobot} />
Manage {testPlanRun?.tester?.username} Run
</Button>
{showDialog ? (
@@ -55,7 +53,6 @@ ManageBotRunDialogWithButton.propTypes = {
testPlanReportId: PropTypes.string.isRequired,
runnableTestsLength: PropTypes.number.isRequired,
testers: PropTypes.array.isRequired,
includeIcon: PropTypes.bool,
onChange: PropTypes.func.isRequired
};

1 change: 0 additions & 1 deletion client/components/TestQueue/Actions.jsx
Original file line number Diff line number Diff line change
@@ -272,7 +272,6 @@ const Actions = ({
runnableTestsLength={testPlanReport.runnableTestsLength}
testers={testers}
onChange={triggerUpdate}
includeIcon
/>
)}
{isAdmin && (
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@ const CompletionStatusListItem = ({
id={`BotTestCompletionStatus_${rowId}`}
testPlanRun={testPlanRun}
runnableTestsLength={testPlanReport.runnableTestsLength}
fromTestQueueV2
/>
);
} else {
@@ -51,7 +50,6 @@ const CompletionStatusListItem = ({
id={`PreviouslyAutomatedTestCompletionStatus_${rowId}`}
testPlanRunId={testPlanRun.id}
runnableTestsLength={testPlanReport.runnableTestsLength}
fromTestQueueV2
/>
) : (
<em>
5 changes: 1 addition & 4 deletions client/components/TestQueue/index.jsx
Original file line number Diff line number Diff line change
@@ -335,10 +335,7 @@ const TestQueue = () => {
fromTestQueue
/>
{hasBotRun ? (
<BotRunTestStatusList
testPlanReportId={testPlanReport.id}
fromTestQueueV2
/>
<BotRunTestStatusList testPlanReportId={testPlanReport.id} />
) : null}
</StatusContainer>
</td>
Original file line number Diff line number Diff line change
@@ -2,12 +2,7 @@ import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { useTestPlanRunValidatedAssertionCounts } from '../../../hooks/useTestPlanRunValidatedAssertionCounts';

const BotTestCompletionStatus = ({
testPlanRun,
id,
runnableTestsLength,
fromTestQueueV2 = false // TODO: Remove when Test Queue v1 is removed
}) => {
const BotTestCompletionStatus = ({ testPlanRun, id, runnableTestsLength }) => {
const {
totalValidatedAssertions,
totalPossibleAssertions,
@@ -23,25 +18,14 @@ const BotTestCompletionStatus = ({

return (
<>
{fromTestQueueV2 ? (
<ul id={id} style={{ fontSize: '0.875rem' }}>
<li>
<em>{`Responses for ${testResultsLength} of ${runnableTestsLength} tests recorded`}</em>
</li>
<li>
<em>{`Verdicts for ${totalValidatedAssertions} of ${totalPossibleAssertions} assertions assigned`}</em>
</li>
</ul>
) : (
<ul id={id} className="text-secondary">
<li>
{`Responses for ${testResultsLength} of ${runnableTestsLength} tests recorded`}
</li>
<li>
{`Verdicts for ${totalValidatedAssertions} of ${totalPossibleAssertions} assertions assigned`}
</li>
</ul>
)}
<ul id={id} style={{ fontSize: '0.875rem' }}>
<li>
<em>{`Responses for ${testResultsLength} of ${runnableTestsLength} tests recorded`}</em>
</li>
<li>
<em>{`Verdicts for ${totalValidatedAssertions} of ${totalPossibleAssertions} assertions assigned`}</em>
</li>
</ul>
</>
);
};
@@ -64,8 +48,7 @@ BotTestCompletionStatus.propTypes = {
)
}).isRequired,
id: PropTypes.string.isRequired,
runnableTestsLength: PropTypes.number.isRequired,
fromTestQueueV2: PropTypes.bool
runnableTestsLength: PropTypes.number.isRequired
};

export default BotTestCompletionStatus;
Original file line number Diff line number Diff line change
@@ -6,8 +6,7 @@ import { TEST_PLAN_RUN_ASSERTION_RESULTS_QUERY } from '../queries';
const PreviouslyAutomatedTestCompletionStatus = ({
runnableTestsLength,
testPlanRunId,
id,
fromTestQueueV2 = false // TODO: Remove when Test Queue v1 is removed
id
}) => {
const { data: testPlanRunAssertionsQueryResult } = useQuery(
TEST_PLAN_RUN_ASSERTION_RESULTS_QUERY,
@@ -40,24 +39,17 @@ const PreviouslyAutomatedTestCompletionStatus = ({

return (
<>
{fromTestQueueV2 ? (
<em id={id}>
{`${numValidatedTests} of ${runnableTestsLength} tests evaluated`}
</em>
) : (
<div id={id} className="text-secondary">
{`${numValidatedTests} of ${runnableTestsLength} tests evaluated`}
</div>
)}
<em id={id}>
{`${numValidatedTests} of ${runnableTestsLength} tests evaluated`}
</em>
</>
);
};

PreviouslyAutomatedTestCompletionStatus.propTypes = {
runnableTestsLength: PropTypes.number.isRequired,
testPlanRunId: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
fromTestQueueV2: PropTypes.bool
id: PropTypes.string.isRequired
};

export default PreviouslyAutomatedTestCompletionStatus;
Loading