insomnia/packages/insomnia-smoke-test/designer/app.test.js
2021-02-03 20:07:11 +13:00

57 lines
1.7 KiB
JavaScript

import * as onboarding from '../modules/onboarding';
import * as client from '../modules/client';
import * as home from '../modules/home';
import * as settings from '../modules/settings';
import * as modal from '../modules/modal';
import * as dropdown from '../modules/dropdown';
import { isPackage, launchApp, stop } from '../modules/application';
const itIf = condition => (condition ? it : it.skip);
it.if = itIf;
describe('Application launch', function() {
jest.setTimeout(50000);
let app = null;
beforeEach(async () => {
app = await launchApp();
});
afterEach(async () => {
await stop(app);
});
it('can reset to and proceed through onboarding flow', async () => {
await client.correctlyLaunched(app);
await client.resetToOnboarding(app);
await onboarding.welcomeMessageShown(app);
await onboarding.clickDontShare(app);
await onboarding.clickSkipImport(app);
await home.documentListingShown(app);
});
it.if(isPackage())('can install and consume a plugin', async () => {
await client.correctlyLaunched(app);
await home.documentListingShown(app);
// Install plugin
await settings.openWithKeyboardShortcut(app);
await settings.goToPlugins(app);
await settings.installPlugin(app, 'insomnia-plugin-kong-bundle');
await settings.closeModal(app);
// Open card dropdown for any card
const dd = await home.openDocumentMenuDropdown(app);
// Click the "Deploy to Portal" button, installed from that plugin
await dropdown.clickDropdownItemByText(dd, 'Deploy to Portal');
// Ensure a modal opens, then close it - the rest is plugin behavior
await modal.waitUntilOpened(app, { title: 'Deploy to Portal' });
await modal.close(app);
});
});