diff --git a/cypress/ocm-test-suite/cypress/e2e/invite-link/nextcloud-v27-to-ocis-5.cy.js b/cypress/ocm-test-suite/cypress/e2e/invite-link/nextcloud-v27-to-ocis-5.cy.js index d18b7171..3514d6ba 100644 --- a/cypress/ocm-test-suite/cypress/e2e/invite-link/nextcloud-v27-to-ocis-5.cy.js +++ b/cypress/ocm-test-suite/cypress/e2e/invite-link/nextcloud-v27-to-ocis-5.cy.js @@ -1,12 +1,12 @@ import { - verifyFederatedContactV27, + createInviteTokenV27, createScienceMeshShareV27, renameFileV27 } from '../utils/nextcloud-v27' import { - openScienceMeshAppV5, - createLegacyInviteLinkV5, + acceptInviteLinkV5, + verifyFederatedContactV5, acceptShareV5, verifyShareV5 } from '../utils/ocis-5' @@ -14,11 +14,10 @@ import { describe('Invite link federated sharing via ScienceMesh functionality for oCIS', () => { it('Send invitation from Nextcloud v27 to oCIS v5', () => { - cy.loginOcis('https://ocis1.docker', 'einstein', 'relativity') - - openScienceMeshAppV5() + cy.loginNextcloud('https://nextcloud1.docker', 'marie', 'radioactivity') + cy.visit('https://nextcloud1.docker/index.php/apps/sciencemesh/contacts') - createLegacyInviteLinkV5('nextcloud1.docker', 'ocis1.docker').then( + createInviteTokenV27('revanextcloud1.docker').then( (result) => { // save invite link to file. cy.writeFile('invite-link-nc-ocis.txt', result) @@ -28,17 +27,14 @@ describe('Invite link federated sharing via ScienceMesh functionality for oCIS', it('Accept invitation from Nextcloud v27 to oCIS v5', () => { - // load invite link from file. - cy.readFile('invite-link-nc-ocis.txt').then((url) => { + // load invite token from file. + cy.readFile('invite-link-nc-ocis.txt').then((token) => { - // accept invitation from Nextcloud 1. - cy.loginNextcloudCore(url, 'marie', 'radioactivity') + cy.loginOcis('https://ocis1.docker', 'einstein', 'relativity') - cy.get('input[id="accept-button"]', { timeout: 10000 }) - .click() + acceptInviteLinkV5(token) - // validate 'Albert Einstein' is shown as a contact. - verifyFederatedContactV27('nextcloud1.docker', 'Albert Einstein', 'ocis1.docker') + verifyFederatedContactV5('marie', 'revanextcloud1.docker') }) }) @@ -47,7 +43,7 @@ describe('Invite link federated sharing via ScienceMesh functionality for oCIS', cy.loginNextcloud('https://nextcloud1.docker', 'marie', 'radioactivity') renameFileV27('welcome.txt', 'invite-link-nc-ocis.txt') - createScienceMeshShareV27('nextcloud1.docker', 'Albert Einstein', 'ocis1.docker', 'invite-link-nc-ocis.txt') + createScienceMeshShareV27('nextcloud1.docker', 'Albert Einstein', 'https://ocis1.docker', 'invite-link-nc-ocis.txt') }) it('Receive ScienceMesh share from Nextcloud v27 to oCIS v5', () => { diff --git a/cypress/ocm-test-suite/cypress/e2e/invite-link/owncloud-v10-to-ocis-5.cy.js b/cypress/ocm-test-suite/cypress/e2e/invite-link/owncloud-v10-to-ocis-5.cy.js index 9845d8f4..89f16404 100644 --- a/cypress/ocm-test-suite/cypress/e2e/invite-link/owncloud-v10-to-ocis-5.cy.js +++ b/cypress/ocm-test-suite/cypress/e2e/invite-link/owncloud-v10-to-ocis-5.cy.js @@ -1,71 +1,39 @@ -import { createInviteToken, createScienceMeshShare, renameFile } from '../utils/owncloud' import { - openScienceMeshAppV5, - createLegacyInviteLinkV5, + createInviteToken, + createScienceMeshShare, + renameFile +} from '../utils/owncloud' +import { + acceptInviteLinkV5, + verifyFederatedContactV5, acceptShareV5, verifyShareV5 } from '../utils/ocis-5' describe('Invite link federated sharing via ScienceMesh functionality for ownCloud', () => { - // Temporary diablle this scenario beacuase of: https://github.com/pondersource/dev-stock/issues/129#issuecomment-2254133337 - // until that issue resolves, try to initiate invites from oCIS. - // it('Send invitation from ownCloud v10 to oCIS v5', () => { - - // cy.loginOwncloud('https://owncloud1.docker', 'marie', 'radioactivity') - // cy.visit('https://owncloud1.docker/index.php/apps/sciencemesh/') - - // createInviteToken('revaowncloud1.docker').then( - // (result) => { - // // save invite link to file. - // cy.writeFile('invite-link-oc-ocis.txt', result) - // } - // ) - // }) - - // it('Accept invitation from ownCloud v10 to oCIS v5', () => { - - // // load invite token from file. - // cy.readFile('invite-link-oc-ocis.txt').then((token) => { - - // cy.loginOcis('https://ocis1.docker', 'einstein', 'relativity') - - // acceptInviteLinkV5(token) + it('Send invitation from ownCloud v10 to oCIS v5', () => { - // verifyFederatedContactV5('marie', 'revaowncloud1.docker') - // }) - // }) - - it('Send invitation from oCIS v5 to ownCloud v10', () => { - - cy.loginOcis('https://ocis1.docker', 'einstein', 'relativity') - - openScienceMeshAppV5() + cy.loginOwncloud('https://owncloud1.docker', 'marie', 'radioactivity') + cy.visit('https://owncloud1.docker/index.php/apps/sciencemesh/') - createLegacyInviteLinkV5('owncloud1.docker', 'ocis1.docker').then( + createInviteToken('revaowncloud1.docker').then( (result) => { // save invite link to file. - cy.writeFile('invite-link-ocis-oc.txt', result) + cy.writeFile('invite-link-oc-ocis.txt', result) } ) }) - it('Accept invitation from oCIS v5 to ownCloud v10', () => { - - // load invite link from file. - cy.readFile('invite-link-ocis-oc.txt').then((url) => { + it('Accept invitation from ownCloud v10 to oCIS v5', () => { - // accept invitation from ownCloud 1. - cy.loginOwncloudCore(url, 'marie', 'radioactivity') + // load invite token from file. + cy.readFile('invite-link-oc-ocis.txt').then((token) => { - cy.get('input[id="accept-button"]', { timeout: 10000 }) - .click() + cy.loginOcis('https://ocis1.docker', 'einstein', 'relativity') - // validate 'Albert Einstein' is shown as a contact. - cy.visit('https://owncloud1.docker/index.php/apps/sciencemesh/contacts') + acceptInviteLinkV5(token) - cy.get('table[id="contact-table"]') - .find('p[class="displayname"]') - .should("have.text", "Albert Einstein"); + verifyFederatedContactV5('marie', 'revaowncloud1.docker') }) }) 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 71fb5b55..2c4a8778 100644 --- a/cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v27.js +++ b/cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v27.js @@ -39,9 +39,25 @@ export function createShareLinkV27(fileName) { }) } +export function createInviteTokenV27(senderDomain) { + + cy.get('button[id="token-generator"]').should('be.visible').click() + + return cy.get('input[class="generated-token-link"]') + .invoke('val') + .then( + sometext => { + // extract token from url. + const token = sometext.replace('https://meshdir.docker/meshdir?token=', ''); + + return token.replace(`&providerDomain=${senderDomain}`, '') + } + ); +} + export function createInviteLinkV27(targetDomain) { - cy.get('button[id="token-generator"]').click() + cy.get('button[id="token-generator"]').should('be.visible').click() return cy.get('input[class="generated-token-link"]') .invoke('val') @@ -95,7 +111,16 @@ export function getScienceMeshContactIdFromDisplayNameV27(domain, displayName, c .invoke('text') .then( usernameWithDomain => { - return usernameWithDomain + // get the index of the last @ + var lastIndex = usernameWithDomain.lastIndexOf('@'); + var username = usernameWithDomain.substr(0, lastIndex) + var domain = usernameWithDomain.substr(lastIndex + 1) + + // remove https:// or http:// from domain (reva likes to show username@https://domain sometimes) + // I'm too afraid to explain the regex here let's just say its from here: https://stackoverflow.com/a/8206299/8549230 + domain = domain.replace(/^\/\/|^.*?:(\/\/)?/, ''); + + return username + '@' + domain } ) } diff --git a/cypress/ocm-test-suite/cypress/e2e/utils/ocis-5.js b/cypress/ocm-test-suite/cypress/e2e/utils/ocis-5.js index 05a2f384..93245706 100644 --- a/cypress/ocm-test-suite/cypress/e2e/utils/ocis-5.js +++ b/cypress/ocm-test-suite/cypress/e2e/utils/ocis-5.js @@ -58,9 +58,9 @@ export function acceptInviteLinkV5(token) { }) getScienceMeshAcceptInvitePartV5('label', 'institution').within(() => { - cy.get('div[class="vs__actions"').click() + cy.get('div[class="vs__actions"').should('be.visible').click() - cy.get('ul[role="listbox"]').find('li').first().click() + cy.get('ul[role="listbox"]').find('li').first().should('be.visible').click() }) getScienceMeshAcceptInvitePartV5('span', 'accept').click() diff --git a/cypress/ocm-test-suite/cypress/e2e/utils/owncloud.js b/cypress/ocm-test-suite/cypress/e2e/utils/owncloud.js index 30faad31..b0a97cbc 100644 --- a/cypress/ocm-test-suite/cypress/e2e/utils/owncloud.js +++ b/cypress/ocm-test-suite/cypress/e2e/utils/owncloud.js @@ -19,6 +19,7 @@ export function createShare(fileName, username, domain) { // ensure selecting remote, instead of email or group. cy.get('*[class^=ui-autocomplete]') .contains('span[class="autocomplete-item-typeInfo"]', 'Federated') + .should('be.visible') .click() } @@ -35,6 +36,7 @@ export function createShareGroup(fileName, group) { // ensure selecting remote, instead of email or group. cy.get('*[class^=ui-autocomplete]') .contains('span[class="autocomplete-item-typeInfo"]', 'Group') + .should('be.visible') .click() } @@ -48,6 +50,7 @@ export function createShareLink(fileName) { .should('be.visible') .find('*[class^="oc-dialog-buttonrow"]') .find('button[class="primary"]') + .should('be.visible') .click() return cy.get('*[data-original-title^="Copy to clipboard"]') @@ -64,7 +67,7 @@ export function createShareLink(fileName) { export function createInviteToken(senderDomain) { - cy.get('button[id="token-generator"]').click() + cy.get('button[id="token-generator"]').should('be.visible').click() return cy.get('input[class="generated-token-link"]') .invoke('val') @@ -80,7 +83,7 @@ export function createInviteToken(senderDomain) { export function createInviteLink(targetDomain) { - cy.get('button[id="token-generator"]').click() + cy.get('button[id="token-generator"]').should('be.visible').click() return cy.get('input[class="generated-token-link"]') .invoke('val') @@ -129,16 +132,17 @@ export function openSharingPanel(fileName) { cy.get('#app-sidebar') .get('[data-tabid="shareTabView"]') + .should('be.visible') .click() } export function triggerActionInFileMenu (fileName, actionId) { triggerActionForFile(fileName,'menu') - getRowForFile(fileName).find('*[class^="filename"]').find('*[class^="fileActionsMenu"]').find(`[data-action="${CSS.escape(actionId)}"]`).should('exist').click() + getRowForFile(fileName).find('*[class^="filename"]').find('*[class^="fileActionsMenu"]').find(`[data-action="${CSS.escape(actionId)}"]`).should('be.visible').click() } -export const triggerActionForFile = (filename, actionId) => getActionsForFile(filename).find(`[data-action="${CSS.escape(actionId)}"]`).should('exist').click() +export const triggerActionForFile = (filename, actionId) => getActionsForFile(filename).find(`[data-action="${CSS.escape(actionId)}"]`).should('be.visible').as('action-btn').click() -export const getActionsForFile = (filename) => getRowForFile(filename).find('*[class^="filename"]').find('*[class^="name"]').find('*[class^="fileactions"]') +export const getActionsForFile = (filename) => getRowForFile(filename).find('*[class^="filename"]').find('*[class^="name"]').find('*[class^="fileactions"]').should('be.visible') export const getRowForFile = (filename) => cy.get(`[data-file="${CSS.escape(filename)}"]`) diff --git a/dev/ocm-test-suite/invite-link/nextcloud-ocis.sh b/dev/ocm-test-suite/invite-link/nextcloud-ocis.sh index a19601f2..5fc22b23 100755 --- a/dev/ocm-test-suite/invite-link/nextcloud-ocis.sh +++ b/dev/ocm-test-suite/invite-link/nextcloud-ocis.sh @@ -230,8 +230,8 @@ changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance1--webdav--ho changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--domain--|" "revanextcloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--homepage--|" "revanextcloud1.docker" -changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--|" "revanextcloud1.docker/ocm/" -changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--path--|" "revanextcloud1.docker" +changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--|" "revanextcloud1.docker" +changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--path--|" "revanextcloud1.docker/ocm/" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--host--|" "revanextcloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--webdav--|" "nextcloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--webdav--path--|" "nextcloud1.docker/remote.php/webdav/" diff --git a/dev/ocm-test-suite/invite-link/ocis-nextcloud.sh b/dev/ocm-test-suite/invite-link/ocis-nextcloud.sh index d3f02a44..aca61992 100755 --- a/dev/ocm-test-suite/invite-link/ocis-nextcloud.sh +++ b/dev/ocm-test-suite/invite-link/ocis-nextcloud.sh @@ -230,8 +230,8 @@ changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance1--webdav--ho changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--domain--|" "revanextcloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--homepage--|" "revanextcloud1.docker" -changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--|" "revanextcloud1.docker/ocm/" -changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--path--|" "revanextcloud1.docker" +changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--|" "revanextcloud1.docker" +changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--path--|" "revanextcloud1.docker/ocm/" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--host--|" "revanextcloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--webdav--|" "nextcloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--webdav--path--|" "nextcloud1.docker/remote.php/webdav/" diff --git a/dev/ocm-test-suite/invite-link/ocis-owncloud.sh b/dev/ocm-test-suite/invite-link/ocis-owncloud.sh index 24df0603..221f2513 100755 --- a/dev/ocm-test-suite/invite-link/ocis-owncloud.sh +++ b/dev/ocm-test-suite/invite-link/ocis-owncloud.sh @@ -229,8 +229,8 @@ changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance1--webdav--ho changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--domain--|" "revaowncloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--homepage--|" "revaowncloud1.docker" -changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--|" "revaowncloud1.docker/ocm/" -changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--path--|" "revaowncloud1.docker" +changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--|" "revaowncloud1.docker" +changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--path--|" "revaowncloud1.docker/ocm/" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--host--|" "revaowncloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--webdav--|" "owncloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--webdav--path--|" "owncloud1.docker/remote.php/webdav/" diff --git a/dev/ocm-test-suite/invite-link/owncloud-ocis.sh b/dev/ocm-test-suite/invite-link/owncloud-ocis.sh index 2fc103e7..409ce358 100755 --- a/dev/ocm-test-suite/invite-link/owncloud-ocis.sh +++ b/dev/ocm-test-suite/invite-link/owncloud-ocis.sh @@ -230,8 +230,8 @@ changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance1--webdav--ho changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--domain--|" "revaowncloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--homepage--|" "revaowncloud1.docker" -changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--|" "revaowncloud1.docker/ocm/" -changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--path--|" "revaowncloud1.docker" +changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--|" "revaowncloud1.docker" +changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--path--|" "revaowncloud1.docker/ocm/" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--ocm--host--|" "revaowncloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--webdav--|" "owncloud1.docker" changeInFile "${ENV_ROOT}/temp/ocis/ocmproviders.json" "|--instance2--webdav--path--|" "owncloud1.docker/remote.php/webdav/" diff --git a/docker/configs/revad/sciencemesh.toml b/docker/configs/revad/sciencemesh.toml index d0f8aec4..25210435 100644 --- a/docker/configs/revad/sciencemesh.toml +++ b/docker/configs/revad/sciencemesh.toml @@ -183,7 +183,7 @@ refresh = 900 [grpc.services.ocmproviderauthorizer.drivers.json] # this is used by the docker-based test deployment, not in production providers = "/etc/revad/providers.testnet.json" -verify_request_hostname = true +verify_request_hostname = false [grpc.services.userprovider] driver = "nextcloud"