Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
aa695dca
Commit
aa695dca
authored
6 years ago
by
Daniel Calviño Sánchez
Browse files
Options
Downloads
Patches
Plain Diff
Add acceptance tests for sharing a file with another user
Signed-off-by:
Daniel Calviño Sánchez
<
danxuliu@gmail.com
>
parent
75c37370
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/acceptance/features/app-files.feature
+56
-0
56 additions, 0 deletions
tests/acceptance/features/app-files.feature
tests/acceptance/features/bootstrap/FilesAppContext.php
+87
-0
87 additions, 0 deletions
tests/acceptance/features/bootstrap/FilesAppContext.php
with
143 additions
and
0 deletions
tests/acceptance/features/app-files.feature
+
56
−
0
View file @
aa695dca
...
...
@@ -295,6 +295,62 @@ Feature: app-files
# download starts no page redirection
And
I see that the current page is the Authenticate page for the direct download shared link I wrote down
Scenario
:
share a file with another user
Given
I act as John
And
I am logged in as the admin
And
I act as Jane
And
I am logged in
And
I act as John
And
I rename
"welcome.txt"
to
"farewell.txt"
And
I see that the file list contains a file named
"farewell.txt"
When
I share
"farewell.txt"
with
"user0"
And
I see that the file is shared with
"user0"
And
I act as Jane
# The Files app is open again to reload the file list
And
I open the Files app
Then
I see that the file list contains a file named
"farewell.txt"
And
I open the details view for
"farewell.txt"
And
I see that the details view is open
And
I open the
"Sharing"
tab in the details view
And
I see that the
"Sharing"
tab in the details view is eventually loaded
And
I see that the file is shared with me by
"admin"
Scenario
:
share a file with another user who already has a file with that name
Given
I act as John
And
I am logged in as the admin
And
I act as Jane
And
I am logged in
And
I act as John
When
I share
"welcome.txt"
with
"user0"
And
I see that the file is shared with
"user0"
And
I act as Jane
# The Files app is open again to reload the file list
And
I open the Files app
Then
I see that the file list contains a file named
"welcome (2).txt"
And
I open the details view for
"welcome (2).txt"
And
I see that the details view is open
And
I open the
"Sharing"
tab in the details view
And
I see that the
"Sharing"
tab in the details view is eventually loaded
And
I see that the file is shared with me by
"admin"
Scenario
:
share a skeleton file with another user before first login
# If a file is shared with a user before her first login the skeleton would
# not have been created, so if the shared file has the same name as one from
# the skeleton the shared file will take its place and the skeleton file
# will not be added.
Given
I act as John
And
I am logged in as the admin
When
I share
"welcome.txt"
with
"user0"
And
I see that the file is shared with
"user0"
And
I act as Jane
And
I am logged in
Then
I see that the file list contains a file named
"welcome.txt"
And
I open the details view for
"welcome.txt"
And
I see that the details view is open
And
I open the
"Sharing"
tab in the details view
And
I see that the
"Sharing"
tab in the details view is eventually loaded
And
I see that the file is shared with me by
"admin"
Scenario
:
marking a file as favorite causes the file list to be sorted again
Given
I am logged in
And
I create a new folder named
"A name alphabetically lower than welcome.txt"
...
...
This diff is collapsed.
Click to expand it.
tests/acceptance/features/bootstrap/FilesAppContext.php
+
87
−
0
View file @
aa695dca
...
...
@@ -42,6 +42,23 @@ class FilesAppContext implements Context, ActorAwareInterface {
"Deleted files"
=>
"trashbin"
];
}
/**
* @return Locator
*/
private
static
function
appMenu
()
{
return
Locator
::
forThe
()
->
id
(
"appmenu"
)
->
describedAs
(
"App menu in header"
);
}
/**
* @return Locator
*/
public
static
function
filesItemInAppMenu
()
{
return
Locator
::
forThe
()
->
xpath
(
"/li[@data-id = 'files']"
)
->
descendantOf
(
self
::
appMenu
())
->
describedAs
(
"Files item in app menu in header"
);
}
/**
* @return Locator
*/
...
...
@@ -211,6 +228,44 @@ class FilesAppContext implements Context, ActorAwareInterface {
describedAs
(
"Loading icon for tab named
$tabName
in details view in Files app"
);
}
/**
* @return Locator
*/
public
static
function
sharedByLabel
()
{
return
Locator
::
forThe
()
->
css
(
".reshare"
)
->
descendantOf
(
self
::
detailsView
())
->
describedAs
(
"Shared by label in the details view in Files app"
);
}
/**
* @return Locator
*/
public
static
function
shareWithInput
()
{
return
Locator
::
forThe
()
->
css
(
".shareWithField"
)
->
descendantOf
(
self
::
detailsView
())
->
describedAs
(
"Share with input in the details view in Files app"
);
}
/**
* @return Locator
*/
public
static
function
shareeList
()
{
return
Locator
::
forThe
()
->
css
(
".shareeListView"
)
->
descendantOf
(
self
::
detailsView
())
->
describedAs
(
"Sharee list in the details view in Files app"
);
}
/**
* @return Locator
*/
public
static
function
sharedWithRow
(
$sharedWithName
)
{
// "username" class is used for any type of share, not only for shares
// with users.
return
Locator
::
forThe
()
->
xpath
(
"//span[contains(concat(' ', normalize-space(@class), ' '), ' username ') and normalize-space() = '
$sharedWithName
']/ancestor::li"
)
->
descendantOf
(
self
::
shareeList
())
->
describedAs
(
"Shared with
$sharedWithName
row in the details view in Files app"
);
}
/**
* @return Locator
*/
...
...
@@ -349,6 +404,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
describedAs
(
"Password protect by Talk checkbox input in the details view in Files app"
);
}
/**
* @Given I open the Files app
*/
public
function
iOpenTheFilesApp
()
{
$this
->
actor
->
find
(
self
::
filesItemInAppMenu
(),
10
)
->
click
();
}
/**
* @Given I close the details view
*/
...
...
@@ -387,6 +449,15 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
}
/**
* @Given I share :fileName with :shareWithName
*/
public
function
iShareWith
(
$fileName
,
$shareWithName
)
{
$this
->
actor
->
find
(
FileListContext
::
shareActionForFile
(
self
::
currentSectionMainView
(),
$fileName
),
10
)
->
click
();
$this
->
actor
->
find
(
self
::
shareWithInput
(),
5
)
->
setValue
(
$shareWithName
.
"
\r
"
);
}
/**
* @Given I write down the shared link
*/
...
...
@@ -621,6 +692,22 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
}
/**
* @Then I see that the file is shared with me by :sharedByName
*/
public
function
iSeeThatTheFileIsSharedWithMeBy
(
$sharedByName
)
{
PHPUnit_Framework_Assert
::
assertEquals
(
$this
->
actor
->
find
(
self
::
sharedByLabel
(),
10
)
->
getText
(),
"Shared with you by
$sharedByName
"
);
}
/**
* @Then I see that the file is shared with :sharedWithName
*/
public
function
iSeeThatTheFileIsSharedWith
(
$sharedWithName
)
{
PHPUnit_Framework_Assert
::
assertTrue
(
$this
->
actor
->
find
(
self
::
sharedWithRow
(
$sharedWithName
),
10
)
->
isVisible
());
}
/**
* @Then I see that the download of the link share is hidden
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment