Commit 1b5e7cee by Dominik Prokop Committed by Ryan McKinley

grafana/toolkit: Remove hack to expose plugin/e2e exports & types (#19467)

parent 00e7c7c4
......@@ -100,6 +100,5 @@
},
"_moduleAliases": {
"puppeteer": "node_modules/puppeteer-core"
},
"types": "src/index.ts"
}
}
......@@ -3,7 +3,6 @@ import * as fs from 'fs';
import chalk from 'chalk';
import { useSpinner } from '../utils/useSpinner';
import { Task, TaskRunner } from './task';
import escapeRegExp from 'lodash/escapeRegExp';
const path = require('path');
......@@ -120,21 +119,6 @@ const toolkitBuildTaskRunner: TaskRunner<ToolkitBuildOptions> = async () => {
fs.mkdirSync('./dist/sass');
await copyFiles();
await copySassFiles();
// RYAN HACK HACK HACK
// when Dominik is back from vacation, we can find a better way
// This moves the index to the root so plugin e2e tests can import them
console.warn('hacking an index.js file for toolkit. Help!');
const index = `${distDir}/src/index.js`;
fs.readFile(index, 'utf8', (err, data) => {
const pattern = 'require("./';
const js = data.replace(new RegExp(escapeRegExp(pattern), 'g'), 'require("./src/');
fs.writeFile(`${distDir}/index.js`, js, err => {
if (err) {
throw new Error('Error writing index: ' + err);
}
});
});
};
export const toolkitBuildTask = new Task<ToolkitBuildOptions>('@grafana/toolkit build', toolkitBuildTaskRunner);
export * from './e2e';
// Namespace for Plugins
import * as plugins from './plugins';
export { plugins };
import { Browser, Page } from 'puppeteer-core';
import { e2eScenario, takeScreenShot, plugins, pages } from '@grafana/toolkit';
import { e2eScenario, takeScreenShot, pages } from '@grafana/toolkit/src/e2e';
import { getEndToEndSettings } from '@grafana/toolkit/src/plugins';
// ****************************************************************
// NOTE, This file is copied to plugins at runtime, it is not run locally
......@@ -11,7 +12,7 @@ const sleep = (milliseconds: number) => {
};
e2eScenario('Common Plugin Test', 'should pass', async (browser: Browser, page: Page) => {
const settings = plugins.getEndToEndSettings();
const settings = getEndToEndSettings();
const pluginPage = pages.getPluginPage(settings.plugin.id);
await pluginPage.init(page);
await pluginPage.navigateTo();
......
......@@ -7,7 +7,7 @@
"rootDirs": ["."],
"outDir": "dist/src",
"declaration": true,
"declarationDir": "dist",
"declarationDir": "dist/src",
"typeRoots": ["./node_modules/@types"],
"esModuleInterop": true,
"lib": ["es2015", "es2017.string", "dom"]
......
import { TestPage, ClickablePageObjectType, ClickablePageObject, Selector } from '@grafana/toolkit';
import { TestPage, ClickablePageObjectType, ClickablePageObject, Selector } from '@grafana/toolkit/src/e2e';
export interface CreateDashboardPage {
addQuery: ClickablePageObjectType;
......
import { TestPage, ClickablePageObjectType, ClickablePageObject, Selector } from '@grafana/toolkit';
import { TestPage, ClickablePageObjectType, ClickablePageObject, Selector } from '@grafana/toolkit/src/e2e';
export interface DashboardsPage {
dashboard: ClickablePageObjectType;
......
......@@ -6,7 +6,7 @@ import {
InputPageObjectType,
InputPageObject,
PageObject,
} from '@grafana/toolkit';
} from '@grafana/toolkit/src/e2e';
export interface SaveDashboardModal {
name: InputPageObjectType;
......
import { TestPage, ClickablePageObject, Selector, ClickablePageObjectType } from '@grafana/toolkit';
import { TestPage, ClickablePageObject, Selector, ClickablePageObjectType } from '@grafana/toolkit/src/e2e';
export interface AddDataSourcePage {
testDataDB: ClickablePageObjectType;
......
import { TestPage } from '@grafana/toolkit';
import { TestPage } from '@grafana/toolkit/src/e2e';
export interface DataSourcesPage {}
......
......@@ -5,7 +5,7 @@ import {
ClickablePageObject,
PageObject,
Selector,
} from '@grafana/toolkit';
} from '@grafana/toolkit/src/e2e';
export interface EditDataSourcePage {
saveAndTest: ClickablePageObjectType;
......
......@@ -5,7 +5,7 @@ import {
Selector,
ClickablePageObjectType,
ClickablePageObject,
} from '@grafana/toolkit';
} from '@grafana/toolkit/src/e2e';
export interface EditPanelPage {
queriesTab: ClickablePageObjectType;
......
import { TestPage, ClickablePageObjectType, ClickablePageObject, Selector } from '@grafana/toolkit';
import { TestPage, ClickablePageObjectType, ClickablePageObject, Selector } from '@grafana/toolkit/src/e2e';
export interface Panel {
panelTitle: ClickablePageObjectType;
......
import { TestPage, ClickablePageObjectType, ClickablePageObject, Selector } from '@grafana/toolkit';
import { TestPage, ClickablePageObjectType, ClickablePageObject, Selector } from '@grafana/toolkit/src/e2e';
export interface SharePanelModal {
directLinkRenderedImage: ClickablePageObjectType;
......
import { Browser, Page, Target } from 'puppeteer-core';
import { e2eScenario, constants, takeScreenShot, compareScreenShots } from '@grafana/toolkit';
import { e2eScenario, constants, takeScreenShot, compareScreenShots } from '@grafana/toolkit/src/e2e';
import { addDataSourcePage } from 'e2e-test/pages/datasources/addDataSourcePage';
import { editDataSourcePage } from 'e2e-test/pages/datasources/editDataSourcePage';
import { dataSourcesPage } from 'e2e-test/pages/datasources/dataSources';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment