trying bigget timeout

This commit is contained in:
Pavel Murygin 2022-02-22 20:38:25 +03:00
parent 1d23def404
commit c239be12f2
9 changed files with 55 additions and 58 deletions

View File

@ -3,29 +3,28 @@ import http from 'http';
import path from 'path'; import path from 'path';
const port = 3001; const port = 3001;
const uri = `http://localhost:${port}/` const uri = `http://localhost:${port}/`;
const publicPath = path.join(__dirname, '../../build/'); const publicPath = path.join(__dirname, '../../build/');
console.log(publicPath); console.log(publicPath);
const server = http.createServer((request, response) => { const server = http.createServer((request, response) => {
return handler(request, response, { return handler(request, response, {
public: publicPath public: publicPath,
}); });
}) });
const startServer = async () => { const startServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.listen(port, resolve); server.listen(port, resolve);
}) });
} };
const stopServer = async () => { const stopServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.close(resolve); server.close(resolve);
}) });
} };
describe('smoke test', () => { describe('smoke test', () => {
beforeAll(startServer); beforeAll(startServer);
@ -38,10 +37,10 @@ describe('smoke test', () => {
console.log('clicking connect button...'); console.log('clicking connect button...');
await page.click('.btn-connect'); await page.click('.btn-connect');
console.log('waiting for fluence to connect...'); console.log('waiting for fluence to connect...');
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
console.log('waiting for "deploy service" button to appear...'); console.log('waiting for "deploy service" button to appear...');
await page.waitForSelector('#deploy-service'); await page.waitForSelector('#deploy-service');
@ -56,9 +55,9 @@ describe('smoke test', () => {
console.log('waiting for result to appear...'); console.log('waiting for result to appear...');
const sizeEl = await page.waitForSelector('#file-size'); const sizeEl = await page.waitForSelector('#file-size');
const size = await sizeEl?.evaluate(x => x.textContent);
expect(size).toBe("144804"); const size = await sizeEl?.evaluate((x) => x.textContent);
}, 10000);
expect(size).toBe('144804');
}, 15000);
}); });

View File

@ -30,5 +30,5 @@ describe('smoke test', () => {
'Hi, Jake', 'Hi, Jake',
'Bye, Jake', 'Bye, Jake',
]); ]);
}, 10000); }, 15000);
}); });

View File

@ -17,5 +17,5 @@ describe('smoke test', () => {
result: expect.any(Number), result: expect.any(Number),
success: true, success: true,
}); });
}, 10000); }, 15000);
}); });

View File

@ -3,29 +3,28 @@ import http from 'http';
import path from 'path'; import path from 'path';
const port = 3000; const port = 3000;
const uri = `http://localhost:${port}/` const uri = `http://localhost:${port}/`;
const publicPath = path.join(__dirname, '../../build/'); const publicPath = path.join(__dirname, '../../build/');
console.log(publicPath); console.log(publicPath);
const server = http.createServer((request, response) => { const server = http.createServer((request, response) => {
return handler(request, response, { return handler(request, response, {
public: publicPath public: publicPath,
}); });
}) });
const startServer = async () => { const startServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.listen(port, resolve); server.listen(port, resolve);
}) });
} };
const stopServer = async () => { const stopServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.close(resolve); server.close(resolve);
}) });
} };
describe('smoke test', () => { describe('smoke test', () => {
beforeAll(startServer); beforeAll(startServer);
@ -48,6 +47,6 @@ describe('smoke test', () => {
console.log('getting the content of price div...'); console.log('getting the content of price div...');
const content = await elem?.evaluate((x) => x.textContent); const content = await elem?.evaluate((x) => x.textContent);
expect(content).toMatch("The price is:") expect(content).toMatch('The price is:');
}, 10000); }, 15000);
}); });

View File

@ -3,29 +3,28 @@ import http from 'http';
import path from 'path'; import path from 'path';
const port = 3000; const port = 3000;
const uri = `http://localhost:${port}/` const uri = `http://localhost:${port}/`;
const publicPath = path.join(__dirname, '../../build/'); const publicPath = path.join(__dirname, '../../build/');
console.log(publicPath); console.log(publicPath);
const server = http.createServer((request, response) => { const server = http.createServer((request, response) => {
return handler(request, response, { return handler(request, response, {
public: publicPath public: publicPath,
}); });
}) });
const startServer = async () => { const startServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.listen(port, resolve); server.listen(port, resolve);
}) });
} };
const stopServer = async () => { const stopServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.close(resolve); server.close(resolve);
}) });
} };
describe('smoke test', () => { describe('smoke test', () => {
beforeAll(startServer); beforeAll(startServer);
@ -49,5 +48,5 @@ describe('smoke test', () => {
const content = await elem?.evaluate((x) => x.textContent); const content = await elem?.evaluate((x) => x.textContent);
expect(content?.length).toBeGreaterThan(10); expect(content?.length).toBeGreaterThan(10);
}, 10000); }, 15000);
}); });

