Skip to content

Commit

Permalink
Change assertion for media viewer preview
Browse files Browse the repository at this point in the history
  • Loading branch information
jasson99 committed Jan 28, 2021
1 parent fe9d395 commit ff601b8
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 37 deletions.
4 changes: 4 additions & 0 deletions tests/acceptance/expected-failures-with-oc10-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ Other free text and markdown formatting can be used elsewhere in the document if
- [webUIPreview/imageMediaViewer.feature:81](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L81)
- [webUIPreview/imageMediaViewer.feature:88](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L88)

### [Media Viewer preview not visible for files with .ogg and .webm formats](https://github.com/owncloud/web/issues/4667)
- [webUIPreview/imageMediaViewer.feature:136](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L136)
- [webUIPreview/imageMediaViewer.feature:154](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L154)

### [WebUI Login](https://github.com/owncloud/web/issues/4564)
- [webUILogin/login.feature:62](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUILogin/login.feature#L62)
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ Other free text and markdown formatting can be used elsewhere in the document if
- [webUIPreview/imageMediaViewer.feature:88](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L88)


### [Media Viewer preview not visible for files with .jpeg and .gif formats](https://github.com/owncloud/ocis/issues/1490)
- [webUIPreview/imageMediaViewer.feature:123](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L123)
- [webUIPreview/imageMediaViewer.feature:141](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L141)
### [Media Viewer preview not visible for files with .jpeg, .ogg, .webm and .gif formats](https://github.com/owncloud/ocis/issues/1490)
- [webUIPreview/imageMediaViewer.feature:127](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L127)
- [webUIPreview/imageMediaViewer.feature:136](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L136)
- [webUIPreview/imageMediaViewer.feature:145](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L145)
- [webUIPreview/imageMediaViewer.feature:154](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L154)

### [Media viewer previews are not visible in public share](https://github.com/owncloud/ocis/issues/1370)
- [webUIPreview/imageMediaViewer.feature:110](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIPreview/imageMediaViewer.feature#L110)

### [authentication dialog appears when user is deleted](https://github.com/owncloud/web/issues/4564)
### [login error page loops when logged in user is deleted](https://github.com/owncloud/ocis/issues/1129)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,30 @@ Scenario Outline: preview of image files with media viewer is possible
When the user views the file "testimage.mp3" in the media viewer using the webUI
Then the file "testimage.mp3" should be displayed in the media viewer webUI


Scenario: preview of image in file list view
Given user "user1" has uploaded file "testavatar.jpg" to "testavatar.jpg"
And user "user1" has logged in using the webUI
When the user browses to the files page
Then the preview image of file "testavatar.jpg" should be displayed in the file list view on the webUI


Scenario: preview of file in file list view when previews is disabled
Given the property "disablePreviews" of "options" has been set to true in web config file
And user "user1" has uploaded file "testavatar.jpg" to "testavatar.jpg"
And user "user1" has logged in using the webUI
When the user browses to the files page
Then the preview image of file "testavatar.jpg" should not be displayed in the file list view on the webUI


Scenario: file list view image preview in public share
Given user "user1" has uploaded file "testavatar.jpg" to "simple-empty-folder/testavatar.jpg"
And user "user1" has created a public link with following settings
| path | simple-empty-folder |
When the public uses the webUI to access the last public link created by user "user1"
Then the preview image of file "testavatar.jpg" should be displayed in the file list view on the webUI


Scenario: file list view image preview in public share when previews is disabled
Given the property "disablePreviews" of "options" has been set to true in web config file
And user "user1" has uploaded file "testavatar.jpg" to "simple-empty-folder/testavatar.jpg"
Expand All @@ -128,7 +132,7 @@ Scenario Outline: preview of image files with media viewer is possible
When the user views the file "testavatar.jpeg" in the media viewer using the webUI
Then the file "testavatar.jpeg" should be displayed in the media viewer webUI


@issue-ocis-1490 @issue-4667
Scenario: preview of image in file list view for .ogg format file
Given user "user1" has uploaded file "sampleOgg.ogg" to "sampleOgg.ogg"
And user "user1" has logged in using the webUI
Expand All @@ -146,7 +150,7 @@ Scenario Outline: preview of image files with media viewer is possible
When the user views the file "sampleGif.gif" in the media viewer using the webUI
Then the file "sampleGif.gif" should be displayed in the media viewer webUI


@issue-ocis-1490 @issue-4667
Scenario: preview of image in file list view for .webm format file
Given user "user1" has uploaded file "sampleWebm.webm" to "sampleWebm.webm"
And user "user1" has logged in using the webUI
Expand Down
27 changes: 17 additions & 10 deletions tests/acceptance/pageObjects/FilesPageElement/filesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@ module.exports = {
* @param {string} fileName
* @return {Promise<*>}
*/
isPreviewImageDisplayed: async function(fileName) {
isPreviewImageDisplayed: async function(fileName, shouldOrShouldnot) {
await this.waitForFileVisible(fileName)
const element = util.format(this.elements.previewImage.selector, fileName)
const element = util.format(this.elements.previewImageParentDiv.selector, fileName)
const imageSelector = util.format(this.elements.previewImage.selector, fileName)
let previewStatus = ''
await this.useXpath()
.waitForElementVisible(element)
.getAttribute(
{ selector: element, locateStrategy: this.elements.previewImage.locateStrategy },
'data-preview-loaded',
result => (previewStatus = result.value === 'true')
)
await this.useXpath().waitForElementVisible(element)
if (shouldOrShouldnot === 'should') {
await this.useXpath().waitForElementVisible(imageSelector)
}
await this.getAttribute(
{ selector: element, locateStrategy: this.elements.previewImageParentDiv.locateStrategy },
'data-preview-loaded',
result => (previewStatus = result.value === 'true')
)
return previewStatus
},
/**
Expand Down Expand Up @@ -907,9 +910,13 @@ module.exports = {
filesListItem: {
selector: '.vue-recycle-scroller__item-view'
},
previewImage: {
previewImageParentDiv: {
selector: '//div[@filename="%s"]/ancestor::div[contains(@class, "oc-file")]',
locateStrategy: 'xpath'
},
previewImage: {
selector: '//div[@filename="%s"]/ancestor::div[contains(@class, "oc-file")]/img',
locateStrategy: 'xpath'
}
}
}
33 changes: 11 additions & 22 deletions tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -1259,30 +1259,19 @@ Then('the search bar should be visible in the webUI', async function() {
})

Then(
'the preview image of file {string} should not be displayed in the file list view on the webUI',
async function(fileName) {
/^the preview image of file "([^"]*)" (should|should not) be displayed in the file list view on the webUI$/,
async function(fileName, shouldOrShouldnot) {
let expected = true
let message = 'Expected preview image to be displayed but is not displayed'
const isPreviewDisplayed = await client.page.FilesPageElement.filesList().isPreviewImageDisplayed(
fileName
)
assert.strictEqual(
isPreviewDisplayed,
false,
'Expected preview image to be not displayed but is displayed'
)
}
)

Then(
'the preview image of file {string} should be displayed in the file list view on the webUI',
async function(fileName) {
const isPreviewDisplayed = await client.page.FilesPageElement.filesList().isPreviewImageDisplayed(
fileName
)
assert.strictEqual(
isPreviewDisplayed,
true,
'Expected preview image to be displayed but is not displayed'
fileName,
shouldOrShouldnot
)
if (shouldOrShouldnot === 'should not') {
expected = false
message = 'Expected preview image to be not displayed but is displayed'
}
assert.strictEqual(isPreviewDisplayed, expected, message)
}
)

Expand Down

0 comments on commit ff601b8

Please sign in to comment.