@@ -103,22 +103,64 @@ public static function shareWithMenu($sharedWithName) {
103103 /**
104104 * @return Locator
105105 */
106- public static function canReshareCheckbox ($ sharedWithName ) {
107- // forThe()->checkbox("Can reshare" ) can not be used here; that would
108- // return the checkbox itself, but the element that the user interacts
109- // with is the label.
110- return Locator::forThe ()->xpath ("//label[normalize-space() = 'Allow resharing '] " )->
106+ public static function permissionCheckboxFor ($ sharedWithName, $ itemText ) {
107+ // forThe()->checkbox($itemText ) can not be used here; that would return
108+ // the checkbox itself, but the element that the user interacts with is
109+ // the label.
110+ return Locator::forThe ()->xpath ("//label[normalize-space() = ' $ itemText '] " )->
111111 descendantOf (self ::shareWithMenu ($ sharedWithName ))->
112- describedAs ("Allow resharing checkbox in the share with $ sharedWithName menu in the details view in Files app " );
112+ describedAs ("$ itemText checkbox in the share with $ sharedWithName menu in the details view in Files app " );
113113 }
114114
115115 /**
116116 * @return Locator
117117 */
118- public static function canReshareCheckboxInput ($ sharedWithName ) {
119- return Locator::forThe ()->checkbox (" Allow resharing " )->
118+ public static function permissionCheckboxInputFor ($ sharedWithName, $ itemText ) {
119+ return Locator::forThe ()->checkbox ($ itemText )->
120120 descendantOf (self ::shareWithMenu ($ sharedWithName ))->
121- describedAs ("Allow resharing checkbox input in the share with $ sharedWithName menu in the details view in Files app " );
121+ describedAs ("$ itemText checkbox input in the share with $ sharedWithName menu in the details view in Files app " );
122+ }
123+
124+ /**
125+ * @return Locator
126+ */
127+ public static function canEditCheckbox ($ sharedWithName ) {
128+ return self ::permissionCheckboxFor ($ sharedWithName , 'Allow editing ' );
129+ }
130+
131+ /**
132+ * @return Locator
133+ */
134+ public static function canEditCheckboxInput ($ sharedWithName ) {
135+ return self ::permissionCheckboxInputFor ($ sharedWithName , 'Allow editing ' );
136+ }
137+
138+ /**
139+ * @return Locator
140+ */
141+ public static function canCreateCheckbox ($ sharedWithName ) {
142+ return self ::permissionCheckboxFor ($ sharedWithName , 'Allow creating ' );
143+ }
144+
145+ /**
146+ * @return Locator
147+ */
148+ public static function canCreateCheckboxInput ($ sharedWithName ) {
149+ return self ::permissionCheckboxInputFor ($ sharedWithName , 'Allow creating ' );
150+ }
151+
152+ /**
153+ * @return Locator
154+ */
155+ public static function canReshareCheckbox ($ sharedWithName ) {
156+ return self ::permissionCheckboxFor ($ sharedWithName , 'Allow resharing ' );
157+ }
158+
159+ /**
160+ * @return Locator
161+ */
162+ public static function canReshareCheckboxInput ($ sharedWithName ) {
163+ return self ::permissionCheckboxInputFor ($ sharedWithName , 'Allow resharing ' );
122164 }
123165
124166 /**
@@ -358,6 +400,28 @@ public function iSetThePasswordOfTheSharedLinkAsNotProtectedByTalk() {
358400 $ this ->actor ->find (self ::passwordProtectByTalkCheckbox (), 2 )->click ();
359401 }
360402
403+ /**
404+ * @When I set the share with :shareWithName as not editable
405+ */
406+ public function iSetTheShareWithAsNotEditable ($ shareWithName ) {
407+ $ this ->showShareWithMenuIfNeeded ($ shareWithName );
408+
409+ $ this ->iSeeThatCanEditTheShare ($ shareWithName );
410+
411+ $ this ->actor ->find (self ::canEditCheckbox ($ shareWithName ), 2 )->click ();
412+ }
413+
414+ /**
415+ * @When I set the share with :shareWithName as not creatable
416+ */
417+ public function iSetTheShareWithAsNotCreatable ($ shareWithName ) {
418+ $ this ->showShareWithMenuIfNeeded ($ shareWithName );
419+
420+ $ this ->iSeeThatCanCreateInTheShare ($ shareWithName );
421+
422+ $ this ->actor ->find (self ::canCreateCheckbox ($ shareWithName ), 2 )->click ();
423+ }
424+
361425 /**
362426 * @When I set the share with :shareWithName as not reshareable
363427 */
@@ -395,6 +459,66 @@ public function iSeeThatResharingTheFileIsNotAllowed() {
395459 $ this ->actor ->find (self ::shareWithInput (), 10 )->getWrappedElement ()->getAttribute ("placeholder " ), "Resharing is not allowed " );
396460 }
397461
462+ /**
463+ * @Then I see that :sharedWithName can not be allowed to edit the share
464+ */
465+ public function iSeeThatCanNotBeAllowedToEditTheShare ($ sharedWithName ) {
466+ $ this ->showShareWithMenuIfNeeded ($ sharedWithName );
467+
468+ PHPUnit_Framework_Assert::assertEquals (
469+ $ this ->actor ->find (self ::canEditCheckboxInput ($ sharedWithName ), 10 )->getWrappedElement ()->getAttribute ("disabled " ), "disabled " );
470+ }
471+
472+ /**
473+ * @Then I see that :sharedWithName can edit the share
474+ */
475+ public function iSeeThatCanEditTheShare ($ sharedWithName ) {
476+ $ this ->showShareWithMenuIfNeeded ($ sharedWithName );
477+
478+ PHPUnit_Framework_Assert::assertTrue (
479+ $ this ->actor ->find (self ::canEditCheckboxInput ($ sharedWithName ), 10 )->isChecked ());
480+ }
481+
482+ /**
483+ * @Then I see that :sharedWithName can not edit the share
484+ */
485+ public function iSeeThatCanNotEditTheShare ($ sharedWithName ) {
486+ $ this ->showShareWithMenuIfNeeded ($ sharedWithName );
487+
488+ PHPUnit_Framework_Assert::assertFalse (
489+ $ this ->actor ->find (self ::canEditCheckboxInput ($ sharedWithName ), 10 )->isChecked ());
490+ }
491+
492+ /**
493+ * @Then I see that :sharedWithName can not be allowed to create in the share
494+ */
495+ public function iSeeThatCanNotBeAllowedToCreateInTheShare ($ sharedWithName ) {
496+ $ this ->showShareWithMenuIfNeeded ($ sharedWithName );
497+
498+ PHPUnit_Framework_Assert::assertEquals (
499+ $ this ->actor ->find (self ::canCreateCheckboxInput ($ sharedWithName ), 10 )->getWrappedElement ()->getAttribute ("disabled " ), "disabled " );
500+ }
501+
502+ /**
503+ * @Then I see that :sharedWithName can create in the share
504+ */
505+ public function iSeeThatCanCreateInTheShare ($ sharedWithName ) {
506+ $ this ->showShareWithMenuIfNeeded ($ sharedWithName );
507+
508+ PHPUnit_Framework_Assert::assertTrue (
509+ $ this ->actor ->find (self ::canCreateCheckboxInput ($ sharedWithName ), 10 )->isChecked ());
510+ }
511+
512+ /**
513+ * @Then I see that :sharedWithName can not create in the share
514+ */
515+ public function iSeeThatCanNotCreateInTheShare ($ sharedWithName ) {
516+ $ this ->showShareWithMenuIfNeeded ($ sharedWithName );
517+
518+ PHPUnit_Framework_Assert::assertFalse (
519+ $ this ->actor ->find (self ::canCreateCheckboxInput ($ sharedWithName ), 10 )->isChecked ());
520+ }
521+
398522 /**
399523 * @Then I see that :sharedWithName can reshare the share
400524 */
0 commit comments