Generalize functions to get locators for share permission checkboxes
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
d4343de3eb
commit
e815b13265
|
@ -103,22 +103,36 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
|
||||||
/**
|
/**
|
||||||
* @return Locator
|
* @return Locator
|
||||||
*/
|
*/
|
||||||
public static function canReshareCheckbox($sharedWithName) {
|
public static function permissionCheckboxFor($sharedWithName, $itemText) {
|
||||||
// forThe()->checkbox("Can reshare") can not be used here; that would
|
// forThe()->checkbox($itemText) can not be used here; that would return
|
||||||
// return the checkbox itself, but the element that the user interacts
|
// the checkbox itself, but the element that the user interacts with is
|
||||||
// with is the label.
|
// the label.
|
||||||
return Locator::forThe()->xpath("//label[normalize-space() = 'Allow resharing']")->
|
return Locator::forThe()->xpath("//label[normalize-space() = '$itemText']")->
|
||||||
descendantOf(self::shareWithMenu($sharedWithName))->
|
descendantOf(self::shareWithMenu($sharedWithName))->
|
||||||
describedAs("Allow resharing checkbox in the share with $sharedWithName menu in the details view in Files app");
|
describedAs("$itemText checkbox in the share with $sharedWithName menu in the details view in Files app");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Locator
|
||||||
|
*/
|
||||||
|
public static function permissionCheckboxInputFor($sharedWithName, $itemText) {
|
||||||
|
return Locator::forThe()->checkbox($itemText)->
|
||||||
|
descendantOf(self::shareWithMenu($sharedWithName))->
|
||||||
|
describedAs("$itemText checkbox input in the share with $sharedWithName menu in the details view in Files app");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Locator
|
||||||
|
*/
|
||||||
|
public static function canReshareCheckbox($sharedWithName) {
|
||||||
|
return self::permissionCheckboxFor($sharedWithName, 'Allow resharing');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Locator
|
* @return Locator
|
||||||
*/
|
*/
|
||||||
public static function canReshareCheckboxInput($sharedWithName) {
|
public static function canReshareCheckboxInput($sharedWithName) {
|
||||||
return Locator::forThe()->checkbox("Allow resharing")->
|
return self::permissionCheckboxInputFor($sharedWithName, 'Allow resharing');
|
||||||
descendantOf(self::shareWithMenu($sharedWithName))->
|
|
||||||
describedAs("Allow resharing checkbox input in the share with $sharedWithName menu in the details view in Files app");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue