diff --git a/server/index.js b/server/index.js index ff1e61c..f5df845 100644 --- a/server/index.js +++ b/server/index.js @@ -44,7 +44,8 @@ app.get('/api/reports/:id', async (req, res) => { }); app.post('/api/test', (req, res) => { - const filters = req.body.data; + const filters = req.body.data.filters; + const isParallel = req.body.data.isParallel; const tests = filters.tests.length; let done = 0; @@ -52,7 +53,7 @@ app.post('/api/test', (req, res) => { TastyRunner.setFilters(filters); - TastyRunner.run(filters.type, false, [], { + TastyRunner.run(filters.type, isParallel, [], { onTestEnd: () => { done ++; io.emit('tests:test:finished', Math.round((done / tests) * 100)); diff --git a/src/api.js b/src/api.js index 76cec70..7a57f8e 100644 --- a/src/api.js +++ b/src/api.js @@ -34,10 +34,13 @@ export const fetchTests = async (filters) => { } }; -export const runTests = async (filters) => { +export const runTests = async (filters, isParallel) => { try { const res = await axios.post('/api/test', { - data: filters, + data: { + filters, + isParallel + }, }); return res.data; diff --git a/src/subpages/Tests.js b/src/subpages/Tests.js index e32baee..4d4919c 100644 --- a/src/subpages/Tests.js +++ b/src/subpages/Tests.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Badge, Button, Col, ListGroup, Row, Spinner, Toast, ProgressBar } from 'react-bootstrap'; +import { Badge, Button, Col, ListGroup, Row, Spinner, Toast, ProgressBar, Form } from 'react-bootstrap'; import _ from 'lodash'; import * as api from '../api'; import { FaPlay as Run } from 'react-icons/fa'; @@ -16,6 +16,7 @@ class Tests extends React.Component { loadLog: '', errors: [], percentage: 0, + isParallelMode: false, }; socket = socketIOClient(); @@ -151,7 +152,7 @@ class Tests extends React.Component { [`${this.type}Log`]: '', }); - await api.runTests(filters); + await api.runTests(filters, this.state.isParallelMode); }; get type() { @@ -234,7 +235,7 @@ class Tests extends React.Component { }; render() { - const { tests, errors, percentage } = this.state; + const { tests, errors, percentage, isParallelMode } = this.state; if (!tests) return ; @@ -256,10 +257,21 @@ class Tests extends React.Component { this.renderStats() )} - - + + + + + this.setState({ isParallelMode: !isParallelMode })} + /> + +