-
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
Selenium: Update the E2E selenium tests according to the changes on dashboard #13589
Changes from 4 commits
f0f4cb9
f8bfea8
0feca06
47aedac
67fa136
e95c970
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,9 @@ | |
package org.eclipse.che.selenium.dashboard; | ||
|
||
import static org.eclipse.che.commons.lang.NameGenerator.generate; | ||
import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; | ||
import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Sources.ZIP; | ||
import static org.testng.Assert.fail; | ||
|
||
import com.google.inject.Inject; | ||
import java.io.IOException; | ||
|
@@ -21,39 +23,37 @@ | |
import org.eclipse.che.selenium.core.client.TestGitHubRepository; | ||
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; | ||
import org.eclipse.che.selenium.core.user.DefaultTestUser; | ||
import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; | ||
import org.eclipse.che.selenium.core.workspace.TestWorkspace; | ||
import org.eclipse.che.selenium.core.workspace.TestWorkspaceProvider; | ||
import org.eclipse.che.selenium.pageobject.Ide; | ||
import org.eclipse.che.selenium.pageobject.ProjectExplorer; | ||
import org.eclipse.che.selenium.pageobject.ToastLoader; | ||
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; | ||
import org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace; | ||
import org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack; | ||
import org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage; | ||
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces; | ||
import org.eclipse.che.selenium.pageobject.theia.TheiaIde; | ||
import org.eclipse.che.selenium.pageobject.theia.TheiaProjectTree; | ||
import org.openqa.selenium.TimeoutException; | ||
import org.testng.annotations.AfterClass; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
/** @author Andrey Chizhikov */ | ||
@Test(groups = UNDER_REPAIR) | ||
public class ImportProjectFromZipTest { | ||
|
||
private final String WORKSPACE = generate("ImptPrjFromZip", 4); | ||
private static final String PROJECT_NAME = "master"; | ||
|
||
@Inject private Dashboard dashboard; | ||
@Inject private ProjectExplorer explorer; | ||
@Inject private NewWorkspace newWorkspace; | ||
@Inject private ProjectSourcePage projectSourcePage; | ||
@Inject private ToastLoader toastLoader; | ||
@Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; | ||
@Inject private TestWorkspaceServiceClient workspaceServiceClient; | ||
@Inject private DefaultTestUser defaultTestUser; | ||
@Inject private Workspaces workspaces; | ||
@Inject private Ide ide; | ||
@Inject private TestGitHubRepository testRepo; | ||
@Inject private TestWorkspaceProvider testWorkspaceProvider; | ||
@Inject private TheiaIde theiaIde; | ||
@Inject private TheiaProjectTree theiaProjectTree; | ||
|
||
// it is used to read workspace logs on test failure | ||
private TestWorkspace testWorkspace; | ||
|
@@ -98,11 +98,24 @@ public void importProjectFromZipTest() { | |
// possible to read logs in case of test failure | ||
testWorkspace = testWorkspaceProvider.getWorkspace(WORKSPACE, defaultTestUser); | ||
|
||
seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); | ||
toastLoader.waitToastLoaderAndClickStartButton(); | ||
ide.waitOpenedWorkspaceIsReadyToUse(); | ||
explorer.waitItem(PROJECT_NAME); | ||
explorer.waitAndSelectItem(PROJECT_NAME); | ||
explorer.openContextMenuByPathSelectedItem(PROJECT_NAME); | ||
theiaIde.switchToIdeFrame(); | ||
theiaIde.waitTheiaIde(); | ||
theiaIde.waitLoaderInvisibility(); | ||
theiaIde.waitTheiaIdeTopPanel(); | ||
theiaProjectTree.waitFilesTab(); | ||
|
||
// wait the project in the tree | ||
theiaProjectTree.clickOnFilesTab(); | ||
theiaProjectTree.waitProjectsRootItem(); | ||
theiaProjectTree.waitProjectAreaOpened(); | ||
theiaIde.waitTheiaIdeTopPanel(); | ||
theiaProjectTree.waitFilesTab(); | ||
|
||
try { | ||
theiaProjectTree.waitItem(PROJECT_NAME); | ||
} catch (TimeoutException ex) { | ||
// remove try-catch block after issue has been resolved | ||
fail("Known permanent failure https://github.com/eclipse/che/issues/13579"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is permanent failure, let's set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. |
||
} | ||
} | ||
} |
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 xpath looks way too common - it covers any element with id started with "/".
It's interesting to know why
"//div[@id='ws-name-%s']"
can't be applied.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.
In this case it has only single element, because this is a part of workspace full name:
The
"//div[@id='ws-name-%s']
" does not work properly (after the last changes) when to click on workspace that to go to the Workspaces DetailsThere 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.
There is
id="ws-full-name-che/java"
on screenshot.Can we use more precise locator:
"//div[@id='ws-full-name-che/%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.
Yes, we can..Only one thing.. in this case we can use this locator only to workspaces of the name che organization.
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.
I see. There is class name
class="workspace-name-clip"
can be used as well to locate web element in addition.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.
I propose the compromise solution - to do xpath more precize:
//div[@class='workspace-name-clip' and contains(@id, '/%s')]
In this case we have minimal fix up, which works.
If to use full name locator we have a quite big refactoring related to test classes and more part of them are already excluded from test suite (and more it needs to add additional code to get prefix of full name of the workspace.):