Skip to content

Commit

Permalink
Merge pull request #3195 from vojtechszocs/move-devconsole-integratio…
Browse files Browse the repository at this point in the history
…n-tests

Move DevConsole integration tests to the appropriate package
  • Loading branch information
openshift-merge-robot committed Nov 9, 2019
2 parents 958ba86 + a0a14a1 commit bf755ca
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 23 deletions.
5 changes: 0 additions & 5 deletions frontend/integration-tests/protractor.conf.ts
Expand Up @@ -117,11 +117,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 = {
Expand Down
4 changes: 4 additions & 0 deletions frontend/packages/dev-console/integration-tests/.eslintrc.js
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['plugin:console/node-typescript-prettier'],
};
@@ -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 () => {
Expand Down
@@ -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,
Expand All @@ -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;
Expand Down
@@ -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"]'));
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down
@@ -1,4 +1,4 @@
import { info } from 'console';
/* eslint-disable no-console */

export const newApplicationName = function(): string {
const d = new Date();
Expand All @@ -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;
};

Expand All @@ -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;
};
8 changes: 7 additions & 1 deletion frontend/packages/dev-console/package.json
Expand Up @@ -3,13 +3,19 @@
"version": "0.0.0-fixed",
"description": "OpenShift Developer Perspective",
"private": true,
"scripts": {
"lint": "yarn --cwd ../.. eslint packages/dev-console"
},
"dependencies": {
"@console/git-service": "0.0.0-fixed",
"@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"]
}
}
}

0 comments on commit bf755ca

Please sign in to comment.