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: cover working with factories on the Dashboard by selenium tests #8917

Merged
merged 17 commits into from
Feb 27, 2018

Conversation

SkorikSergey
Copy link
Contributor

What does this PR do?

This PR add selenium tests which cover working with factories on the Dashboard.

The CreateFactoryTest test:

  • UI on the NewFactory page ;
  • creating a new factory from a workspace;
  • workspaces filtering by name;
  • creating a new factory from templates.

The FactoriesListTest test:

  • UI on the Factories list page;
  • factories filtering by name;
  • deleting factory from the Factories list.

What issues does this PR fix or reference?

#8891

@SkorikSergey SkorikSergey added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. kind/task Internal things, technical debt, and to-do tasks to be performed. team/che-qe labels Feb 26, 2018
@@ -117,7 +112,7 @@ public DashboardFactory(
}

@FindBy(xpath = Locators.FACTORY_TAB_XPATH)
Copy link
Contributor

@dmytro-ndp dmytro-ndp Feb 26, 2018

Choose a reason for hiding this comment

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

FACTORY_TAB_XPATH > FACTORIES_TAB_XPATH

@@ -186,10 +192,8 @@ public void clickOnAddFactoryBtn() {
public void selectWorkspaceForCreation(String wsNama) {
// delay for animation page
WaitUtils.sleepQuietly(1, TimeUnit.SECONDS);
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 use dedicated class TestWebElementRenderChecker to wait animation is ended.

*
* @return the current factory url
*/
/** click on the DOne button of Configure Button page */
Copy link
Contributor

Choose a reason for hiding this comment

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

DOne > Done

@@ -85,26 +71,35 @@ public DashboardFactory(
this.actionsFactory = actionsFactory;
this.dashboard = dashboard;
this.ideUrl = ideUrlProvider.get().toString();
this.loadPageTimeoutSec = new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unclear name loadPageTimeoutSec. What about loadPageTimeoutWait?

String WORKSPACE_ITEM_XPATH = "//div[@class='project-name']/a[text()='%s']";
String JSON_FACTORY_EDITOR_AREA_CSS = "div.json-editor";
String NEXT_FACTORY_BTN_XPATH = "//button/span[text()='Create']";
String FACTORY_NAMED_URL_XPATH =
"//div[@che-href='factoryInformationCtrl.factory.nameURL']//div[@layout]/span";
String FACTORY_NAME_FIELD_CSS = "input[placeholder='Name of the factory']";
String FACTORY_URL_MARKDAWN = "div.create-factory-share-header-widget-markdown";
String FACTORY_URL_MARKDOWN = "div.create-factory-share-header-widget-markdown";
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is kind of CSS selector. Lets name it in appropriate way: FACTORY_URL_MARKDOWN_CSS

@@ -186,10 +192,8 @@ public void clickOnAddFactoryBtn() {
public void selectWorkspaceForCreation(String wsNama) {
Copy link
Contributor

Choose a reason for hiding this comment

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

wsNama > wsName

loadPageTimeoutSec.until(visibilityOf(deleleFactoryButton)).click();
}

/** Click on the delete/remove button in the dialog window */
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there two possible names of the same button: delete or remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, only delete button.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. In this case comment should be fixed a little: delete/remove > delete

}

public interface Locators {
String FACTORY_NAME = "//span[contains(@class,'che-toolbar-title-label')]";
Copy link
Contributor

Choose a reason for hiding this comment

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

FACTORY_NAME > FACTORY_NAME_XPATH


public interface Locators {
String FACTORY_NAME = "//span[contains(@class,'che-toolbar-title-label')]";
String BACK_TO_FACTORIES_LIST_BUTTON = "//a[@title='All factories']";
Copy link
Contributor

Choose a reason for hiding this comment

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

BACK_TO_FACTORIES_LIST_BUTTON > ALL_FACTORIES_BUTTON

public class FactoryDetails {

private final SeleniumWebDriver seleniumWebDriver;
private final WebDriverWait redrawUiElementsTimeout;
Copy link
Contributor

Choose a reason for hiding this comment

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

redrawUiElementsTimeout > redrawUiElementsTimeoutWait

import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;

public class NewFactory {
Copy link
Contributor

@dmytro-ndp dmytro-ndp Feb 26, 2018

Choose a reason for hiding this comment

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

CreateFactoryPage class name sounds better, IMHO.

@@ -140,7 +140,7 @@ public void waitNoWorkspacesFound() {
visibilityOfElementLocated(By.xpath(Locators.NO_WORKSPACE_FOUND)));
}

// select workspaces by checkboxes
// select workspaces by checkbox
Copy link
Contributor

Choose a reason for hiding this comment

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

workspaces > workspace

private static final String FACTORY_CREATED_FROM_WORKSPACE_NAME = generate("factory", 4);
private static final String MIN_FACTORY_NAME = generate("", 3);
private static final String MAX_FACTORY_NAME = generate("", 20);
private static final String NAME_IS_TOO_SHORT = "The name has to be more than 3 characters long.";
Copy link
Contributor

Choose a reason for hiding this comment

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

NAME_IS_TOO_SHORT > TOO_SHORT_NAME

private static final String MIN_FACTORY_NAME = generate("", 3);
private static final String MAX_FACTORY_NAME = generate("", 20);
private static final String NAME_IS_TOO_SHORT = "The name has to be more than 3 characters long.";
private static final String NAME_IS_TOO_LONG = "The name has to be less than 20 characters long.";
Copy link
Contributor

Choose a reason for hiding this comment

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

NAME_IS_TOO_LONG > TOO_LONG_NAME

dashboardFactories.clickOnAddFactoryBtn();
newFactory.waitToolbarTitle();

// open tabs and check it fields
Copy link
Contributor

Choose a reason for hiding this comment

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

it > their


@Test
public void checkFactoryName() {
dashboardFactories.selectFactoriesOnNavBar();
Copy link
Contributor

@dmytro-ndp dmytro-ndp Feb 26, 2018

Choose a reason for hiding this comment

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

Comment on this part as well, please.


@Test
public void checkCreatingFactoryFromTemplates() {
dashboardFactories.selectFactoriesOnNavBar();
Copy link
Contributor

@dmytro-ndp dmytro-ndp Feb 26, 2018

Choose a reason for hiding this comment

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

Comment on this part as well, please.


@Test
public void checkCreatingFactoryFromWorkspace() {
dashboardFactories.selectFactoriesOnNavBar();
Copy link
Contributor

@dmytro-ndp dmytro-ndp Feb 26, 2018

Choose a reason for hiding this comment

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

Comment on this part as well, please.

}

@Test
public void checkCreatingFactoryFromWorkspace() {
Copy link
Contributor

Choose a reason for hiding this comment

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

checkCreatingFactoryFromWorkspace > shouldCreatingFactoryFromWorkspace

}

@Test
public void checkCreatingFactoryFromTemplates() {
Copy link
Contributor

@dmytro-ndp dmytro-ndp Feb 26, 2018

Choose a reason for hiding this comment

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

checkCreatingFactoryFromTemplates > shouldCreateFactoryFromTemplate

}

@Test
public void checkFactoryName() {
Copy link
Contributor

@dmytro-ndp dmytro-ndp Feb 26, 2018

Choose a reason for hiding this comment

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

checkFactoryName > shouldHandleIncorrectFactoryNames


@Test
public void checkNewFactoryPage() {
dashboardFactories.selectFactoriesOnNavBar();
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this test duplicates other ones.


@Test
public void checkWorkspaceFiltering() {
dashboardFactories.selectFactoriesOnNavBar();
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on this part as well, please.

@dmytro-ndp
Copy link
Contributor

Please, don't forget to add new tests into the CheSuite.xml file.

@SkorikSergey SkorikSergey merged commit 8ec6083 into master Feb 27, 2018
@SkorikSergey SkorikSergey deleted the checkFactoryPage branch February 27, 2018 13:44
@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 Feb 27, 2018
@benoitf benoitf added this to the 6.2.0 milestone Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants