Skip to content

Commit

Permalink
Merge TS_SELENIUM_USERNAME/PASSOWRD with TS_SELENIUM_OCP_USERNAME/PAS…
Browse files Browse the repository at this point in the history
…SWORD (#22123)

* Removed TS_SELENIUM_USERNAME and TS_SELENIUM_PASSOWRD and replaced them with the OCP variants

Signed-off-by: Tibor Dancs <tdancs@redhat.com>

* Removing usern password from logging

Signed-off-by: Tibor Dancs <tdancs@redhat.com>

---------

Signed-off-by: Tibor Dancs <tdancs@redhat.com>
  • Loading branch information
ScrewTSW authored Apr 3, 2023
1 parent 0ce9be3 commit 9dbc63a
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 39 deletions.
4 changes: 2 additions & 2 deletions tests/e2e/build/dockerfiles/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fi
# Launch tests
if [ $TS_LOAD_TESTS ]; then
timestamp=$(date +%s)
user_folder="$TS_SELENIUM_USERNAME-$timestamp"
user_folder="$TS_SELENIUM_OCP_USERNAME-$timestamp"
export TS_SELENIUM_REPORT_FOLDER="./$user_folder/report"
export TS_SELENIUM_LOAD_TEST_REPORT_FOLDER="./$user_folder/load-test-folder"
CONSOLE_LOGS="./$user_folder/console-log.txt"
Expand Down Expand Up @@ -103,7 +103,7 @@ else
trap kill_ffmpeg 2 15
fi

echo "Running TEST_SUITE: $TEST_SUITE with user: $TS_SELENIUM_USERNAME"
echo "Running TEST_SUITE: $TEST_SUITE with user: $TS_SELENIUM_OCP_USERNAME"
npm run $TEST_SUITE
EXIT_CODE=$?
if [ "${SCREEN_RECORDING}" == "true" ]; then
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/configs/sh-scripts/initDefaultValues.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ echo "TS_SELENIUM_VALUE_OPENSHIFT_OAUTH = ${TS_SELENIUM_VALUE_OPENSHIFT_OAUTH}
echo "TS_OCP_LOGIN_PAGE_PROVIDER_TITLE = ${TS_OCP_LOGIN_PAGE_PROVIDER_TITLE}"
echo "E2E_OCP_CLUSTER_VERSION = ${E2E_OCP_CLUSTER_VERSION}"
echo "TS_SELENIUM_LOG_LEVEL = ${TS_SELENIUM_LOG_LEVEL}"
echo "TS_SELENIUM_USERNAME = ${TS_SELENIUM_USERNAME}"
echo "TS_SELENIUM_PASSWORD = ${TS_SELENIUM_PASSWORD}"
echo "TS_SELENIUM_OCP_USERNAME = ${TS_SELENIUM_OCP_USERNAME}"
echo "TS_SELENIUM_W3C_CHROME_OPTION = ${TS_SELENIUM_W3C_CHROME_OPTION}"
echo "NODE_TLS_REJECT_UNAUTHORIZED = ${NODE_TLS_REJECT_UNAUTHORIZED}"
echo "TS_SELENIUM_EDITOR = ${TS_SELENIUM_EDITOR}"
10 changes: 0 additions & 10 deletions tests/e2e/constants/TestConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,6 @@ export const TestConstants: any = {
*/
TS_SELENIUM_VALUE_OPENSHIFT_OAUTH: process.env.TS_SELENIUM_VALUE_OPENSHIFT_OAUTH === 'true',

/**
* Username used to log in MultiUser Che.
*/
TS_SELENIUM_USERNAME: process.env.TS_SELENIUM_USERNAME || 'che',

/**
* Password used to log in MultiUser Che.
*/
TS_SELENIUM_PASSWORD: process.env.TS_SELENIUM_PASSWORD || '',

/**
* Log into OCP by using appropriate provider title.
*/
Expand Down
46 changes: 30 additions & 16 deletions tests/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions tests/e2e/pageobjects/dashboard/Dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export class Dashboard {
private static getUserDropdownMenuButtonLocator(): By {
Logger.debug(`Dashboard.getUserDropdownMenuButtonLocator: get current user.`);

const currentUser: string = TestConstants.TS_SELENIUM_VALUE_OPENSHIFT_OAUTH ?
TestConstants.TS_SELENIUM_OCP_USERNAME : TestConstants.TS_SELENIUM_USERNAME;
const currentUser: string = TestConstants.TS_SELENIUM_OCP_USERNAME;
Logger.debug(`Dashboard.getUserDropdownMenuButtonLocator: ${currentUser}.`);

return By.xpath(`//*[text()="${currentUser}"]//parent::button`);
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/pageobjects/login/RedHatLoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class RedHatLoginPage {
Logger.debug('RedHatLoginPage.enterPasswordRedHat');
const passwordFieldLocator: By = By.id(PASSWORD_INPUT_ID);
await this.driverHelper.waitVisibility(passwordFieldLocator, 3000);
await this.driverHelper.enterValue(passwordFieldLocator, TestConstants.TS_SELENIUM_PASSWORD, timeout );
await this.driverHelper.enterValue(passwordFieldLocator, TestConstants.TS_SELENIUM_OCP_PASSWORD, timeout );
}
async clickOnLoginButton(): Promise<void> {
Logger.debug('RedHatLoginPage.clickOnLoginButton');
Expand All @@ -51,7 +51,7 @@ export class RedHatLoginPage {
Logger.debug('RedHatLoginPage.enterUserNameRedHat');
const usernameFieldLocator: By = By.id(USERNAME_INPUT_ID);
await this.driverHelper.waitVisibility(usernameFieldLocator, 20000);
await this.driverHelper.enterValue(usernameFieldLocator, TestConstants.TS_SELENIUM_USERNAME, timeout );
await this.driverHelper.enterValue(usernameFieldLocator, TestConstants.TS_SELENIUM_OCP_USERNAME, timeout );
}

async clickNextButton(): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/miscellaneous/PredefinedNamespace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite(`Create predefined workspace and check it `, async function (): Promise<vo
// create a predefined namespace for user using shell script and login into user dashboard
suiteSetup(async function (): Promise<void> {
Logger.info('Test prerequisites:');
Logger.info(' (1) there is OCP user with username and user password that have been set in the TS_SELENIUM_USERNAME and TS_SELENIUM_PASSWORD variables');
Logger.info(' (1) there is OCP user with username and user password that have been set in the TS_SELENIUM_OCP_USERNAME and TS_SELENIUM_OCP_PASSWORD variables');
Logger.info(' (2) \'oc\' client installed and logged into test OCP cluster with admin rights.');

await runShellScript(createPredefinedProjectCommand);
Expand Down
5 changes: 1 addition & 4 deletions tests/e2e/utils/CheReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ class CheReporter extends mocha.reporters.Spec {
TS_SELENIUM_BASE_URL: ${TestConstants.TS_SELENIUM_BASE_URL}
TS_SELENIUM_HEADLESS: ${TestConstants.TS_SELENIUM_HEADLESS}
TS_SELENIUM_USERNAME: ${TestConstants.TS_SELENIUM_USERNAME}
TS_SELENIUM_PASSWORD: ${TestConstants.TS_SELENIUM_PASSWORD}
TS_SELENIUM_OCP_USERNAME: ${TestConstants.TS_SELENIUM_OCP_USERNAME}
TS_SELENIUM_EDITOR: ${TestConstants.TS_SELENIUM_EDITOR}
TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: ${TestConstants.TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME}
Expand Down

0 comments on commit 9dbc63a

Please sign in to comment.