Add server tests

This commit is contained in:
Ibukun Dairo 2020-04-27 21:02:39 +01:00
parent a54ff58804
commit 937652eb70
2 changed files with 1882 additions and 1845 deletions

File diff suppressed because it is too large Load Diff

37
smoke-test/server.test.js Normal file
View File

@ -0,0 +1,37 @@
const utils = require('./test-utils');
const puppeteer = require('puppeteer');
let page, browser;
describe('Check Server', () => {
beforeAll(async () => {
browser = await puppeteer.launch(utils.puppeteerLaunchConfig);
page = await browser.newPage();
});
afterAll(async () => {
await browser.close();
});
test('should get hosts mapping from server', async () => {
await page.goto(`${utils.BACKEND_URL}/server/hosts`, {
waitUntil: 'networkidle0',
});
const response = await page.$eval('body > pre', e => {
return e.innerHTML;
});
expect(response).toBe(
'{"api":"https://fyipe.com/api","home":"https://fyipe.com","accounts":"https://fyipe.com/accounts","dashboard":"https://fyipe.com/dashboard"}'
);
});
test('should get saas status true from server', async () => {
await page.goto(`${utils.BACKEND_URL}/server/is-saas-service`, {
waitUntil: 'networkidle0',
});
const response = await page.$eval('body > pre', e => {
return e.innerHTML;
});
expect(response).toBe('{"result":true}');
});
});