-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
…ry to GitReset page object
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)); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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]"; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
ci-build |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/4521/ |
Don't forget to add |
ci-build |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/4522/ |
ci-test |
ci-test build report: |
|
||
public void selectCommitByText(String text) { | ||
seleniumWebDriverHelper | ||
.waitVisibility(By.xpath(String.format(Locators.ITEM_WITH_TEXT_XPATH_TEMPLATE, text))) |
There was a problem hiding this comment.
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)
ci-build |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/4523/ |
ci-test-docker-single |
ci-test build report: |
…pse-che#9471) * Add new test for covering git reset feature
What does this PR do?
reset to commit
widget (doResetToCommitMessage () method, switch to mixed reset radio button)Issue reference:
#9353
@artaleks9 @dmytro-ndp @vparfonov