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

View File

@ -1333,29 +1333,29 @@ export const collectionsSlice = createSlice({
}
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.requestSent = action.payload.requestSent;
}
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.responseReceived = action.payload.responseReceived;
}
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;
}
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;
}
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.responseReceived = action.payload.responseReceived;
item.status = 'error';