mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-20 14:17:29 -04:00
Add babel to smoke tests (#2658)
This commit is contained in:
15
packages/insomnia-smoke-test/.babelrc
Normal file
15
packages/insomnia-smoke-test/.babelrc
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "12"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
["@babel/plugin-proposal-optional-chaining"]
|
||||
]
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
const Application = require('spectron').Application;
|
||||
// const fs = require('fs');
|
||||
const electronPath = require('../../insomnia-app/node_modules/electron');
|
||||
const path = require('path');
|
||||
const debug = require('../modules/debug');
|
||||
const client = require('../modules/client');
|
||||
import { Application } from 'spectron';
|
||||
import electronPath from '../../insomnia-app/node_modules/electron';
|
||||
import path from 'path';
|
||||
import * as debug from '../modules/debug';
|
||||
import * as client from '../modules/client';
|
||||
|
||||
describe('Application launch', function() {
|
||||
jest.setTimeout(50000);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const onboarding = require('../modules/onboarding');
|
||||
const client = require('../modules/client');
|
||||
const home = require('../modules/home');
|
||||
import * as onboarding from '../modules/onboarding';
|
||||
import * as client from '../modules/client';
|
||||
import * as home from '../modules/home';
|
||||
|
||||
const Application = require('spectron').Application;
|
||||
const electronPath = require('../../insomnia-app/node_modules/electron');
|
||||
const path = require('path');
|
||||
import { Application } from 'spectron';
|
||||
import electronPath from '../../insomnia-app/node_modules/electron';
|
||||
import path from 'path';
|
||||
|
||||
describe('Application launch', function() {
|
||||
jest.setTimeout(50000);
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
const correctlyLaunched = async app => {
|
||||
export const correctlyLaunched = async app => {
|
||||
await expect(app.browserWindow.isDevToolsOpened()).resolves.toBe(false);
|
||||
await expect(app.client.getWindowCount()).resolves.toBe(1);
|
||||
await expect(app.browserWindow.isMinimized()).resolves.toBe(false);
|
||||
await expect(app.browserWindow.isFocused()).resolves.toBe(true);
|
||||
};
|
||||
|
||||
const resetToOnboarding = async app => {
|
||||
export const resetToOnboarding = async app => {
|
||||
await app.webContents.executeJavaScript("localStorage['insomnia::meta::activity'] = null;");
|
||||
await app.browserWindow.reload(); // reload for local storage clearing to take effect
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
correctlyLaunched,
|
||||
resetToOnboarding,
|
||||
};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const faker = require('faker');
|
||||
import faker from 'faker';
|
||||
|
||||
const workspaceDropdownExists = async (app, workspaceName = 'Insomnia') => {
|
||||
export const workspaceDropdownExists = async (app, workspaceName = 'Insomnia') => {
|
||||
await app.client.waitUntilTextExists('.workspace-dropdown', workspaceName);
|
||||
};
|
||||
|
||||
const createNewRequest = async (app, name) => {
|
||||
export const createNewRequest = async (app, name) => {
|
||||
await app.client.$('.sidebar .dropdown .fa-plus-circle').then(e => e.click());
|
||||
|
||||
await app.client
|
||||
@@ -41,46 +41,36 @@ const waitUntilRequestIsActive = async (app, name) => {
|
||||
await app.client.waitUntil(requestIsActive);
|
||||
};
|
||||
|
||||
const typeInUrlBar = async (app, url) => {
|
||||
export const typeInUrlBar = async (app, url) => {
|
||||
const urlEditor = await app.client.react$('RequestUrlBar');
|
||||
await urlEditor.waitForExist();
|
||||
await urlEditor.click();
|
||||
await urlEditor.keys(url);
|
||||
};
|
||||
|
||||
const clickSendRequest = async app => {
|
||||
export const clickSendRequest = async app => {
|
||||
await app.client
|
||||
.react$('RequestUrlBar')
|
||||
.then(e => e.$('.urlbar__send-btn'))
|
||||
.then(e => e.click());
|
||||
};
|
||||
|
||||
const expect200 = async app => {
|
||||
export const expect200 = async app => {
|
||||
const tag = await app.client.$('.response-pane .pane__header .tag.bg-success');
|
||||
await tag.waitForDisplayed();
|
||||
await expect(tag.getText()).resolves.toBe('200 OK');
|
||||
};
|
||||
|
||||
const getCsvViewer = async app => {
|
||||
export const getCsvViewer = async app => {
|
||||
const csvViewer = await app.client.react$('ResponseCSVViewer');
|
||||
await csvViewer.waitForDisplayed();
|
||||
return csvViewer;
|
||||
};
|
||||
|
||||
const getPdfCanvas = async app => {
|
||||
export const getPdfCanvas = async app => {
|
||||
const pdfViewer = await app.client.react$('ResponsePDFViewer');
|
||||
await pdfViewer.waitForDisplayed();
|
||||
const canvas = await pdfViewer.$('.S-PDF-ID canvas');
|
||||
await canvas.waitForDisplayed();
|
||||
return canvas;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
workspaceDropdownExists,
|
||||
createNewRequest,
|
||||
typeInUrlBar,
|
||||
clickSendRequest,
|
||||
expect200,
|
||||
getCsvViewer,
|
||||
getPdfCanvas,
|
||||
};
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
const documentListingShown = async app => {
|
||||
export const documentListingShown = async app => {
|
||||
const item = await app.client.$('.document-listing');
|
||||
await item.waitForExist();
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
documentListingShown,
|
||||
};
|
||||
|
||||
@@ -1,26 +1,20 @@
|
||||
const welcomeMessageShown = async app => {
|
||||
export const welcomeMessageShown = async app => {
|
||||
await app.client.waitUntilTextExists(
|
||||
'.onboarding__content__header h1',
|
||||
'Welcome to Insomnia Designer',
|
||||
);
|
||||
};
|
||||
|
||||
const clickDontShare = async app => {
|
||||
export const clickDontShare = async app => {
|
||||
await app.client
|
||||
.$('.onboarding__content__body')
|
||||
.then(e => e.$(`button=Don't share usage analytics`))
|
||||
.then(e => e.click());
|
||||
};
|
||||
|
||||
const clickSkipImport = async app => {
|
||||
export const clickSkipImport = async app => {
|
||||
await app.client
|
||||
.$('.onboarding__content__body')
|
||||
.then(e => e.$(`button=Skip`))
|
||||
.then(e => e.click());
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
welcomeMessageShown,
|
||||
clickDontShare,
|
||||
clickSkipImport,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user