-
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: cover sharing workspaces in organization by selenium test #9167
Changes from 8 commits
6e6a088
73a7c09
6594563
b5d0159
4a2a885
43e9f72
2f6d65c
9ad113c
ee43372
e24379f
8925e93
66ab29b
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<che-list-item flex-gt-sm="100" flex="33" ng-mouseover="hover=true" ng-mouseout="hover=false"> | ||
<div flex="100" | ||
id="member-name-{{userItemController.user.email}}" | ||
layout="row" | ||
layout-align="start stretch" | ||
class="che-list-item-row user-list-row"> | ||
|
@@ -19,16 +20,16 @@ | |
class="che-list-item-name"> | ||
<span class="che-xs-header noselect" hide-gt-xs>Email</span> | ||
<span><img class="user-face" gravatar-src="userItemController.user.email"></span> | ||
<span class="user-email che-hover ">{{userItemController.user.email}}</span> | ||
<span class="user-email che-hover " name="member-name">{{userItemController.user.email}}</span> | ||
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. Could you rename "member-name" to "member-email" 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. Also I would notice that it is about user, not member. 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.
|
||
</div> | ||
<div flex-gt-xs="35"> | ||
<span class="che-xs-header noselect" hide-gt-xs>Permissions</span> | ||
<span class="user-permissions">{{userItemController.getUserActions()}}</span> | ||
<span class="user-permissions" name="member-permissions">{{userItemController.getUserActions()}}</span> | ||
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. It seems is about user, not member. 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.
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. Each member has permissions and id is not suitable here. |
||
</div> | ||
<div flex-gt-xs="25"> | ||
<span class="che-xs-header noselect" hide-gt-xs>Actions</span> | ||
<span class="che-list-actions"> | ||
<div ng-click="userItemController.removeUser();" uib-tooltip="Remove member"> | ||
<div ng-click="userItemController.removeUser();" uib-tooltip="Remove member" name="remove-member"> | ||
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.
|
||
<span class="material-design icon-ic_remove_circle_outline_24px"></span> | ||
</div> | ||
</span> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,92 +11,118 @@ | |
package org.eclipse.che.selenium.pageobject.dashboard.workspaces; | ||
|
||
import static java.lang.String.format; | ||
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; | ||
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; | ||
import static org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated; | ||
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated; | ||
|
||
import com.google.inject.Inject; | ||
import org.eclipse.che.selenium.core.SeleniumWebDriver; | ||
import org.eclipse.che.selenium.pageobject.SeleniumWebDriverHelper; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
public class WorkspaceShare { | ||
private final SeleniumWebDriver seleniumWebDriver; | ||
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. We don't need separate field |
||
private final SeleniumWebDriverHelper seleniumWebDriverHelper; | ||
|
||
@Inject | ||
public WorkspaceShare(SeleniumWebDriver seleniumWebDriver) { | ||
public WorkspaceShare( | ||
SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { | ||
this.seleniumWebDriver = seleniumWebDriver; | ||
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.
|
||
this.seleniumWebDriverHelper = seleniumWebDriverHelper; | ||
PageFactory.initElements(seleniumWebDriver, this); | ||
} | ||
|
||
private interface Locators { | ||
String ADD_DEVELOPER_BTN = "//span[text()='Add Developer']"; | ||
String REMOVE_DEVELOPER_ICON = | ||
"//span[text()='%s']//following::div[@tooltip='Remove member'][1]"; | ||
String INPUT_SHARE_DIALOG = "//md-chips[contains(@class,'share-user-input')]//input"; | ||
String SHARE_BTN_DIALOG = "//che-button-primary[@aria-disabled='false']//span[text()='Share']"; | ||
String DEVELOPER_SHARE_ITEM = "//span[text()='%s']"; | ||
String WARNING_DIALOG_DELETE = "//div[@class='ng-binding' and text()=\"%s\"]"; | ||
} | ||
|
||
/** | ||
* Adds developer to share list | ||
* | ||
* @param email is an email of developer into sharing list | ||
*/ | ||
public void addDeveloperToShareList(String email) { | ||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) | ||
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_DEVELOPER_BTN))) | ||
.click(); | ||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) | ||
.until(visibilityOfElementLocated(By.xpath(Locators.INPUT_SHARE_DIALOG))) | ||
.sendKeys(email + ","); | ||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) | ||
.until(visibilityOfElementLocated(By.xpath(Locators.SHARE_BTN_DIALOG))) | ||
.click(); | ||
} | ||
|
||
/** | ||
* Delete a developer from sharing list | ||
* | ||
* @param email is an email of developer into sharing list | ||
*/ | ||
public void deleteDeveloperFromShareList(String email) { | ||
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC) | ||
.until( | ||
visibilityOfElementLocated( | ||
By.xpath(String.format(Locators.REMOVE_DEVELOPER_ICON, email)))) | ||
.click(); | ||
} | ||
|
||
/** Wait the text into warning dialog delete or remove */ | ||
public void waitTextInWarningDialogDelete(String expText) { | ||
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC) | ||
.until( | ||
visibilityOfElementLocated( | ||
By.xpath(String.format(Locators.WARNING_DIALOG_DELETE, expText)))); | ||
} | ||
|
||
/** | ||
* Wait the email of developer is present in 'Share' tab | ||
* | ||
* @param email the email of developer | ||
*/ | ||
public void waitDeveloperIsPresentInShareTab(String email) { | ||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) | ||
.until(visibilityOfElementLocated(By.xpath(format(Locators.DEVELOPER_SHARE_ITEM, email)))); | ||
} | ||
|
||
/** | ||
* Wait the email of developer is not present in 'Share' tab | ||
* | ||
* @param email the email of developer | ||
*/ | ||
public void waitDeveloperIsNotPresentInShareTab(String email) { | ||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) | ||
.until( | ||
invisibilityOfElementLocated(By.xpath(format(Locators.DEVELOPER_SHARE_ITEM, email)))); | ||
String ADD_DEVELOPER_BTN_XPATH = "//che-button-primary[@che-button-title='Add Developer']"; | ||
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. We don't need to shorten |
||
String BULK_SELECTION_ID = "share-workspace-bulk-selection"; | ||
String FILTER_MEMBERS_BY_NAME_FIELD_XPATH = "//input[@ng-placeholder='Search']"; | ||
String MEMBER_ITEM_XPATH = "//div[@id='member-name-%s']"; | ||
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.
|
||
String MEMBER_NAME_XPATH = MEMBER_ITEM_XPATH + "//span[@name='member-name']"; | ||
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. It is also looks like xpath pattern |
||
String MEMBER_CHECKBOX_XPATH = MEMBER_ITEM_XPATH + "//md-checkbox"; | ||
String MEMBER_PERMISSIONS_XPATH = MEMBER_ITEM_XPATH + "//span[@name='member-permissions']";; | ||
String REMOVE_MEMBER_ICON_XPATH = MEMBER_ITEM_XPATH + "//div[@name='remove-member']"; | ||
String INVITE_MEMBER_DIALOG_ID = "add-members-dialog"; | ||
String CLOSE_DIALOG_BUTTON_NAME_ID = "close-dialog-button"; | ||
String SELECT_ALL_MEMBERS_BY_BULK_DIALOG_XPATH = "//md-checkbox[@aria-label='Member list']"; | ||
String SHARE_WORKSPACE_DIALOG_BUTTON_NAME = "shareButton"; | ||
String NO_MEMBERS_IN_ORGANIZATION_DIALOG_XPATH = "//che-popup[@title='No members in team']"; | ||
} | ||
|
||
@FindBy(xpath = Locators.FILTER_MEMBERS_BY_NAME_FIELD_XPATH) | ||
WebElement filterMembers; | ||
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.
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. or |
||
|
||
@FindBy(id = Locators.BULK_SELECTION_ID) | ||
WebElement bulkSelection; | ||
|
||
public void clickOnBulk() { | ||
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.
|
||
seleniumWebDriverHelper.waitAndClick(bulkSelection); | ||
} | ||
|
||
public void typeToSearchInput(String value) { | ||
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. Looks like it is |
||
filterMembers.clear(); | ||
filterMembers.sendKeys(value); | ||
} | ||
|
||
public void waitMemberNameInShareList(String name) { | ||
seleniumWebDriverHelper.waitVisibility(By.xpath(format(Locators.MEMBER_NAME_XPATH, name))); | ||
} | ||
|
||
public void waitMemberNameNotExistsInShareList(String name) { | ||
seleniumWebDriverHelper.waitInvisibility(By.xpath(format(Locators.MEMBER_NAME_XPATH, name))); | ||
} | ||
|
||
public void clickOnAddDeveloperButton() { | ||
seleniumWebDriverHelper.waitAndClick(By.xpath(Locators.ADD_DEVELOPER_BTN_XPATH)); | ||
} | ||
|
||
public String getMemberPermissions(String name) { | ||
return seleniumWebDriverHelper.waitVisibilityAndGetText( | ||
By.xpath(format(Locators.MEMBER_PERMISSIONS_XPATH, name))); | ||
} | ||
|
||
public void clickOnMemberCheckbox(String name) { | ||
seleniumWebDriverHelper.waitAndClick(By.xpath(format(Locators.MEMBER_CHECKBOX_XPATH, name))); | ||
} | ||
|
||
public Boolean isMemberCheckedInList(String name) { | ||
return Boolean.parseBoolean( | ||
seleniumWebDriverHelper | ||
.waitVisibility(By.xpath(format(Locators.MEMBER_CHECKBOX_XPATH, name))) | ||
.getAttribute("aria-checked")); | ||
} | ||
|
||
public void clickOnRemoveMemberButton(String name) { | ||
seleniumWebDriverHelper.waitAndClick(By.xpath(format(Locators.REMOVE_MEMBER_ICON_XPATH, name))); | ||
} | ||
|
||
public void waitInviteMemberDialog() { | ||
seleniumWebDriverHelper.waitVisibility(By.id(Locators.INVITE_MEMBER_DIALOG_ID)); | ||
} | ||
|
||
public void waitInviteMemberDialogClosed() { | ||
seleniumWebDriverHelper.waitInvisibility(By.id(Locators.INVITE_MEMBER_DIALOG_ID)); | ||
} | ||
|
||
public void selectAllMembersInDialogByBulk() { | ||
seleniumWebDriverHelper.waitAndClick( | ||
By.xpath(Locators.SELECT_ALL_MEMBERS_BY_BULK_DIALOG_XPATH)); | ||
} | ||
|
||
public void clickOnShareWorkspaceButton() { | ||
seleniumWebDriverHelper.waitAndClick(By.name(Locators.SHARE_WORKSPACE_DIALOG_BUTTON_NAME)); | ||
} | ||
|
||
public void closeInviteMemberDialog() { | ||
seleniumWebDriverHelper.waitAndClick(By.id(Locators.INVITE_MEMBER_DIALOG_ID)); | ||
} | ||
|
||
public void waitNoMembersDialog() { | ||
seleniumWebDriverHelper.waitVisibility( | ||
By.xpath(Locators.NO_MEMBERS_IN_ORGANIZATION_DIALOG_XPATH)); | ||
} | ||
|
||
public void closeNoMembersDialog() { | ||
seleniumWebDriverHelper.waitAndClick( | ||
By.xpath(Locators.NO_MEMBERS_IN_ORGANIZATION_DIALOG_XPATH)); | ||
} | ||
} |
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 about user email, not member name.