Skip to content

Commit

Permalink
wip (debug): Check that default expiration date is shown b4 create share
Browse files Browse the repository at this point in the history
Signed-off-by: nfebe <fenn25.fn@gmail.com>
  • Loading branch information
nfebe committed Feb 5, 2025
1 parent d9d2c0f commit 97c913b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@

<!-- expiration date -->
<NcActionInput v-if="(pendingDefaultExpirationDate || pendingEnforcedExpirationDate) && defaultExpirationDateEnabled"
data-cy-files-sharing-expiration-date-input
class="share-link-expire-date"
:label="pendingEnforcedExpirationDate ? t('files_sharing', 'Enter expiration date (enforced)') : t('files_sharing', 'Enter expiration date')"
:disabled="saving"
Expand Down
14 changes: 9 additions & 5 deletions cypress/e2e/files_sharing/public-share/setup-public-share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export function setupData(user: User, shareName: string): void {
*/
function checkPasswordState(enforced: boolean, alwaysAskForPassword: boolean) {
if (enforced) {
cy.contains('Password protection (enforced)').should('exist')
cy.contains('Password protection (enforced)').should('exist')
} else if (alwaysAskForPassword) {
cy.contains('Password protection').should('exist')
cy.contains('Password protection').should('exist')
}
cy.contains('Enter a password')
.should('exist')
Expand All @@ -68,13 +68,17 @@ function checkPasswordState(enforced: boolean, alwaysAskForPassword: boolean) {
*/
function checkExpirationDateState(enforced: boolean, hasDefault: boolean) {
if (enforced) {
cy.contains('Enable link expiration (enforced)').should('exist')
cy.contains('Enable link expiration (enforced)').should('exist')
} else if (hasDefault) {
cy.contains('Enable link expiration').should('exist')
cy.contains('Enable link expiration').should('exist')
}
cy.contains('Enter expiration date')
.should('exist')
.and('not.be.disabled')
cy.findByLabelText(/Enter expiration date/i)
cy.findByRole('textbox', { name: /Enter expiration date/i })
.and('have.attr', 'type')
.should('exist').should('be.visible')
}

/**
Expand All @@ -90,7 +94,7 @@ export function createShare(context: ShareContext, shareName: string, options: S

cy.intercept('POST', '**/ocs/v2.php/apps/files_sharing/api/v1/shares').as('createShare')
cy.findByRole('button', { name: 'Create a new share link' }).click()
// Conduct optional checks based on the provided options
// Conduct optional checks based on the provided options
if (options) {
cy.get('.sharing-entry__actions').should('be.visible') // Wait for the dialog to open
checkPasswordState(options.enforcePassword ?? false, options.alwaysAskForPassword ?? false)
Expand Down

0 comments on commit 97c913b

Please sign in to comment.