Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium: Catch issue #7161 in the AutocompleteProposalJavaDocTest selenium test #8663

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@
*/
package org.eclipse.che.selenium.editor.autocomplete;

import static org.testng.Assert.fail;

import com.google.inject.Inject;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Paths;
import org.eclipse.che.api.core.BadRequestException;
import org.eclipse.che.api.core.ConflictException;
import org.eclipse.che.api.core.ForbiddenException;
import org.eclipse.che.api.core.NotFoundException;
import org.eclipse.che.api.core.ServerException;
import org.eclipse.che.api.core.UnauthorizedException;
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
import org.eclipse.che.selenium.core.project.ProjectTemplates;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
Expand All @@ -29,6 +25,9 @@
import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.openqa.selenium.Keys;
import org.openqa.selenium.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
Expand All @@ -41,6 +40,7 @@ public class AutocompleteProposalJavaDocTest {
private static final String PATH_TO_APP_CLASS =
PROJECT + "/app/src/main/java/multimodule/" + APP_CLASS_NAME + ".java";
private static final String BOOK_IMPL_CLASS_NAME = "BookImpl";
private static final Logger LOG = LoggerFactory.getLogger(AutocompleteProposalJavaDocTest.class);
private static final String PATH_TO_BOOK_IMPL_CLASS =
PROJECT + "/model/src/main/java/multimodule/model/" + BOOK_IMPL_CLASS_NAME + ".java";

Expand Down Expand Up @@ -79,14 +79,12 @@ private void openMainClass() {
}

@Test
public void shouldDisplayJavaDocOfClassMethod()
throws ForbiddenException, BadRequestException, IOException, ConflictException,
NotFoundException, ServerException, UnauthorizedException {
public void shouldDisplayJavaDocOfClassMethod() throws Exception {
// when
editor.waitActive();
loader.waitOnClosed();
editor.goToCursorPositionVisible(30, 30);
editor.launchAutocompleteAndWaitContainer();
launchAutocompleteAndWaitContainer();
editor.selectAutocompleteProposal("concat(String part1, String part2, char divider) : String");

// then
Expand Down Expand Up @@ -206,4 +204,37 @@ public void shouldWorkAroundAbsentSourcesOfExternalLib() throws IOException {
+ "<dd><b>msg</b>"
+ " the message string to be logged</dd></dl>.*");
}

private void launchAutocompleteAndWaitContainer() throws Exception {
try {
editor.launchAutocompleteAndWaitContainer();
} catch (TimeoutException ex) {
logExternalLibraries();
logProjectTypeChecking();
logProjectLanguageChecking();

// remove try-catch block after issue has been resolved
fail("Known issue https://github.com/eclipse/che/issues/7161", ex);
}
}

private void logExternalLibraries() throws Exception {
testProjectServiceClient
.getExternalLibraries(workspace.getId(), PROJECT)
.forEach(library -> LOG.info("project external library: {}", library));
}

private void logProjectTypeChecking() throws Exception {
LOG.info(
"Project type of the {} project is \"maven\" - {}",
PROJECT,
testProjectServiceClient.checkProjectType(workspace.getId(), PROJECT, "maven"));
}

private void logProjectLanguageChecking() throws Exception {
LOG.info(
"Project language of the {} project is \"java\" - {}",
PROJECT,
testProjectServiceClient.checkProjectLanguage(workspace.getId(), PROJECT, "java"));
}
}