fix(#1215): fixed issue where runner was not displaying test results

This commit is contained in:
Anoop M D 2023-12-18 03:58:40 +05:30
parent cb6513c580
commit 983fb2c4fd
2 changed files with 10 additions and 9 deletions

View File

@ -15,9 +15,9 @@ import StyledWrapper from './StyledWrapper';
const ResponsePane = ({ rightPaneWidth, item, collection }) => { const ResponsePane = ({ rightPaneWidth, item, collection }) => {
const [selectedTab, setSelectedTab] = useState('response'); const [selectedTab, setSelectedTab] = useState('response');
const { requestSent, responseReceived, testResults } = item; const { requestSent, responseReceived, testResults, assertionResults } = item;
const headers = get(item, 'responseReceived.headers', {}); const headers = get(item, 'responseReceived.headers', []);
const status = get(item, 'responseReceived.status', 0); const status = get(item, 'responseReceived.status', 0);
const size = get(item, 'responseReceived.size', 0); const size = get(item, 'responseReceived.size', 0);
const duration = get(item, 'responseReceived.duration', 0); const duration = get(item, 'responseReceived.duration', 0);
@ -47,7 +47,7 @@ const ResponsePane = ({ rightPaneWidth, item, collection }) => {
return <Timeline request={requestSent} response={responseReceived} />; return <Timeline request={requestSent} response={responseReceived} />;
} }
case 'tests': { case 'tests': {
return <TestResults results={testResults} />; return <TestResults results={testResults} assertionResults={assertionResults} />;
} }
default: { default: {
@ -70,12 +70,13 @@ const ResponsePane = ({ rightPaneWidth, item, collection }) => {
</div> </div>
<div className={getTabClassname('headers')} role="tab" onClick={() => selectTab('headers')}> <div className={getTabClassname('headers')} role="tab" onClick={() => selectTab('headers')}>
Headers Headers
{headers?.length > 0 && <sup className="ml-1 font-medium">{headers.length}</sup>}
</div> </div>
<div className={getTabClassname('timeline')} role="tab" onClick={() => selectTab('timeline')}> <div className={getTabClassname('timeline')} role="tab" onClick={() => selectTab('timeline')}>
Timeline Timeline
</div> </div>
<div className={getTabClassname('tests')} role="tab" onClick={() => selectTab('tests')}> <div className={getTabClassname('tests')} role="tab" onClick={() => selectTab('tests')}>
<TestResultsLabel results={testResults} /> <TestResultsLabel results={testResults} assertionResults={assertionResults} />
</div> </div>
<div className="flex flex-grow justify-end items-center"> <div className="flex flex-grow justify-end items-center">
<StatusCode status={status} /> <StatusCode status={status} />

View File

@ -1333,29 +1333,29 @@ export const collectionsSlice = createSlice({
} }
if (type === 'request-sent') { if (type === 'request-sent') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'queued'); const item = collection.runnerResult.items.find((i) => i.uid === request.uid);
item.status = 'running'; item.status = 'running';
item.requestSent = action.payload.requestSent; item.requestSent = action.payload.requestSent;
} }
if (type === 'response-received') { if (type === 'response-received') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'running'); const item = collection.runnerResult.items.find((i) => i.uid === request.uid);
item.status = 'completed'; item.status = 'completed';
item.responseReceived = action.payload.responseReceived; item.responseReceived = action.payload.responseReceived;
} }
if (type === 'test-results') { if (type === 'test-results') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'running'); const item = collection.runnerResult.items.find((i) => i.uid === request.uid);
item.testResults = action.payload.testResults; item.testResults = action.payload.testResults;
} }
if (type === 'assertion-results') { if (type === 'assertion-results') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'running'); const item = collection.runnerResult.items.find((i) => i.uid === request.uid);
item.assertionResults = action.payload.assertionResults; item.assertionResults = action.payload.assertionResults;
} }
if (type === 'error') { if (type === 'error') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'running'); const item = collection.runnerResult.items.find((i) => i.uid === request.uid);
item.error = action.payload.error; item.error = action.payload.error;
item.responseReceived = action.payload.responseReceived; item.responseReceived = action.payload.responseReceived;
item.status = 'error'; item.status = 'error';