Add parts for running Openshift plugin test nightly (#17112)

* create openshift pugin test
7.20.x
Maxim Musienko 2020-06-23 10:35:27 +03:00 committed by GitHub
parent 6d035343fa
commit a41029ba02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 85 additions and 9 deletions

View File

@ -446,7 +446,7 @@ function runDevfileTestSuite() {
-e TS_SELENIUM_LOAD_PAGE_TIMEOUT=240000 \
-e TS_SELENIUM_WORKSPACE_STATUS_POLLING=20000 \
-e NODE_TLS_REJECT_UNAUTHORIZED=0 \
quay.io/eclipse/che-e2e:nightly || IS_TESTS_FAILED=true
maxura/e2e-tests:CHE-16927 || IS_TESTS_FAILED=true
}
function setupSelfSignedCertificate() {

View File

@ -0,0 +1,63 @@
#!/usr/bin/env bash
# Copyright (c) 2018 Red Hat, Inc.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
set -x
echo "========Starting nigtly test job $(date)========"
source tests/.infra/centos-ci/functional_tests_utils.sh
function runOpenshiftConnectorTest(){
### Create directory for report
cd /root/payload
mkdir report
REPORT_FOLDER=$(pwd)/report
### Run tests
docker run --net=host --ipc=host -v $REPORT_FOLDER:/tmp/e2e/report:Z -p 5920:5920 \
-e TS_SELENIUM_HEADLESS=true \
-e TS_SELENIUM_LOAD_PAGE_TIMEOUT=420000 \
-e TS_SELENIUM_WORKSPACE_STATUS_POLLING=20000 \
-e TS_SELENIUM_BASE_URL="https://$CHE_ROUTE" \
-e TS_SELENIUM_LOG_LEVEL=DEBUG \
-e TS_SELENIUM_USERNAME=${TEST_USERNAME} \
-e TS_SELENIUM_PASSWORD=${TEST_USERNAME} \
-e TS_TEST_OPENSHIFT_PLUGIN_USERNAME=developer \
-e TS_TEST_OPENSHIFT_PLUGIN_PASSWORD=pass \
-e TS_TEST_OPENSHIFT_PLUGIN_PROJECT=default \
-e TS_SELENIUM_MULTIUSER=true \
-e DELETE_WORKSPACE_ON_FAILED_TEST=true \
-e TEST_SUITE=test-openshift-connector \
-e NODE_TLS_REJECT_UNAUTHORIZED=0 \
quay.io/eclipse/che-e2e:nightly || IS_TESTS_FAILED=true
}
function prepareCustomResourcePatchFile() {
cat > /tmp/custom-resource-patch.yaml <<EOL
spec:
auth:
updateAdminPassword: false
EOL
cat /tmp/custom-resource-patch.yaml
}
setupEnvs
installKVM
installDependencies
prepareCustomResourcePatchFile
installCheCtl
installAndStartMinishift
deployCheIntoCluster --che-operator-cr-patch-yaml=/tmp/custom-resource-patch.yaml
defineCheRoute
createTestUserAndObtainUserToken
runOpenshiftConnectorTest
echo "=========================== THIS IS POST TEST ACTIONS =============================="
getOpenshiftLogs
archiveArtifacts "che-nightly-openshift-connector"
if [[ "$IS_TESTS_FAILED" == "true" ]]; then exit 1; fi

View File

@ -238,12 +238,12 @@ export const TestConstants = {
/**
* Login for a user whom has been created in the test Openshift cluster. Need for Openshift connector test
*/
TS_TEST_OPENSHIFT_PLUGIN_USERNAME: process.env.TS_LOGIN_NAME_OF_OPENSHIFT_REGULAR_USER || '',
TS_TEST_OPENSHIFT_PLUGIN_USERNAME: process.env.TS_TEST_OPENSHIFT_PLUGIN_USERNAME || '',
/**
* Password for a user whom has been created in the test Openshift cluster. Need for Openshift connector test
*/
TS_TEST_OPENSHIFT_PLUGIN_PASSWORD: process.env.TS_PASSWORD_OF_OPENSHIFT_REGULAR_USER || '',
TS_TEST_OPENSHIFT_PLUGIN_PASSWORD: process.env.TS_TEST_OPENSHIFT_PLUGIN_PASSWORD || '',
/**
* The name of project in the Openshidt plugin tree

View File

@ -20,7 +20,7 @@ export enum OpenshiftAppExplorerToolbar {
ReportExtensionIssueOnGitHub = 'Report Extension Issue on GitHub',
RefreshView = 'Refresh View',
SwitchContexts = 'Switch Contexts',
LogIntoCluster = 'Log in to cluster'
LogIntoCluster = 'Login into Cluster'
}
export enum OpenshiftContextMenuItems {

View File

@ -16,6 +16,7 @@ import { Logger } from '../../utils/Logger';
@injectable()
export class Terminal {
private static readonly TERMINAL_ROWS_XPATH_LOCATOR_PREFFIX = '(//div[contains(@class, \'terminal-container\')]//div[contains(@class, \'terminal\')]//div[contains(@class, \'xterm-rows\')])';
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
async waitTab(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
@ -93,11 +94,22 @@ export class Terminal {
Logger.debug(`Terminal.getText tab: ${terminalTab}`);
const terminalIndex: number = await this.getTerminalIndex(terminalTab);
const terminalRowsXpathLocator: string = `(//div[contains(@class, 'terminal-container')]` +
`//div[contains(@class, 'terminal')]//div[contains(@class, 'xterm-rows')])[${terminalIndex}]`;
await this.selectTerminalTab(terminalTab, timeout);
return await this.driverHelper.waitAndGetText(By.xpath(terminalRowsXpathLocator), timeout);
return await this.driverHelper.waitAndGetText(By.xpath(Terminal.TERMINAL_ROWS_XPATH_LOCATOR_PREFFIX + `[${terminalIndex}]`), timeout);
}
async selectTabByPrefixAndWaitText(terminalTab: string, expectedText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug(`Terminal.selectTabByPrefixAndWaitText tab: ${terminalTab} text: ${expectedText}`);
const terminalTabLocatorWithPreffix: string = `//li[contains(@title, '${terminalTab}')]`;
const terminalIndex: number = await this.getTerminalIndex(terminalTab);
await this.driverHelper.waitAndClick(By.xpath(terminalTabLocatorWithPreffix), timeout);
await this.driverHelper.waitUntilTrue(async () => {
const terminalText: string = await this.driverHelper.waitAndGetText(By.xpath(Terminal.TERMINAL_ROWS_XPATH_LOCATOR_PREFFIX + `[${terminalIndex}]`), timeout);
return terminalText.includes(expectedText);
}, timeout);
}
async waitText(terminalTab: string, expectedText: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {

View File

@ -90,6 +90,7 @@ suite('Openshift connector user story', async () => {
await quickOpenContainer.clickOnContainerItem('$(plus) Add new user...');
await quickOpenContainer.typeAndSelectSuggestion(TestConstants.TS_TEST_OPENSHIFT_PLUGIN_USERNAME, `Provide Username ${provideAuthenticationSuffix}`);
await quickOpenContainer.typeAndSelectSuggestion(TestConstants.TS_TEST_OPENSHIFT_PLUGIN_PASSWORD, `Provide Password ${provideAuthenticationSuffix}`);
await openshiftPlugin.waitItemInTree(TestConstants.TS_TEST_OPENSHIFT_PLUGIN_PROJECT);
});
test('Create new component with application', async () => {
@ -116,7 +117,7 @@ suite('Openshift connector user story', async () => {
await quickOpenContainer.clickOnContainerItem(TestConstants.TS_TEST_OPENSHIFT_PLUGIN_PROJECT);
await quickOpenContainer.clickOnContainerItem('node-js-app');
await quickOpenContainer.clickOnContainerItem('component-node-js');
await terminal.waitText('OpenShift', 'Changes successfully pushed to component', TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
await terminal.selectTabByPrefixAndWaitText('OpenShift: Push', 'Changes successfully pushed to component', TestConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
});
});