Skip to content

Commit

Permalink
[Selenium] Adapt selenium tests from ocpoauth package (eclipse-che#14619
Browse files Browse the repository at this point in the history
)
  • Loading branch information
SkorikSergey authored and tomgeorge committed Sep 24, 2019
1 parent 2619e03 commit f36afab
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ private void obtainKeycloakPodName() throws IOException {
// obtain name of keycloak pod
String getKeycloakPodNameCommand =
format(
"get pod --namespace=%s -l app=%s --no-headers | awk '{print $1}'",
cheOpenshiftProject != null ? cheOpenshiftProject : DEFAULT_CHE_OPENSHIFT_PROJECT,
keycloakApp != null ? keycloakApp : DEFAULT_KEYCLOAK_APP);
"get pods --namespace=%s | grep keycloak | awk '{print $1}'",
cheOpenshiftProject != null ? cheOpenshiftProject : DEFAULT_CHE_OPENSHIFT_PROJECT);

keycloakPodName = openShiftCliCommandExecutor.execute(getKeycloakPodNameCommand);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public interface Locators {
String DOCUMENTATION_LINK = "//div[@che-link-title='Learn more.']/a";
String ADD_WORKSPACE_BTN = "add-item-button";
String DELETE_WORKSPACE_BTN = "delete-item-button";
String DELETE_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Delete']";
String DELETE_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button[text()='Delete']";
String BULK_CHECKBOX = "//md-checkbox[@aria-label='Workspace list']";
String SEARCH_WORKSPACE_FIELD = "//input[@ng-placeholder='Search']";
String NO_WORKSPACE_FOUND = "//span[text()='No workspaces found.']";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void login(String username, String password) {
waitOnClose();
}

private void waitOnOpen() {
public void waitOnOpen() {
seleniumWebDriverHelper.waitAllVisibility(asList(usernameInput, passwordInput, loginButton));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void waitProjectAbsence(String projectNamePart) {
}

public void open() {
seleniumWebDriver.navigate().to(openShiftWebConsoleUrlProvider.get());
seleniumWebDriver.navigate().to(openShiftWebConsoleUrlProvider.get() + "console");
}

public void logout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,8 @@ public void checkExistedCheUserOcpProjectCreationAndRemoval() throws Exception {
// (we can't use dashboard.open() here to login with OAuth)
seleniumWebDriver.navigate().to(testDashboardUrlProvider.get());

// click on button to login with OpenShift OAuth
cheLoginPage.loginWithOpenShiftOAuth();

// login to OCP from login page with default test user credentials
openShiftLoginPage.waitOnOpen();
openShiftLoginPage.login(defaultTestUser.getName(), defaultTestUser.getPassword());

// authorize ocp-client to access OpenShift account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ public void checkNewCheUserOcpProjectCreationAndRemoval() {
// (we can't use dashboard.open() here to login with OAuth)
seleniumWebDriver.navigate().to(testDashboardUrlProvider.get());

// click on button to login with OpenShift OAuth
cheLoginPage.loginWithOpenShiftOAuth();

// login to OCP from login page with new test user credentials
openShiftLoginPage.waitOnOpen();
openShiftLoginPage.login(NEW_TEST_USER.getName(), NEW_TEST_USER.getPassword());

// authorize ocp-client to access OpenShift account
Expand Down

0 comments on commit f36afab

Please sign in to comment.