Skip to content

Commit 572023e

Browse files
committed
testing suite revision
1 parent ad0e38c commit 572023e

File tree

7 files changed

+19
-24
lines changed

7 files changed

+19
-24
lines changed

src/client/components-v2/main/response/EventsContainer.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import CodeMirror from '@uiw/react-codemirror';
44
// import { UnControlled as CodeMirror } from 'react-codemirror2';
55
import EmptyState from '../../../components/display/EmptyState';
66
import EventPreview from '../../../components/display/EventPreview';
7-
import { json } from '@codemirror/lang-json';
87
import { EditorView } from "@codemirror/view"
8+
import { javascript } from '@codemirror/lang-javascript';
9+
910

1011
function EventsContainer({ currentResponse }) {
1112
const { request, response } = currentResponse;

src/client/components/composer/NewRequest/BodyTypeSelect.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const BodyTypeSelect = (props) => {
6161
<div className="dropdown-trigger">
6262
<button
6363
className="button is-small is-outlined is-primary mr-3 add-header-or-cookie-button"
64+
id = "body-type-select"
6465
aria-haspopup="true"
6566
aria-controls="dropdown-menu"
6667
onClick={() => setDropdownIsActive(!dropdownIsActive)}

src/client/components/composer/NewRequest/RawBodyTypeSelect.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const RawBodyTypeSelect = (props) => {
6161
<div className="dropdown-trigger">
6262
<button
6363
className="button is-small is-primary is-outlined add-header-or-cookie-button"
64+
id = "raw-body-type"
6465
aria-haspopup="true"
6566
aria-controls="dropdown-menu"
6667
onClick={() => setDropdownIsActive(!dropdownIsActive)}

test/subSuites/graphqlTest.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ module.exports = () => {
5555
) => {
5656
try {
5757
// click and check GRAPHQL
58-
await page.locator('#selected-network').click();
59-
await page.locator('#composer >> a >> text=GRAPHQL').click();
58+
await page.locator('button>> text=GRAPHQL').click();
6059

6160
// click and select METHOD if it isn't QUERY
6261
if (method !== 'QUERY') {

test/subSuites/httpTest.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,45 +44,44 @@ module.exports = () => {
4444
cookies = []
4545
) => {
4646
try {
47-
// click and check REST
48-
await page.locator('#selected-network').click();
49-
await page.locator('#composer >> a >> text=REST').click();
47+
// Make sure HTTP2 method is selected
48+
await page.locator('button>> text=HTTP2').click();
5049

5150
// click and select METHOD if it isn't GET
5251
if (method !== 'GET') {
53-
await page.locator('#composer >> button.is-rest').click();
54-
await page.locator(`#composer >> a >> text=${method}`).click();
52+
await page.locator('button#rest-method').click();
53+
await page.locator(`div[id^="composer"] >> a >> text=${method}`).click();
5554
}
5655

5756
// type in url
58-
await page.locator('.input-is-medium').fill(url);
57+
await page.locator('#url-input').fill(url);
5958

6059
// set headers
6160
headers.forEach(async ({ key, value }, index) => {
6261
await page.locator(`#header-row${index} >> [placeholder="Key"]`).fill(key);
6362
await page.locator(`#header-row${index} >> [placeholder="Value"]`).fill(value);
64-
await page.locator('button:near(:text("Headers"), 5)').click();
63+
await page.locator('#add-header').click();
6564
});
6665

6766
// set cookies
6867
cookies.forEach(async ({ key, value }, index) => {
6968
await page.locator(`#cookie-row${index} >> [placeholder="Key"]`).fill(key);
7069
await page.locator(`#cookie-row${index} >> [placeholder="Value"]`).fill(value);
71-
await page.locator('button:near(:text("Cookies"), 5)').click();
70+
await page.locator('#add-cookie').click();
7271
});
7372

7473
// Add BODY as JSON if it isn't GET
7574
if (method !== 'GET') {
7675
// select body type JSON
77-
if (await page.locator('button:visible >> text=text/plain').count()===1){
78-
await page.locator('button >> text=text/plain').click();
79-
await page.locator('a >> text=application/json').click();
76+
if (await page.locator('#body-type-select').innerText()==='raw'){
77+
await page.locator('#raw-body-type').click();
78+
await page.locator('.dropdown-item >> text=application/json').click();
8079
}
8180

8281
// insert JSON content into body
8382
const codeMirror = await page.locator('#body-entry-select');
8483
await codeMirror.click();
85-
const restBody = await codeMirror.locator('textarea');
84+
const restBody = await codeMirror.locator('.cm-content');
8685

8786
try {
8887
for (let i = 0; i < 100; i += 1) {
@@ -133,7 +132,6 @@ module.exports = () => {
133132
});
134133
});
135134

136-
/** *************** !! FOR BELOW TO WORK, YOU MUST ADD YOUR OWN MONGO URI TO A .ENV FILE WITH (MONGO_URI = "YOUR_URI") !! **************** */
137135
describe('httpTest Server', () => {
138136
before('CLEAR DB', (done) => {
139137
chai

test/subSuites/reqInputTests.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,18 @@ module.exports = () => {
9393

9494
it('can select a request type', async () => {
9595
// possibly remove the first clicks based on button vs dropdown menu
96-
// await page.locator('#selected-network').click();
9796
await page.locator('button>> text=GRAPHQL').click();
9897
expect(await page.locator('div#composer-graphql').count()).to.equal(1)
9998

100-
// await page.locator('#selected-network').click();
10199
await page.locator('button>> text=HTTP2').click();
102100
expect(await page.locator('div#composer-http2').count()).to.equal(1)
103101

104-
// await page.locator('#selected-network').click();
105102
await page.locator('button>> text=GRPC').click();
106103
expect(await page.locator('div#composer-grpc').count()).to.equal(1)
107104

108-
// await page.locator('#selected-network').click();
109105
await page.locator('button>> text=WEB SOCKET').click();
110106
expect(await page.locator('div#composer-websocket').count()).to.equal(1)
111107

112-
// await page.locator('#selected-network').click();
113108
await page.locator('button>> text=WEBRTC').click();
114109
expect(await page.locator('div#composer-webrtc').count()).to.equal(1)
115110

@@ -251,7 +246,7 @@ module.exports = () => {
251246
const input = 'Team Swell is the best!';
252247
const bodyInput = await page.locator('div.cm-line');
253248
await bodyInput.fill(input);
254-
expect(await page.locator('div.CodeMirror-code >> span').innerText()).to.equal(input)
249+
expect(await page.locator('div.cm-content').innerText()).to.equal(input)
255250
});
256251
});
257252
});

test/testSuite.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ fs.emptyDirSync(path.resolve(__dirname + '/failedTests'));
2222

2323

2424
// Testing suite
25-
xdescribe('Electron UI Rendering', function () {
25+
describe('Electron UI Rendering', function () {
2626
appOpensTests();
2727
}).timeout(10000);
2828

2929
describe('CRUD functionality', function () {
3030
reqInputTests();
3131
httpTest();
32-
// graphqlTest();
32+
graphqlTest();
3333
// websocketTest();
3434
// grpcTest();
3535
// webRTCTest();

0 commit comments

Comments
 (0)