Skip to content

Commit

Permalink
fix(cypress): Adjust sharing tests for new sidebar tab for sharing
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Nov 6, 2023
1 parent 33ca0af commit 0defaf8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/sidebar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import { createFolder, goToDir, moveFile, renameFile } from './filesUtils'
import { addComment, addTag, addToFavorites, createPublicShare, removeFromFavorites, showActivityTab } from './sidebarUtils'

describe('Check activity listing in the sidebar', () => {
before(function() {
describe('Check activity listing in the sidebar', { testIsolation: true }, () => {
beforeEach(function() {
cy.createRandomUser()
.then((user) => {
cy.login(user)
Expand Down
22 changes: 14 additions & 8 deletions cypress/e2e/sidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,23 @@
*
*/

import { toggleMenuAction } from "./filesUtils"
import { toggleMenuAction } from './filesUtils'

function showSidebarForFile(fileName: string) {
closeSidebar()
toggleMenuAction(fileName)
cy.get('[data-cy-files-list-row-action="details"]').click()
cy.get('#app-sidebar-vue').contains('Activity').click()
cy.get('#app-sidebar-vue').should('be.visible')
}

function closeSidebar() {
cy.get('body')
.then(($body) => {
if ($body.find('.app-sidebar__close').length !== 0) {
cy.get('.app-sidebar__close').click()
cy.get('.app-sidebar__close').click({ force: true })
}
})
cy.get('#app-sidebar-vue').should('not.exist')
}

export function showActivityTab(fileName: string) {
Expand All @@ -55,14 +56,19 @@ export function removeFromFavorites(fileName: string) {
cy.get('.toast-close').click()
}

/**
* Create a new public link share for a given file
*
* @param fileName Name of the file to share
*/
export function createPublicShare(fileName: string) {
toggleMenuAction(fileName)
cy.contains('Open details').click()
showSidebarForFile(fileName)
cy.get('#app-sidebar-vue').contains('Sharing').click()

cy.get('#app-sidebar-vue [data-id="sharing"]').trigger('click')
cy.get('#app-sidebar-vue button.new-share-link').trigger('click')
cy.get('#app-sidebar-vue a.sharing-entry__copy')
cy.get('#app-sidebar-vue #tab-sharing').should('be.visible')
cy.get('#app-sidebar-vue button.new-share-link').click({ force: true })
cy.get('#app-sidebar-vue a.sharing-entry__copy').should('be.visible')
closeSidebar()
}

export function addTag(fileName: string, tag: string) {
Expand Down

0 comments on commit 0defaf8

Please sign in to comment.