Skip to content

Commit

Permalink
fix: Remove TestQueue v1 and update Test Queue e2e tests (#1146)
Browse files Browse the repository at this point in the history
* Move AssignTesterDropdown

* Removed original components/TestQueue and revised tests

* Additional removal of files

* Rename TestQueue2 -> TestQueue

* Address TODOs on removing Test Queue v1 vs v2 conditionals

* Remove unnecessary TODO
  • Loading branch information
howard-e committed Jul 10, 2024
1 parent 6a2ad32 commit fd6e86f
Show file tree
Hide file tree
Showing 37 changed files with 1,358 additions and 3,181 deletions.
6 changes: 3 additions & 3 deletions client/components/AddTestToQueueWithConfirmation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import { Button } from 'react-bootstrap';
import BasicModal from '../common/BasicModal';
import { useMutation, useQuery } from '@apollo/client';
import { ADD_TEST_QUEUE_MUTATION } from '../TestQueue/queries';
import { LoadingStatus, useTriggerLoad } from '../common/LoadingStatus';
import {
getBotUsernameFromAtBrowser,
Expand All @@ -12,9 +11,10 @@ import {
import './AddTestToQueueWithConfirmation.css';
import {
SCHEDULE_COLLECTION_JOB_MUTATION,
EXISTING_TEST_PLAN_REPORTS
EXISTING_TEST_PLAN_REPORTS,
ADD_TEST_QUEUE_MUTATION
} from './queries';
import { TEST_QUEUE_PAGE_QUERY } from '../TestQueue2/queries';
import { TEST_QUEUE_PAGE_QUERY } from '../TestQueue/queries';
import { TEST_PLAN_REPORT_STATUS_DIALOG_QUERY } from '../TestPlanReportStatusDialog/queries';
import { ME_QUERY } from '../App/queries';

Expand Down
35 changes: 35 additions & 0 deletions client/components/AddTestToQueueWithConfirmation/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,38 @@ export const EXISTING_TEST_PLAN_REPORTS = gql`
}
}
`;

export const ADD_TEST_QUEUE_MUTATION = gql`
mutation AddTestPlanReport(
$testPlanVersionId: ID!
$atId: ID!
$exactAtVersionId: ID
$minimumAtVersionId: ID
$browserId: ID!
$copyResultsFromTestPlanVersionId: ID
) {
createTestPlanReport(
input: {
testPlanVersionId: $testPlanVersionId
atId: $atId
exactAtVersionId: $exactAtVersionId
minimumAtVersionId: $minimumAtVersionId
browserId: $browserId
copyResultsFromTestPlanVersionId: $copyResultsFromTestPlanVersionId
}
) {
testPlanReport {
id
at {
id
}
browser {
id
}
}
testPlanVersion {
id
}
}
}
`;
69 changes: 12 additions & 57 deletions client/components/BotRunTestStatusList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +16,7 @@ const BotRunTestContainer = styled.div`
white-space: nowrap;
`;

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

Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Up @@ -11,7 +11,6 @@ const ManageBotRunDialogWithButton = ({
testPlanReportId,
runnableTestsLength,
testers,
includeIcon = false,
onChange
}) => {
const { runIsFinished } = useTestPlanRunIsFinished(testPlanRun.id);
Expand All @@ -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 ? (
Expand All @@ -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
};

Expand Down
2 changes: 1 addition & 1 deletion client/components/ManageBotRunDialog/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import BasicModal from '../common/BasicModal';
import AssignTesterDropdown from '../TestQueue/AssignTesterDropdown';
import AssignTesterDropdown from '../common/AssignTesterDropdown';
import { useMutation, useQuery } from '@apollo/client';
import {
COLLECTION_JOB_ID_BY_TEST_PLAN_RUN_ID_QUERY,
Expand Down
6 changes: 1 addition & 5 deletions client/components/ManageTestQueue/ManageAtVersions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ADD_AT_VERSION_MUTATION,
DELETE_AT_VERSION_MUTATION,
EDIT_AT_VERSION_MUTATION
} from '@components/TestQueue/queries';
} from './queries';
import { useTriggerLoad } from '@components/common/LoadingStatus';
import { THEMES, useThemedModal } from '@client/hooks/useThemedModal';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -357,24 +357,20 @@ const ManageAtVersions = ({ ats = [], triggerUpdate = () => {} }) => {
</Form.Group>
<div className="disclosure-buttons-row">
<button
// ref={addAtVersionButtonRef}
ref={ref => setFocusRef(ref)}
onClick={() => onOpenAtVersionModalClick('add')}
>
Add a New Version
</button>
<button
// ref={editAtVersionButtonRef}
ref={ref => setFocusRef(ref)}
onClick={() => onOpenAtVersionModalClick('edit')}
>
<FontAwesomeIcon icon={faEdit} />
Edit
</button>
<button
// ref={deleteAtVersionButtonRef}
ref={ref => setFocusRef(ref)}
// onClick={onRemoveClick}
onClick={() => onOpenAtVersionModalClick('delete')}
>
<FontAwesomeIcon icon={faTrashAlt} />
Expand Down
58 changes: 58 additions & 0 deletions client/components/ManageTestQueue/queries.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { gql } from '@apollo/client';

export const ADD_AT_VERSION_MUTATION = gql`
mutation AddAtVersion($atId: ID!, $name: String!, $releasedAt: Timestamp!) {
at(id: $atId) {
findOrCreateAtVersion(input: { name: $name, releasedAt: $releasedAt }) {
id
name
releasedAt
}
}
}
`;

export const EDIT_AT_VERSION_MUTATION = gql`
mutation EditAtVersion(
$atVersionId: ID!
$name: String!
$releasedAt: Timestamp!
) {
atVersion(id: $atVersionId) {
updateAtVersion(input: { name: $name, releasedAt: $releasedAt }) {
id
name
releasedAt
}
}
}
`;

export const DELETE_AT_VERSION_MUTATION = gql`
mutation DeleteAtVersion($atVersionId: ID!) {
atVersion(id: $atVersionId) {
deleteAtVersion {
isDeleted
failedDueToTestResults {
testPlanVersion {
id
title
}
# To be used when listing the conflicting results
testResult {
id
}
# To be used when providing more details on the conflicting results
testPlanReport {
at {
name
}
browser {
name
}
}
}
}
}
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
MARK_TEST_PLAN_REPORT_AS_FINAL_MUTATION,
REMOVE_TEST_PLAN_REPORT_MUTATION,
TEST_QUEUE_PAGE_QUERY
// TEST_PLAN_REPORT_QUERY
} from './queries';
import useForceUpdate from '../../hooks/useForceUpdate';
import BasicThemedModal from '../common/BasicThemedModal';
Expand Down Expand Up @@ -273,7 +272,6 @@ const Actions = ({
runnableTestsLength={testPlanReport.runnableTestsLength}
testers={testers}
onChange={triggerUpdate}
includeIcon
/>
)}
{isAdmin && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const CompletionStatusListItem = ({
id={`BotTestCompletionStatus_${rowId}`}
testPlanRun={testPlanRun}
runnableTestsLength={testPlanReport.runnableTestsLength}
fromTestQueueV2
/>
);
} else {
Expand All @@ -51,7 +50,6 @@ const CompletionStatusListItem = ({
id={`PreviouslyAutomatedTestCompletionStatus_${rowId}`}
testPlanRunId={testPlanRun.id}
runnableTestsLength={testPlanReport.runnableTestsLength}
fromTestQueueV2
/>
) : (
<em>
Expand Down
Loading

0 comments on commit fd6e86f

Please sign in to comment.