diff options
author | nfebe <fenn25.fn@gmail.com> | 2025-02-05 16:40:08 +0100 |
---|---|---|
committer | nfebe <fenn25.fn@gmail.com> | 2025-02-06 22:14:16 +0100 |
commit | 23e70a574e2a2ee1adf6727f18baeb3fd1b5fef8 (patch) | |
tree | 4e90091d290167c68ab72b90dd7da13d52e4fbe9 | |
parent | b4cc4efaf291fd808d29b2121f2961f0dbaf2ad7 (diff) | |
download | nextcloud-server-23e70a574e2a2ee1adf6727f18baeb3fd1b5fef8.tar.gz nextcloud-server-23e70a574e2a2ee1adf6727f18baeb3fd1b5fef8.zip |
test(files_sharing): Check that default expiration date is shown b4 create share
Signed-off-by: nfebe <fenn25.fn@gmail.com>
-rw-r--r-- | apps/files_sharing/src/components/SharingEntryLink.vue | 1 | ||||
-rw-r--r-- | cypress/e2e/files_sharing/public-share/setup-public-share.ts | 19 |
2 files changed, 15 insertions, 5 deletions
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue index a3b8de16e59..e07aec73b08 100644 --- a/apps/files_sharing/src/components/SharingEntryLink.vue +++ b/apps/files_sharing/src/components/SharingEntryLink.vue @@ -91,6 +91,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" diff --git a/cypress/e2e/files_sharing/public-share/setup-public-share.ts b/cypress/e2e/files_sharing/public-share/setup-public-share.ts index ca63ca2aba5..ac40d318592 100644 --- a/cypress/e2e/files_sharing/public-share/setup-public-share.ts +++ b/cypress/e2e/files_sharing/public-share/setup-public-share.ts @@ -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') @@ -68,13 +68,22 @@ 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.get('input[data-cy-files-sharing-expiration-date-input]').should('exist') + cy.get('input[data-cy-files-sharing-expiration-date-input]') + .invoke('val') + .then((val) => { + const expectedDate = new Date() + expectedDate.setDate(expectedDate.getDate() + 2) + expect(new Date(val).toDateString()).to.eq(expectedDate.toDateString()) + }) + } /** @@ -90,7 +99,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) |