From 95c57f7a44059cbbd4d700338b80fa45d974640c Mon Sep 17 00:00:00 2001 From: HariBhandari Date: Wed, 27 Nov 2019 11:55:51 +0545 Subject: [PATCH] check only versions tab is displayed in public link page --- .../shareByPublicLink.feature | 17 +++++++++++++++++ tests/acceptance/pageObjects/filesPage.js | 17 +++++++++++++++++ .../acceptance/stepDefinitions/filesContext.js | 9 +++++++++ 3 files changed, 43 insertions(+) diff --git a/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature b/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature index 8004e0c4992..fb7821a7fa4 100644 --- a/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature +++ b/tests/acceptance/features/webUISharingPublic/shareByPublicLink.feature @@ -821,3 +821,20 @@ Feature: Share by public link | element | name | | folder | simple-folder | | file | lorem.txt | + + @issue-2090 + Scenario: access details dialog of public share and check the tabs displayed + Given user "user1" has logged in using the webUI + When the user creates a new public link for folder "simple-folder" using the webUI with + | role | Editor | + And the public uses the webUI to access the last public link created by user "user1" + And the user picks the row of file "lorem.txt" in the webUI + Then the following tabs should be visible in the details dialog + | name | + | versions | + | links | + | collaborators | +# Then the following tabs should not be visible in the details dialog +# | name | +# | links | +# | collaborators | diff --git a/tests/acceptance/pageObjects/filesPage.js b/tests/acceptance/pageObjects/filesPage.js index 27f72e1d8ff..ab6f169901e 100644 --- a/tests/acceptance/pageObjects/filesPage.js +++ b/tests/acceptance/pageObjects/filesPage.js @@ -246,6 +246,19 @@ module.exports = { callback(result.value) }) }, + getVisibleTabs: async function () { + const tabs = [] + let elements + await this.api.elements('@tabsInSideBar', function (result) { + elements = result.value + }) + for (const { ELEMENT } of elements) { + await this.api.elementIdText(ELEMENT, function (result) { + tabs.push(result.value.toLowerCase()) + }) + } + return tabs + }, copyPermalinkFromFilesAppBar: function () { return this .waitForElementVisible('@permalinkCopyButton') @@ -454,6 +467,10 @@ module.exports = { restorePreviousVersion: { selector: '(//div[contains(@id,"oc-file-versions")]//tbody/tr[@class="file-row"])[1]//button[1]', locateStrategy: 'xpath' + }, + tabsInSideBar: { + selector: '//div[@class="sidebar-container"]//li/a', + locateStrategy: 'xpath' } } } diff --git a/tests/acceptance/stepDefinitions/filesContext.js b/tests/acceptance/stepDefinitions/filesContext.js index ddb700ad339..03c5cdb9bbf 100644 --- a/tests/acceptance/stepDefinitions/filesContext.js +++ b/tests/acceptance/stepDefinitions/filesContext.js @@ -618,6 +618,15 @@ Then('the {string} details panel should be visible', function (panel) { }) }) +Then('the following tabs should be visible in the details dialog', async function (table) { + const visibleTabs = await client.page.filesPage().getVisibleTabs() + const expectedVisibleTabs = table.rows() + const difference = _.difference(expectedVisibleTabs.flat(), visibleTabs) + if (difference.length !== 0) { + throw new Error(`${difference} tabs was expected to be visible but not found.`) + } +}) + Then('no {string} tab should be available in the details panel', function (tab) { const tabSelector = client.page.filesPage().getXpathOfLinkToTabInSidePanel() return client.page.filesPage()