View File

@ -10,5 +10,5 @@ describe('smoke test', () => {
expect(console.log).toHaveBeenNthCalledWith(1, 'Hello, world!'); expect(console.log).toHaveBeenNthCalledWith(1, 'Hello, world!');
expect(console.log).toHaveBeenNthCalledWith(2, 'Wealth awaits you very soon.'); expect(console.log).toHaveBeenNthCalledWith(2, 'Wealth awaits you very soon.');
expect(console.log).toHaveBeenNthCalledWith(3, 'The relay time is: ', expect.anything()); expect(console.log).toHaveBeenNthCalledWith(3, 'The relay time is: ', expect.anything());
}, 10000); }, 15000);
}); });

View File

@ -8,5 +8,5 @@ describe('smoke test', () => {
const res = await demoCalculation(); const res = await demoCalculation();
expect(res).toBe(7); expect(res).toBe(7);
}, 10000); }, 15000);
}); });

View File

@ -4,28 +4,28 @@ import http from 'http';
import path from 'path'; import path from 'path';
const port = 3000; const port = 3000;
const uri = `http://localhost:${port}/` const uri = `http://localhost:${port}/`;
const publicPath = path.join(__dirname, '../../build/'); const publicPath = path.join(__dirname, '../../build/');
console.log(publicPath); console.log(publicPath);
const server = http.createServer((request, response) => { const server = http.createServer((request, response) => {
return handler(request, response, { return handler(request, response, {
public: publicPath public: publicPath,
}); });
}) });
const startServer = async () => { const startServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.listen(port, resolve); server.listen(port, resolve);
}) });
} };
const stopServer = async () => { const stopServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.close(resolve); server.close(resolve);
}) });
} };
const peerIdLength = '12D3KooWM2CYSHefG6KPKbYFAgsbPh8p6b8HYHc6VNkge2rPtYv5'.length; const peerIdLength = '12D3KooWM2CYSHefG6KPKbYFAgsbPh8p6b8HYHc6VNkge2rPtYv5'.length;
@ -100,5 +100,5 @@ describe('smoke test', () => {
expect(page1Message).toBe('Hello back to you, ' + peerRelay1.peerId); expect(page1Message).toBe('Hello back to you, ' + peerRelay1.peerId);
expect(page2Message).toBe('Hello from: ' + peerRelay1.peerId); expect(page2Message).toBe('Hello from: ' + peerRelay1.peerId);
}, 10000); }, 15000);
}); });

View File

@ -4,28 +4,28 @@ import http from 'http';
import path from 'path'; import path from 'path';
const port = 3000; const port = 3000;
const uri = `http://localhost:${port}/` const uri = `http://localhost:${port}/`;
const publicPath = path.join(__dirname, '../../build/'); const publicPath = path.join(__dirname, '../../build/');
console.log(publicPath); console.log(publicPath);
const server = http.createServer((request, response) => { const server = http.createServer((request, response) => {
return handler(request, response, { return handler(request, response, {
public: publicPath public: publicPath,
}); });
}) });
const startServer = async () => { const startServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.listen(port, resolve); server.listen(port, resolve);
}) });
} };
const stopServer = async () => { const stopServer = async () => {
return new Promise((resolve: any) => { return new Promise((resolve: any) => {
server.close(resolve); server.close(resolve);
}) });
} };
const peerIdLength = '12D3KooWM2CYSHefG6KPKbYFAgsbPh8p6b8HYHc6VNkge2rPtYv5'.length; const peerIdLength = '12D3KooWM2CYSHefG6KPKbYFAgsbPh8p6b8HYHc6VNkge2rPtYv5'.length;
const loadApp = async (page: Page) => { const loadApp = async (page: Page) => {
@ -99,5 +99,5 @@ describe('smoke test', () => {
expect(page1Message).toBe('Hello back to you, ' + peerRelay1.peerId); expect(page1Message).toBe('Hello back to you, ' + peerRelay1.peerId);
expect(page2Message).toBe('Hello from: ' + peerRelay1.peerId); expect(page2Message).toBe('Hello from: ' + peerRelay1.peerId);
}, 10000); }, 15000);
}); });