Skip to content
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

[Tests-Only] Refactor createShareToShareFolder.feature to use Shares folder #37881

Merged
merged 5 commits into from
Sep 10, 2020

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Sep 3, 2020

Description

This is a way to get sharing API test scenarios that will be valid in both oC10 and OCIS. OCIS always puts received shares into a folder called Shares for the share receiver. On OCIS, auto-accept shares is always disabled.

  1. keep the existing oC10 sharing scenarios that deliver shares into the root / folder of the share receiver. Tag them notToImplementOnOCIS. That maintains the test coverage of the default sharing on oC10 and the scenarios will not get run on OCIS.

  2. make new scenarios in new feature files *ToSharesFolder.feature - for example createShareToSharesFolder.feature. In those scenarios, set the folder for received shares to "Shares".
    Given the administrator has set the default folder for received shares to "Shares"
    And adjust the test steps and expectations so that the share receiver expects the shares in /Shares folder.
    Put no specific tag on these test scenarios - they should pass on both oC10 and OCIS.
    That tests a full range of oC10 behavior when the default folder for received shares is configured, and also tests sharing behavior in OCIS.

  3. in the new scenarios, disable auto-accept shares. On OCIS this will do nothing (auto-accept shares is already disabled). On oC10 this will provide the same expected behavior as on OCIS.
    Given auto-accept shares has been disabled
    And adjust the scenarios so that they have steps to accept a share before the receiver tries to access it. e.g.

    When user "Brian" accepts the share "/textfile0.txt" offered by user "Alice" using the sharing API
    Then the OCS status code should be "<ocs_status_code>"
    And the HTTP status code should be "200"
    And the content of file "/Shares/textfile0.txt" for user "Brian" should be "ownCloud test text file 0"

So the pattern of these new feature files will have a Background that has at least these lines:

  Background:
    Given the administrator has set the default folder for received shares to "Shares"
    And auto-accept shares has been disabled

And such features should work the same way on oC10 and OCIS - so the scenarios can be run on both.

  1. Put the new feature files into new suites so that each suite still has a reasonable run-time. e.g. in this PR the existing apiShareManagementBasic suite becomes apiShareToRootManagementBasic and apiShareToSharesManagementBasic

Related Issue

owncloud/ocis#518

How Has This Been Tested?

CI

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@codecov
Copy link

codecov bot commented Sep 3, 2020

Codecov Report

Merging #37881 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #37881   +/-   ##
=========================================
  Coverage     64.75%   64.75%           
  Complexity    19403    19403           
=========================================
  Files          1285     1285           
  Lines         75823    75823           
  Branches       1336     1336           
=========================================
  Hits          49096    49096           
  Misses        26333    26333           
  Partials        394      394           
Flag Coverage Δ Complexity Δ
#javascript 54.06% <ø> (ø) 0.00 <ø> (ø)
#phpunit 65.93% <ø> (ø) 19403.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afb415a...dcf6137. Read the comment docs.

@individual-it
Copy link
Member

Given the administrator has set the default folder for received shares to "Shares" - we need to understand that this step will also not do anything on OCIS and if s.o. sets it to s.th. else than Shares the tests in ocic will fail.
Do we need to document that?

@phil-davis
Copy link
Contributor Author

Given the administrator has set the default folder for received shares to "Shares" - we need to understand that this step will also not do anything on OCIS and if s.o. sets it to s.th. else than Shares the tests in ocic will fail.
Do we need to document that?

For a start, I could change the words to:

Given the default folder for received shares has been set to "Shares"

That is more the standard grammar that we use. Not mentioning administrator makes it a bit less like an "action" step.

We could also say:

Given the default folder for received shares is "Shares"

That would not imply that any action has to be done - on some system-under-test it might need a setting to be set/changed, on another system-under-test it might be "is" already by default.

@phil-davis phil-davis force-pushed the refactor-tests-to-use-Shares-folder branch 2 times, most recently from 40bd9e0 to 806b69d Compare September 9, 2020 05:34
@phil-davis phil-davis marked this pull request as ready for review September 10, 2020 10:08
@@ -1923,11 +1943,11 @@ public function checkingLastShareIDIsIncluded() {
}

/**
* @Then /^the last share_id should not be included in the response/
* @Then /^the last share id should not be included in the response/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I took the opportunity to change the step text slightly.

@@ -1966,15 +1986,15 @@ public function theResponseShouldNotContainAnyShareIds() {
}

/**
* @Then user :user should not see share_id of last share
* @Then user :user should not see the share id of the last share
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I took the opportunity to change the step text slightly.

@@ -2462,7 +2482,7 @@ public function userHasDeletedPublicLinkShareNamedUsingTheSharingApi(
}

/**
* @When /^user "([^"]*)" (declines|accepts) the share "([^"]*)" offered by user "([^"]*)" using the sharing API$/
* @When /^user "([^"]*)" (declines|accepts) share "([^"]*)" offered by user "([^"]*)" using the sharing API$/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I took the opportunity to change the step text slightly.

@@ -2504,7 +2524,7 @@ public function userReactsToShareOfferedBy($user, $action, $share, $offeredBy) {
}

/**
* @Given /^user "([^"]*)" has (declined|accepted) the share "([^"]*)" offered by user "([^"]*)"$/
* @Given /^user "([^"]*)" has (declined|accepted) share "([^"]*)" offered by user "([^"]*)"$/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I took the opportunity to change the step text slightly.

@@ -494,7 +494,7 @@ public function slowdownDavRequests($method, $seconds) {
public function destinationHeaderValue($user, $fileDestination) {
$fullUrl = $this->getBaseUrl() . '/' .
WebDavHelper::getDavPath($user, $this->getDavPathVersion());
return $fullUrl . '/' . \ltrim($fileDestination, '/');
return \rtrim($fullUrl, '/') . '/' . \ltrim($fileDestination, '/');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When developing this PR, I noticed that some requests had a double-slash here. If WebDavHelper::getDavPath already ends with a slash / then we do not want to end up with 2 slashes. (the server was responding OK, but it will be nicer to test the ordinary case when the request URL has just a single slash between each part)

@@ -1373,7 +1373,7 @@ public function asFileOrFolderShouldExist(
);
Assert::assertTrue(
$this->isEtagValid(),
"$entry '$path' expected to exist but not found"
"$entry '$path' expected to exist for user $user but not found"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I enhanced this message. In scenario outlines with multiple users, it was not clear which user was missing the expected file or folder.

@phil-davis phil-davis force-pushed the refactor-tests-to-use-Shares-folder branch from dcf6137 to 304d853 Compare September 10, 2020 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants