Skip to content

Commit

Permalink
Fix private link tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Sep 1, 2021
1 parent 9ecb9da commit 5dbd4d4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ Other free text and markdown formatting can be used elsewhere in the document if
- [webUIPrivateLinks/accessingPrivateLinks.feature:9](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L9)
- [webUIPrivateLinks/accessingPrivateLinks.feature:17](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L17)
- [webUIPrivateLinks/accessingPrivateLinks.feature:25](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L25)
- [webUIPrivateLinks/accessingPrivateLinks.feature:34](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L34)
- [webUIPrivateLinks/accessingPrivateLinks.feature:44](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L44)
- [webUIPrivateLinks/accessingPrivateLinks.feature:35](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L34)
- [webUIPrivateLinks/accessingPrivateLinks.feature:45](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPrivateLinks/accessingPrivateLinks.feature#L44)

### [various sharing settings cannot be set](https://github.com/owncloud/ocis/issues/1328)
- [webUIRestrictSharing/disableSharing.feature:16](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIRestrictSharing/disableSharing.feature#L16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Access private link

@smokeTest @ocisSmokeTest
Scenario: Access private link before authorisation
When the user tries to navigate to the private link created by user "Alice" for file "lorem.txt"
When an anonymous user tries to navigate to the private link created by user "Alice" for file "lorem.txt"
Then the user should be redirected to the IdP login page
When user "Alice" has logged in using the webUI
Then the app-sidebar for file "lorem.txt" should be visible on the webUI
Expand All @@ -27,6 +27,7 @@ Feature: Access private link
And user "Alice" has shared file "lorem.txt" with user "Brian" with "read" permissions
And user "Brian" has logged in using the webUI
When the user navigates to the private link created by user "Alice" for file "lorem.txt"
And the private link resolved successfully
Then the app-sidebar for file "lorem.txt" should be visible on the webUI
And the "details" details panel should be visible

Expand All @@ -42,5 +43,5 @@ Feature: Access private link
"""

Scenario: Access the private link anonymously
When the user tries to navigate to the private link created by user "Alice" for file "lorem.txt"
When an anonymous user tries to navigate to the private link created by user "Alice" for file "lorem.txt"
Then the user should be redirected to the IdP login page
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
timeout: timeoutHelper.parseTimeout(timeout)
},
result => {
isVisible = result.status === 0
isVisible = result.value === true
}
)
return isVisible
Expand Down
23 changes: 14 additions & 9 deletions tests/acceptance/stepDefinitions/privateLinksContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ When(
}
)

When('the user navigates to the copied private/public link using the webUI', function() {
return client.getClipBoardContent(function(url) {
// If the redirect happens immediately we receive an error
// Cannot read property 'parentNode' of null
setTimeout(function() {
client.url(url)
}, 0)
When('the user navigates to the copied private/public link using the webUI', async function() {
let url
await client.getClipBoardContent(u => {
url = u
})
return await client
.url(url)
.page.FilesPageElement.filesList()
.waitForElementVisible('@anyAfterLoading')
})

When(
Expand All @@ -31,11 +32,15 @@ When(
}
)

When('the private link resolved successfully', async function() {
return await client.page.FilesPageElement.filesList().waitForElementVisible('@anyAfterLoading')
})

When(
'the user tries to navigate to the private link created by user {string} for file/folder {string}',
'an anonymous user tries to navigate to the private link created by user {string} for file/folder {string}',
async function(user, resource) {
const item = await webdav.getProperties(resource, user, ['oc:privatelink'])
await client
return await client
.url(item['oc:privatelink'])
.page.webPage()
.waitForElementNotPresent('@webContainer')
Expand Down

0 comments on commit 5dbd4d4

Please sign in to comment.