diff --git a/frontend/integration-tests/protractor.conf.ts b/frontend/integration-tests/protractor.conf.ts index 591c1918364..c343aeae3cd 100644 --- a/frontend/integration-tests/protractor.conf.ts +++ b/frontend/integration-tests/protractor.conf.ts @@ -122,11 +122,6 @@ const testSuites = { ]), clusterSettings: suite(['tests/cluster-settings.scenario.ts']), login: ['tests/login.scenario.ts'], - // TODO(vojtech): move to dev-console package, with suite() mapper applied automatically - devconsole: [ - 'tests/devconsole/dev-perspective.scenario.ts', - 'tests/devconsole/git-import-flow.scenario.ts', - ], }; export const config: Config = { diff --git a/frontend/packages/dev-console/integration-tests/.eslintrc.js b/frontend/packages/dev-console/integration-tests/.eslintrc.js new file mode 100644 index 00000000000..4db26f35661 --- /dev/null +++ b/frontend/packages/dev-console/integration-tests/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ['plugin:console/node-typescript-prettier'], +}; diff --git a/frontend/integration-tests/tests/devconsole/dev-perspective.scenario.ts b/frontend/packages/dev-console/integration-tests/tests/dev-perspective.scenario.ts similarity index 90% rename from frontend/integration-tests/tests/devconsole/dev-perspective.scenario.ts rename to frontend/packages/dev-console/integration-tests/tests/dev-perspective.scenario.ts index 84bb060cfdf..08238b1dde9 100644 --- a/frontend/integration-tests/tests/devconsole/dev-perspective.scenario.ts +++ b/frontend/packages/dev-console/integration-tests/tests/dev-perspective.scenario.ts @@ -1,11 +1,15 @@ import { browser } from 'protractor'; -import { appHost, checkLogs, checkErrors } from '../../protractor.conf'; +import { + appHost, + checkLogs, + checkErrors, +} from '@console/internal-integration-tests/protractor.conf'; import { switchPerspective, Perspective, pageSidebar, sideHeader, -} from '../../views/devconsole-view/dev-perspective.view'; +} from '../views/dev-perspective.view'; describe('Application Launcher Menu', () => { beforeAll(async () => { diff --git a/frontend/integration-tests/tests/devconsole/git-import-flow.scenario.ts b/frontend/packages/dev-console/integration-tests/tests/git-import-flow.scenario.ts similarity index 85% rename from frontend/integration-tests/tests/devconsole/git-import-flow.scenario.ts rename to frontend/packages/dev-console/integration-tests/tests/git-import-flow.scenario.ts index 98ecfa2e030..34ffbf0ce1c 100644 --- a/frontend/integration-tests/tests/devconsole/git-import-flow.scenario.ts +++ b/frontend/packages/dev-console/integration-tests/tests/git-import-flow.scenario.ts @@ -1,5 +1,9 @@ import { browser, $, ExpectedConditions as until } from 'protractor'; -import { appHost, checkLogs, checkErrors } from '../../protractor.conf'; +import { + appHost, + checkLogs, + checkErrors, +} from '@console/internal-integration-tests/protractor.conf'; import { navigateImportFromGit, setBuilderImage, @@ -11,13 +15,9 @@ import { buildImageVersion, createButton, builderImageVersionName, -} from '../../views/devconsole-view/git-imort-flow'; -import { newApplicationName, newAppName } from '../../views/devconsole-view/new-app-name.view'; -import { - switchPerspective, - Perspective, - sideHeader, -} from '../../views/devconsole-view/dev-perspective.view'; +} from '../views/git-import-flow.view'; +import { newApplicationName, newAppName } from '../views/new-app-name.view'; +import { switchPerspective, Perspective, sideHeader } from '../views/dev-perspective.view'; describe('git import flow', () => { let newApplication; diff --git a/frontend/integration-tests/views/devconsole-view/dev-perspective.view.ts b/frontend/packages/dev-console/integration-tests/views/dev-perspective.view.ts similarity index 100% rename from frontend/integration-tests/views/devconsole-view/dev-perspective.view.ts rename to frontend/packages/dev-console/integration-tests/views/dev-perspective.view.ts diff --git a/frontend/integration-tests/views/devconsole-view/git-imort-flow.ts b/frontend/packages/dev-console/integration-tests/views/git-import-flow.view.ts similarity index 94% rename from frontend/integration-tests/views/devconsole-view/git-imort-flow.ts rename to frontend/packages/dev-console/integration-tests/views/git-import-flow.view.ts index c54b999bbcc..4b9214a6125 100644 --- a/frontend/integration-tests/views/devconsole-view/git-imort-flow.ts +++ b/frontend/packages/dev-console/integration-tests/views/git-import-flow.view.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console, promise/catch-or-return */ import { ElementFinder, browser, ExpectedConditions as until, by, element, Key } from 'protractor'; export const addNavigate = element(by.css('[data-test-id="+Add-header"]')); @@ -39,9 +40,9 @@ export const safeSendKeys = async function( uiElementName: string, newValue: string, ) { - /* Note on the use of the SenKeys Protractor function: There is a widely reported + /* Note on the use of the SendKeys Protractor function: There is a widely reported bug in SendKeys where the function randomly drops characters. Most of the - workrounds for this bug involve sending individual chacaters one-by-one, + workarounds for this bug involve sending individual characters one-by-one, separated by calls to browser.sleep() or calls to Browser.executeScript to bypass the Protractor API. In our testing, we found neither of these approaches to be acceptable as we do not want to introduce sleep statements and calls to @@ -60,6 +61,7 @@ export const safeSendKeys = async function( console.info('sendKeys failed for ', uiElementName, ' - retry', insertedValue, newValue); await uiElement.sendKeys('text was', Key.chord(Key.CONTROL, 'a'), newValue); + // eslint-disable-next-line promise/no-nesting uiElement.getAttribute('value').then(async function(insertedValue2) { if (insertedValue2 !== newValue) { console.info( diff --git a/frontend/integration-tests/views/devconsole-view/new-app-name.view.ts b/frontend/packages/dev-console/integration-tests/views/new-app-name.view.ts similarity index 77% rename from frontend/integration-tests/views/devconsole-view/new-app-name.view.ts rename to frontend/packages/dev-console/integration-tests/views/new-app-name.view.ts index 8d66e2a5064..c15524f2bc1 100644 --- a/frontend/integration-tests/views/devconsole-view/new-app-name.view.ts +++ b/frontend/packages/dev-console/integration-tests/views/new-app-name.view.ts @@ -1,4 +1,4 @@ -import { info } from 'console'; +/* eslint-disable no-console */ export const newApplicationName = function(): string { const d = new Date(); @@ -7,8 +7,8 @@ export const newApplicationName = function(): string { const hour = d.getHours() < 10 ? `0${d.getHours()}` : `${d.getHours()}`; const minute = d.getMinutes() < 10 ? `0${d.getMinutes()}` : `${d.getMinutes()}`; const randomNumber = Math.round(Math.random() * 10000); - const appName: string = `testapp-${month}${day}-${hour}${minute}-${randomNumber}`; - info('New application name', appName); + const appName = `testapp-${month}${day}-${hour}${minute}-${randomNumber}`; + console.info('New application name', appName); return appName; }; @@ -19,7 +19,7 @@ export const newAppName = function(): string { const hour = d.getHours() < 10 ? `0${d.getHours()}` : `${d.getHours()}`; const minute = d.getMinutes() < 10 ? `0${d.getMinutes()}` : `${d.getMinutes()}`; const randomNumber = Math.round(Math.random() * 10000); - const nodeName: string = `app-${month}${day}-${hour}${minute}-${randomNumber}`; - info('New app name', nodeName); + const nodeName = `app-${month}${day}-${hour}${minute}-${randomNumber}`; + console.info('New app name', nodeName); return nodeName; }; diff --git a/frontend/packages/dev-console/package.json b/frontend/packages/dev-console/package.json index 5792aa4186a..09cb251a3a0 100644 --- a/frontend/packages/dev-console/package.json +++ b/frontend/packages/dev-console/package.json @@ -3,12 +3,18 @@ "version": "0.0.0-fixed", "description": "OpenShift Developer Perspective", "private": true, + "scripts": { + "lint": "yarn --cwd ../.. eslint packages/dev-console" + }, "dependencies": { "@console/knative-plugin": "0.0.0-fixed", "@console/plugin-sdk": "0.0.0-fixed", "@console/topology": "0.0.0-fixed" }, "consolePlugin": { - "entry": "src/plugin.tsx" + "entry": "src/plugin.tsx", + "integrationTestSuites": { + "devconsole": ["integration-tests/**/*.scenario.ts"] + } } }