<commit_before>/*
 * Copyright (c) 2012-2018 Red Hat, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Red Hat, Inc. - initial API and implementation
 */
package org.eclipse.che.selenium.miscellaneous;

import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkersType.ERROR_MARKER;

import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.AskDialog;
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
import org.eclipse.che.selenium.pageobject.Ide;
import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar;
import org.eclipse.che.selenium.pageobject.Menu;
import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.Wizard;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/**
 * @author <NAME>
 * @author <NAME>
 */
public class ResolveDependencyAfterRecreateProjectTest {
  private static final String NAME_OF_THE_PROJECT_1 =
      NameGenerator.generate("ResolveDependencyAfterRecreateProject", 4);
  private static final String NAME_OF_THE_PROJECT_2 =
      NameGenerator.generate("ResolveDependencyAfterRecreateProject", 4);
  private static final String PATH_FOR_EXPAND =
      "/src/main/java/org/eclipse/che/examples/GreetingController.java";

  @Inject private Loader loader;
  @Inject private TestWorkspace workspace;
  @Inject private Ide ide;
  @Inject private ProjectExplorer projectExplorer;
  @Inject private CodenvyEditor editor;
  @Inject private Menu menu;
  @Inject private Wizard wizard;
  @Inject private MavenPluginStatusBar mavenPluginStatusBar;
  @Inject private NotificationsPopupPanel notificationsPopupPanel;
  @Inject private AskDialog askDialog;

  @BeforeClass
  public void setUp() throws Exception {
    ide.open(workspace);
  }

  @Test
  public void updateDependencyWithInheritTest() throws InterruptedException {
    projectExplorer.waitProjectExplorer();
    createProjectFromUI(NAME_OF_THE_PROJECT_1);
    projectExplorer.waitItem(NAME_OF_THE_PROJECT_1);
    mavenPluginStatusBar.waitClosingInfoPanel();
    notificationsPopupPanel.waitProgressPopupPanelClose();
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(NAME_OF_THE_PROJECT_1 + PATH_FOR_EXPAND);
    editor.waitActive();
    editor.waitAllMarkersDisappear(ERROR_MARKER);
    removeProjectFromUI();
    createProjectFromUI(NAME_OF_THE_PROJECT_2);
    projectExplorer.waitItem(NAME_OF_THE_PROJECT_2);
    projectExplorer.selectVisibleItem(NAME_OF_THE_PROJECT_2);
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(NAME_OF_THE_PROJECT_2 + PATH_FOR_EXPAND);
    editor.waitActive();
    editor.waitAllMarkersDisappear(ERROR_MARKER);
  }

  public void removeProjectFromUI() {
    projectExplorer.openContextMenuByPathSelectedItem(NAME_OF_THE_PROJECT_1);
    projectExplorer.clickOnItemInContextMenu(TestProjectExplorerContextMenuConstants.DELETE);
    askDialog.waitFormToOpen();
    askDialog.clickOkBtn();
    askDialog.waitFormToClose();
    projectExplorer.waitItemIsNotPresentVisibleArea(NAME_OF_THE_PROJECT_1);
  }

  /**
   * create project with UI
   *
   * @param nameOfTheProject name of created project
   */
  public void createProjectFromUI(String nameOfTheProject) {
    menu.runCommand(
        TestMenuCommandsConstants.Workspace.WORKSPACE,
        TestMenuCommandsConstants.Workspace.CREATE_PROJECT);
    wizard.selectTypeProject(Wizard.TypeProject.MAVEN);
    wizard.selectSample(Wizard.SamplesName.WEB_JAVA_SPRING);
    wizard.typeProjectNameOnWizard(nameOfTheProject);
    wizard.clickCreateButton();
    wizard.waitCloseProjectConfigForm();
  }
}<commit_msg>changed projects names in ResolveDependencyAfterRecreateProjectTest selenium test (#8410)<commit_after>/*
 * Copyright (c) 2012-2018 Red Hat, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Red Hat, Inc. - initial API and implementation
 */
package org.eclipse.che.selenium.miscellaneous;

import static org.eclipse.che.commons.lang.NameGenerator.generate;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE;
import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.DELETE;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkersType.ERROR_MARKER;
import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.WEB_JAVA_SPRING;
import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.MAVEN;

import com.google.inject.Inject;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.AskDialog;
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
import org.eclipse.che.selenium.pageobject.Ide;
import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar;
import org.eclipse.che.selenium.pageobject.Menu;
import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.Wizard;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/**
 * @author <NAME>
 * @author <NAME>
 */
public class ResolveDependencyAfterRecreateProjectTest {
  private static final String PROJECT_NAME1 = generate("project1", 4);
  private static final String PROJECT_NAME2 = generate("project2", 4);
  private static final String PATH_FOR_EXPAND =
      "/src/main/java/org/eclipse/che/examples/GreetingController.java";

  @Inject private TestWorkspace workspace;
  @Inject private Ide ide;
  @Inject private ProjectExplorer projectExplorer;
  @Inject private CodenvyEditor editor;
  @Inject private Menu menu;
  @Inject private Wizard wizard;
  @Inject private MavenPluginStatusBar mavenPluginStatusBar;
  @Inject private NotificationsPopupPanel notificationsPopupPanel;
  @Inject private AskDialog askDialog;

  @BeforeClass
  public void setUp() throws Exception {
    ide.open(workspace);
  }

  @Test
  public void updateDependencyWithInheritTest() throws InterruptedException {
    projectExplorer.waitProjectExplorer();

    createProjectFromUI(PROJECT_NAME1);
    projectExplorer.waitItem(PROJECT_NAME1);
    mavenPluginStatusBar.waitClosingInfoPanel();
    notificationsPopupPanel.waitProgressPopupPanelClose();
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(PROJECT_NAME1 + PATH_FOR_EXPAND);
    editor.waitActive();
    editor.waitAllMarkersDisappear(ERROR_MARKER);

    removeProjectFromUI();
    createProjectFromUI(PROJECT_NAME2);

    projectExplorer.waitItem(PROJECT_NAME2);
    projectExplorer.selectVisibleItem(PROJECT_NAME2);
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(PROJECT_NAME2 + PATH_FOR_EXPAND);
    editor.waitActive();
    editor.waitAllMarkersDisappear(ERROR_MARKER);
  }

  public void removeProjectFromUI() {
    projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME1);
    projectExplorer.clickOnItemInContextMenu(DELETE);
    askDialog.waitFormToOpen();
    askDialog.clickOkBtn();
    askDialog.waitFormToClose();
    projectExplorer.waitItemIsNotPresentVisibleArea(PROJECT_NAME1);
  }

  /**
   * create project with UI
   *
   * @param nameOfTheProject name of created project
   */
  public void createProjectFromUI(String nameOfTheProject) {
    menu.runCommand(WORKSPACE, CREATE_PROJECT);
    wizard.selectTypeProject(MAVEN);
    wizard.selectSample(WEB_JAVA_SPRING);
    wizard.typeProjectNameOnWizard(nameOfTheProject);
    wizard.clickCreateButton();
    wizard.waitCloseProjectConfigForm();
  }
}
{'fraction_non_alphanumeric': 0.0865226579009157, 'fraction_numerical': 0.006574313219065508, 'mean_word_length': 5.718454258675079, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5942148', 'n_tokens_mistral': 2634, 'n_tokens_neox': 2528, 'n_words': 436}