forked from extern/bruno
feat: scripting and testing support in graphql has arrived
This commit is contained in:
parent
6f6dedbb9c
commit
b76ddcd007
@ -8,6 +8,8 @@ import { updateRequestPaneTab } from 'providers/ReduxStore/slices/tabs';
|
|||||||
import QueryEditor from 'components/RequestPane/QueryEditor';
|
import QueryEditor from 'components/RequestPane/QueryEditor';
|
||||||
import GraphQLVariables from 'components/RequestPane/GraphQLVariables';
|
import GraphQLVariables from 'components/RequestPane/GraphQLVariables';
|
||||||
import RequestHeaders from 'components/RequestPane/RequestHeaders';
|
import RequestHeaders from 'components/RequestPane/RequestHeaders';
|
||||||
|
import Script from 'components/RequestPane/Script';
|
||||||
|
import Tests from 'components/RequestPane/Tests';
|
||||||
import { useTheme } from 'providers/Theme';
|
import { useTheme } from 'providers/Theme';
|
||||||
import { updateRequestGraphqlQuery } from 'providers/ReduxStore/slices/collections';
|
import { updateRequestGraphqlQuery } from 'providers/ReduxStore/slices/collections';
|
||||||
import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collections/actions';
|
import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
@ -89,6 +91,12 @@ const GraphQLRequestPane = ({ item, collection, leftPaneWidth, onSchemaLoad, tog
|
|||||||
case 'headers': {
|
case 'headers': {
|
||||||
return <RequestHeaders item={item} collection={collection} />;
|
return <RequestHeaders item={item} collection={collection} />;
|
||||||
}
|
}
|
||||||
|
case 'script': {
|
||||||
|
return <Script item={item} collection={collection} />;
|
||||||
|
}
|
||||||
|
case 'tests': {
|
||||||
|
return <Tests item={item} collection={collection} />;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
return <div className="mt-4">404 | Not found</div>;
|
return <div className="mt-4">404 | Not found</div>;
|
||||||
}
|
}
|
||||||
@ -122,6 +130,12 @@ const GraphQLRequestPane = ({ item, collection, leftPaneWidth, onSchemaLoad, tog
|
|||||||
<div className={getTabClassname('headers')} role="tab" onClick={() => selectTab('headers')}>
|
<div className={getTabClassname('headers')} role="tab" onClick={() => selectTab('headers')}>
|
||||||
Headers
|
Headers
|
||||||
</div>
|
</div>
|
||||||
|
<div className={getTabClassname('script')} role="tab" onClick={() => selectTab('script')}>
|
||||||
|
Script
|
||||||
|
</div>
|
||||||
|
<div className={getTabClassname('tests')} role="tab" onClick={() => selectTab('tests')}>
|
||||||
|
Tests
|
||||||
|
</div>
|
||||||
<div className="flex flex-grow justify-end items-center" style={{fontSize: 13}}>
|
<div className="flex flex-grow justify-end items-center" style={{fontSize: 13}}>
|
||||||
<div className='flex items-center cursor-pointer hover:underline' onClick={loadGqlSchema}>
|
<div className='flex items-center cursor-pointer hover:underline' onClick={loadGqlSchema}>
|
||||||
{isSchemaLoading ? (
|
{isSchemaLoading ? (
|
||||||
|
@ -161,7 +161,7 @@ export const runCollectionFolder = (collectionUid, folderUid, recursive) => (dis
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
ipcRenderer
|
ipcRenderer
|
||||||
.invoke('renderer:run-collection-folder', folder, collectionCopy, environment, recursive)
|
.invoke('renderer:run-collection-folder', folder, collectionCopy, environment, collectionCopy.collectionVariables, recursive)
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
toast.error(get(err, 'error.message') || 'Something went wrong!');
|
toast.error(get(err, 'error.message') || 'Something went wrong!');
|
||||||
|
@ -220,7 +220,7 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('renderer:run-collection-folder', async (event, folder, collection, environment, recursive) => {
|
ipcMain.handle('renderer:run-collection-folder', async (event, folder, collection, environment, collectionVariables, recursive) => {
|
||||||
const collectionUid = collection.uid;
|
const collectionUid = collection.uid;
|
||||||
const collectionPath = collection.pathname;
|
const collectionPath = collection.pathname;
|
||||||
const folderUid = folder ? folder.uid : null;
|
const folderUid = folder ? folder.uid : null;
|
||||||
|
Loading…
Reference in New Issue
Block a user