diff --git a/cypress/ocm-test-suite/cypress/e2e/re-route/nextcloud-v28-to-nextcloud-v28.js b/cypress/ocm-test-suite/cypress/e2e/re-route/nextcloud-v28-to-nextcloud-v28.js new file mode 100644 index 00000000..10fbc0e4 --- /dev/null +++ b/cypress/ocm-test-suite/cypress/e2e/re-route/nextcloud-v28-to-nextcloud-v28.js @@ -0,0 +1,35 @@ +import { createShareV28, renameFileV28 } from '../utils/nextcloud-v28' + +before(() => { + // makes custom commands available to all subsequent cy.origin('url') + // calls in this spec. put it in your support file to make them available to + // all specs + cy.origin('https://nextcloud4.docker', () => { + Cypress.require('../../support/commands') + }) +}) + +describe('Native federated sharing functionality for Nextcloud v2.8', () => { + it('Accept federated share from Nextcloud to Nextcloud', () => { + // share from Nextcloud 3. + cy.loginNextcloud('https://nextcloud3.docker', 'yashar', 'pmh') + + renameFileV28('welcome.txt', 'nc3-to-nc4-share.txt') + createShareV28('nc3-to-nc4-share.txt', 'madeline', 'nextcloud4.docker') + + // accept share from Nextcloud 2. + cy.origin('https://nextcloud4.docker', () => { + cy.loginNextcloud('/', 'madeline', 'oleary') + + cy.get('div[class="oc-dialog"]', { timeout: 10000 }) + .should('be.visible') + .find('*[class^="oc-dialog-buttonrow"]') + .find('button[class="primary"]') + .click() + + // TODO: verify share received: 1. check for file name existence, 2. check if it can be downloaded, 3. compare checksum to the original file to make sure it is the same file. + // 1. check for filename existence. + cy.get('[data-file="nc3-to-nc4-share.txt"]', { timeout: 10000 }).should('be.visible') + }) + }) +}) diff --git a/cypress/ocm-test-suite/cypress/e2e/re-route/owncloud-to-nextcloud-v28.js b/cypress/ocm-test-suite/cypress/e2e/re-route/owncloud-to-nextcloud-v28.js new file mode 100644 index 00000000..27af4a92 --- /dev/null +++ b/cypress/ocm-test-suite/cypress/e2e/re-route/owncloud-to-nextcloud-v28.js @@ -0,0 +1,35 @@ +import { createShare, renameFile } from '../utils/owncloud' + +before(() => { + // makes custom commands available to all subsequent cy.origin('url') + // calls in this spec. put it in your support file to make them available to + // all specs + cy.origin('https://nextcloud3.docker', () => { + Cypress.require('../../support/commands') + }) +}) + +describe('Native federated sharing functionality for ownCloud', () => { + it('Accept federated share from ownCloud to Nextcloudn v2.8', () => { + // share from ownCloud 1. + cy.loginOwncloud('https://owncloud1.docker', 'marie', 'radioactivity') + + // renameFile('welcome.txt', 'oc1-to-oc2-share.txt') + createShare('oc1-to-oc2-share.txt', 'yashar', 'nextcloud3.docker') + + // accept share from Nextloud 1. + cy.origin('https://nextcloud3.docker', () => { + cy.loginNextcloud('/', 'yashar', 'pmh') + + cy.get('div[class="oc-dialog"]', { timeout: 10000 }) + .should('be.visible') + .find('*[class^="oc-dialog-buttonrow"]') + .find('button[class="primary"]') + .click() + + // TODO: verify share received: 1. check for file name existence, 2. check if it can be downloaded, 3. compare checksum to the original file to make sure it is the same file. + // 1. check for filename existence. + cy.get('[data-file="oc1-to-oc2-share.txt"]', { timeout: 10000 }).should('be.visible') + }) + }) +}) diff --git a/cypress/ocm-test-suite/cypress/e2e/share-with/5-nextcloud-v27-to-nextcloud-v28.js b/cypress/ocm-test-suite/cypress/e2e/share-with/5-nextcloud-v27-to-nextcloud-v28.js new file mode 100644 index 00000000..030e6ac7 --- /dev/null +++ b/cypress/ocm-test-suite/cypress/e2e/share-with/5-nextcloud-v27-to-nextcloud-v28.js @@ -0,0 +1,35 @@ +import { createShareV27, renameFileV27 } from '../utils/nextcloud-v27' + +before(() => { + // makes custom commands available to all subsequent cy.origin('url') + // calls in this spec. put it in your support file to make them available to + // all specs + cy.origin('https://nextcloud3.docker', () => { + Cypress.require('../../support/commands') + }) +}) + +describe('Native federated sharing functionality for Nextcloud v2.7', () => { + it('Accept federated share from Nextcloud to Nextcloud', () => { + // share from Nextcloud 1. + cy.loginNextcloud('https://nextcloud1.docker', 'einstein', 'relativity') + + // renameFileV27('welcome.txt', 'nc1-to-nc2-share.txt') + createShareV27('nc1-to-nc2-share.txt', 'yashar', 'nextcloud3.docker') + + // accept share from Nextcloud 3. + cy.origin('https://nextcloud3.docker', () => { + cy.loginNextcloud('/', 'yashar', 'pmh') + + cy.get('div[class="oc-dialog"]', { timeout: 10000 }) + .should('be.visible') + .find('*[class^="oc-dialog-buttonrow"]') + .find('button[class="primary"]') + .click() + + // TODO: verify share received: 1. check for file name existence, 2. check if it can be downloaded, 3. compare checksum to the original file to make sure it is the same file. + // 1. check for filename existence. + cy.get('[data-file="nc1-to-nc2-share.txt"]', { timeout: 10000 }).should('be.visible') + }) + }) +}) diff --git a/cypress/ocm-test-suite/cypress/e2e/share-with/6-nextcloud-v28-to-nextcloud-v27.cy.js b/cypress/ocm-test-suite/cypress/e2e/share-with/6-nextcloud-v28-to-nextcloud-v27.cy.js new file mode 100644 index 00000000..9fe52380 --- /dev/null +++ b/cypress/ocm-test-suite/cypress/e2e/share-with/6-nextcloud-v28-to-nextcloud-v27.cy.js @@ -0,0 +1,35 @@ +import { createShareV28, renameFileV28 } from '../utils/nextcloud-v28' + +before(() => { + // makes custom commands available to all subsequent cy.origin('url') + // calls in this spec. put it in your support file to make them available to + // all specs + cy.origin('https://nextcloud2.docker', () => { + Cypress.require('../../support/commands') + }) +}) + +describe('Native federated sharing functionality for Nextcloud v2.8', () => { + it('Accept federated share from Nextcloud 28 to Nextcloud 27', () => { + // share from Nextcloud 4. + cy.loginNextcloud('https://nextcloud4.docker', 'madeline', 'oleary') + + renameFileV28('welcome.txt', 'nc4-to-nc2-share.txt') + createShareV28('nc4-to-nc2-share.txt', 'michiel', 'nextcloud2.docker') + + // accept share from Nextcloud 2. + cy.origin('https://nextcloud2.docker', () => { + cy.loginNextcloud('/', 'michiel', 'dejong') + + cy.get('div[class="oc-dialog"]', { timeout: 10000 }) + .should('be.visible') + .find('*[class^="oc-dialog-buttonrow"]') + .find('button[class="primary"]') + .click() + + // TODO: verify share received: 1. check for file name existence, 2. check if it can be downloaded, 3. compare checksum to the original file to make sure it is the same file. + // 1. check for filename existence. + cy.get('[data-file="nc4-to-nc2-share.txt"]', { timeout: 10000 }).should('be.visible') + }) + }) +}) diff --git a/cypress/ocm-test-suite/cypress/e2e/share-with/7-nextcloud-v28-to-owncloud.cy.js b/cypress/ocm-test-suite/cypress/e2e/share-with/7-nextcloud-v28-to-owncloud.cy.js new file mode 100644 index 00000000..7a139b65 --- /dev/null +++ b/cypress/ocm-test-suite/cypress/e2e/share-with/7-nextcloud-v28-to-owncloud.cy.js @@ -0,0 +1,35 @@ +import { createShareV28, renameFileV28 } from '../utils/nextcloud-v28' + +before(() => { + // makes custom commands available to all subsequent cy.origin('url') + // calls in this spec. put it in your support file to make them available to + // all specs + cy.origin('https://owncloud2.docker', () => { + Cypress.require('../../support/commands') + }) +}) + +describe('Native federated sharing functionality for Nextcloud v2.8', () => { + it('Accept federated share from Nextcloud to Nextcloud', () => { + // share from Nextcloud 3. + cy.loginNextcloud('https://nextcloud3.docker', 'yashar', 'pmh') + + renameFileV28('welcome.txt', 'nc3-to-nc4-share.txt') + createShareV28('nc3-to-nc4-share.txt', 'mahdi', 'owncloud2.docker') + + // accept share from Nextcloud 2. + cy.origin('https://owncloud2.docker', () => { + cy.loginOwncloud('/', 'mahdi', 'baghbani') + + cy.get('div[class="oc-dialog"]', { timeout: 10000 }) + .should('be.visible') + .find('*[class^="oc-dialog-buttonrow"]') + .find('button[class="primary"]') + .click() + + // TODO: verify share received: 1. check for file name existence, 2. check if it can be downloaded, 3. compare checksum to the original file to make sure it is the same file. + // 1. check for filename existence. + cy.get('[data-file="nc3-to-nc4-share.txt"]', { timeout: 10000 }).should('be.visible') + }) + }) +}) diff --git a/cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v27.js b/cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v27.js index 6e63f5ac..968af8b3 100644 --- a/cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v27.js +++ b/cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v27.js @@ -7,7 +7,7 @@ export function acceptShareV27() { } export function createShareV27(fileName, username, domain) { - openSharingPanel(fileName) + openSharingPanelV27(fileName) cy.get('#app-sidebar-vue').within(() => { cy.get('#sharing-search-input').clear() @@ -33,7 +33,7 @@ export function renameFileV27(fileName, newFileName) { cy.wait('@moveFile') } -export function openSharingPanel(fileName) { +export function openSharingPanelV27(fileName) { triggerActionForFileV27(fileName, 'Share') cy.get('#app-sidebar-vue') diff --git a/cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v28.js b/cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v28.js new file mode 100644 index 00000000..4a260bcf --- /dev/null +++ b/cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v28.js @@ -0,0 +1,84 @@ +export function acceptShareV28() { + cy.get('div[class="oc-dialog"]', { timeout: 10000 }) + .should('be.visible') + .find('*[class^="oc-dialog-buttonrow"]') + .find('button[class="primary"]') + .click() +} + +export function createShareV28(fileName, username, domain) { + openSharingPanelV28(fileName) + + cy.get('#app-sidebar-vue').within(() => { + cy.get('#sharing-search-input').clear() + cy.intercept({ times: 1, method: 'GET', url: '**/apps/files_sharing/api/v1/sharees?*' }).as('userSearch') + cy.get('#sharing-search-input').type(username + '@' + domain) + cy.wait('@userSearch') + }) + + // ensure selecting remote [sharetype="6"] instead of email! + cy.get(`[user="${username}"]`).click() + + // cy.get('[data-cy-files-sharing-share-editor-action="save"]').click({ scrollBehavior: 'nearest' }) + cy.get('*[class^="sharingTabDetailsView"]').find('*[class^="sharingTabDetailsView__footer"]').find('*[class^="button-group"]').find('*[class^="button-vue button-vue--text-only button-vue--vue-primary"]').click() + + // HACK: Save the share and then update it, as permissions changes are currently not saved for new share. + // updateShareV28(fileName, 0) // @MahdiBaghbani: not sure about this yet. +} + +export function updateShareV28(fileName, index) { + openSharingPanelV28(fileName) + + cy.get('#app-sidebar-vue').within(() => { + cy.get('[data-cy-files-sharing-share-actions]').eq(index).click() + cy.get('[data-cy-files-sharing-share-permissions-bundle="custom"]').click() + + cy.get('[data-cy-files-sharing-share-permissions-checkbox="download"]').find('input').as('downloadCheckbox') + // Force:true because the checkbox is hidden by the pretty UI. + cy.get('@downloadCheckbox').check({ force: true, scrollBehavior: 'nearest' }) + + cy.get('[data-cy-files-sharing-share-permissions-checkbox="read"]').find('input').as('readCheckbox') + // Force:true because the checkbox is hidden by the pretty UI. + cy.get('@readCheckbox').check({ force: true, scrollBehavior: 'nearest' }) + + cy.get('[data-cy-files-sharing-share-permissions-checkbox="update"]').find('input').as('updateCheckbox') + // Force:true because the checkbox is hidden by the pretty UI. + cy.get('@updateCheckbox').check({ force: true, scrollBehavior: 'nearest' }) + + cy.get('[data-cy-files-sharing-share-permissions-checkbox="delete"]').find('input').as('deleteCheckbox') + // Force:true because the checkbox is hidden by the pretty UI. + cy.get('@deleteCheckbox').check({ force: true, scrollBehavior: 'nearest' }) + + cy.get('[data-cy-files-sharing-share-editor-action="save"]').click({ scrollBehavior: 'nearest' }) + }) +} + +export const renameFileV28 = (fileName, newFileName) => { + getRowForFileV28(fileName) + triggerActionForFileV28(fileName, 'rename') + + // intercept the move so we can wait for it. + cy.intercept('MOVE', /\/remote.php\/dav\/files\//).as('moveFile') + getRowForFileV28(fileName).find('[data-cy-files-list-row-name] input').clear() + getRowForFileV28(fileName).find('[data-cy-files-list-row-name] input').type(`${newFileName}{enter}`) + cy.wait('@moveFile') +} + +export function openSharingPanelV28(fileName) { + triggerActionForFileV28(fileName, 'details') + + cy.get('#app-sidebar-vue') + .get('[aria-controls="tab-sharing"]') + .click() +} + +export const triggerActionForFileV28 = (filename, actionId) => { + getActionButtonForFileV28(filename).click() + cy.get(`[data-cy-files-list-row-action="${CSS.escape(actionId)}"] > button`).should('exist').click() +} + +export const getActionButtonForFileV28 = (filename) => getActionsForFileV28(filename).find('button[aria-label="Actions"]') + +export const getActionsForFileV28 = (filename) => getRowForFileV28(filename).find('[data-cy-files-list-row-actions]') + +export const getRowForFileV28 = (filename) => cy.get(`[data-cy-files-list-row-name="${CSS.escape(filename)}"]`) diff --git a/docker/scripts/init-nextcloud-ocm-test-suite.sh b/docker/scripts/init-nextcloud-ocm-test-suite.sh index 13ffcb67..f113a805 100755 --- a/docker/scripts/init-nextcloud-ocm-test-suite.sh +++ b/docker/scripts/init-nextcloud-ocm-test-suite.sh @@ -14,7 +14,7 @@ sed -i "8 i\ 1 => 'nc1.docker'," /var/www/html/config sed -i "9 i\ 2 => 'nc2.docker'," /var/www/html/config/config.php sed -i "10 i\ 3 => 'nextcloud1.docker'," /var/www/html/config/config.php sed -i "11 i\ 4 => 'nextcloud2.docker'," /var/www/html/config/config.php -sed -i "12 i\ 3 => 'nextcloud3.docker'," /var/www/html/config/config.php -sed -i "13 i\ 4 => 'nextcloud4.docker'," /var/www/html/config/config.php +sed -i "12 i\ 5 => 'nextcloud3.docker'," /var/www/html/config/config.php +sed -i "13 i\ 6 => 'nextcloud4.docker'," /var/www/html/config/config.php # php console.php app:enable sciencemesh diff --git a/docker/scripts/init-nextcloud-sciencemesh.sh b/docker/scripts/init-nextcloud-sciencemesh.sh index 66fca03b..a0d2887d 100755 --- a/docker/scripts/init-nextcloud-sciencemesh.sh +++ b/docker/scripts/init-nextcloud-sciencemesh.sh @@ -14,5 +14,7 @@ sed -i "8 i\ 1 => 'nc1.docker'," /var/www/html/config sed -i "9 i\ 2 => 'nc2.docker'," /var/www/html/config/config.php sed -i "10 i\ 3 => 'nextcloud1.docker'," /var/www/html/config/config.php sed -i "11 i\ 4 => 'nextcloud2.docker'," /var/www/html/config/config.php +sed -i "12 i\ 5 => 'nextcloud3.docker'," /var/www/html/config/config.php +sed -i "13 i\ 6 => 'nextcloud4.docker'," /var/www/html/config/config.php php console.php app:enable sciencemesh diff --git a/docker/scripts/init-nextcloud.sh b/docker/scripts/init-nextcloud.sh index bc678ea9..27e34de3 100755 --- a/docker/scripts/init-nextcloud.sh +++ b/docker/scripts/init-nextcloud.sh @@ -14,5 +14,5 @@ sed -i "8 i\ 1 => 'nc1.docker'," /var/www/html/config sed -i "9 i\ 2 => 'nc2.docker'," /var/www/html/config/config.php sed -i "10 i\ 3 => 'nextcloud1.docker'," /var/www/html/config/config.php sed -i "11 i\ 4 => 'nextcloud2.docker'," /var/www/html/config/config.php -sed -i "12 i\ 3 => 'nextcloud3.docker'," /var/www/html/config/config.php -sed -i "13 i\ 4 => 'nextcloud4.docker'," /var/www/html/config/config.php +sed -i "12 i\ 5 => 'nextcloud3.docker'," /var/www/html/config/config.php +sed -i "13 i\ 6 => 'nextcloud4.docker'," /var/www/html/config/config.php