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

Add GitResetTest for covering git soft/mixed/hard reset feature #9471

Merged
merged 19 commits into from
Apr 25, 2018

Conversation

musienko-maxim
Copy link
Contributor

@musienko-maxim musienko-maxim commented Apr 17, 2018

What does this PR do?

  • Add test for covering soft/mixed/hard reset features
  • Add necessary methods into Git pageobject for using reset to commit widget (doResetToCommitMessage () method, switch to mixed reset radio button)
  • Remove unused and unnecessary methods from the Git pageobject for importing java project (this methods was implemented in the WizardProject page object and they are not related with Git)

Issue reference:

#9353
@artaleks9 @dmytro-ndp @vparfonov

@benoitf benoitf added kind/enhancement A feature request - must adhere to the feature request template. status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. labels Apr 17, 2018
PageFactory.initElements(seleniumWebDriver, this);
}

/** Wait 'Reset to commit' window is open */
public void waitOpen() {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(form));
webDriverWaitFactory.get().until(ExpectedConditions.visibilityOf(form));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have ready to use method SeleniumWebDriverHelper#waitVisibility

}

/** Wait 'Reset to commit' window is close */
public void waitClose() {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
webDriverWaitFactory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have ready to use method SeleniumWebDriverHelper#waitVisibility

String COMMENT = "//div[text()='%s']";
String COMMIT_ITEM = "//div[@id='gwt-debug-git-reset-mainForm']//tbody[1]/tr[%s]";
String MAIN_FORM_XPATH = "//div[@id='gwt-debug-git-reset-mainForm']";
String COMMIT_ITEM = MAIN_FORM_XPATH + "//tbody[1]/tr[%s]";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add prefix "_TEMPLATE" to the constant name to make it obvious that it requires additional handling before usage.

public void doResetToCommitMessage(ResetModes mode, String textInResetToCommitWidget) {
menu.runCommand(GIT, RESET);
waitResetWindowOpen();
switch (mode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, divide parts by empty rows to simplify reading of code

import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class GitResetTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add author section.

workspace.setProjects(list);

testWorkspace =
new TestWorkspaceImpl(
Copy link
Contributor

@dmytro-ndp dmytro-ndp Apr 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better not to create test workspace pragmatically in the test


@BeforeClass
public void prepare() throws Exception {
String phpRepoLocation = "https://github.com/che-samples/web-php-simple.git";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to create our own repository from local source than depends on third-party one.

editor.waitTextIntoEditor(expectedTextInEditorAfterHardResetting);
}

private ProjectConfigDto configureTestProject(String projectName, SourceStorageDto gitSource) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is worth to be extracted into the specialize class.

NAME_OF_PROJECT_FOR_CHECKING_GIT_SOFT_RESET,
NAME_OF_PROJECT_FOR_CHECKING_GIT_HARD_RESET,
NAME_OF_PROJECT_FOR_CHECKING_GIT_MIX_RESET);
SourceStorageDto sourceStorage =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is worth to be extracted into the specialize class.

@@ -23,6 +23,8 @@
public static final String UBUNTU_JDK8 = "ubuntu_jdk8.json";
public static final String UBUNTU = "ubuntu.json";
public static final String DEFAULT = "default.json";
public static final String DEFAULT_WITH_PREDEFINED_PROJECTS =
"default_ws_with_predefined_projects.json";
Copy link
Contributor

@dmytro-ndp dmytro-ndp Apr 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default_ws_with_predefined_projects.json' > default_with_github_projects.json`

DEFAULT_WITH_PREDEFINED_PROJECTS > DEFAULT_WITH_GITHUB_PROJECTS

loader.waitOnClosed();
}
/**
* Invoke the hard to reset widget from Git -> Reset menu. Set the mode of resetting and click on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard to reset widget - are you sure it is a correct name of widget?

.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.COMMIT_ITEM, numberLine))))
public void selectCommitByNumber(int numberLine) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numberLine > numberOfCommitLine

import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/** @author Musienko Maxim */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed empty line before java doc

"port" : "9876",
"protocol" : "http"
}
"memoryLimitBytes": "2147483648"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do decided to make it impossible to set desired_memory_value automatically through the injection?

"org.eclipse.che.ws-agent"
],
"attributes": {
"memoryLimitBytes": "2147483648"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to have an ability to set "desired_memory_value" automatically through injection.

@musienko-maxim
Copy link
Contributor Author

ci-build

@codenvy-ci
Copy link

@dmytro-ndp
Copy link
Contributor

Don't forget to add GitResetTest to the CheSuite.xml test suite.

@musienko-maxim
Copy link
Contributor Author

ci-build

@codenvy-ci
Copy link

@musienko-maxim
Copy link
Contributor Author

ci-test

@codenvy-ci
Copy link

ci-test build report:
Build details
Test report
selenium tests report data
docker image: eclipseche/che-server:9471
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.


public void selectCommitByText(String text) {
seleniumWebDriverHelper
.waitVisibility(By.xpath(String.format(Locators.ITEM_WITH_TEXT_XPATH_TEMPLATE, text)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might to replace on the exist waitAndClick(By elementLocator)

@musienko-maxim
Copy link
Contributor Author

ci-build

@codenvy-ci
Copy link

@musienko-maxim
Copy link
Contributor Author

ci-test-docker-single

@codenvy-ci
Copy link

ci-test build report:
Build details
Test report
selenium tests report data
docker image: eclipseche/che-server:9471
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

@musienko-maxim musienko-maxim merged commit 6d33172 into master Apr 25, 2018
@benoitf benoitf added this to the 6.5.0 milestone Apr 25, 2018
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Apr 25, 2018
@musienko-maxim musienko-maxim deleted the CHE-9353 branch May 1, 2018 14:25
hbhargav pushed a commit to hbhargav/che that referenced this pull request Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants