Skip to content

Commit

Permalink
Merge pull request #131 from pondersource/mahdi/milestone-3/small-fixes
Browse files Browse the repository at this point in the history
[OCM][Test Suite] Small fixes
  • Loading branch information
MahdiBaghbani authored Jul 30, 2024
2 parents 3c57f75 + 7b76823 commit 80a7375
Show file tree
Hide file tree
Showing 29 changed files with 100 additions and 111 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/ocm-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
login:
strategy:
fail-fast: false
max-parallel: 4
max-parallel: 5
matrix:
efss: [
{
Expand All @@ -36,20 +36,6 @@ jobs:
platform: ocis,
version: 5.0.6
},
# TODO: @MahdiBaghbani fix it via naother pr in future. (is it necessary?)
# cypress login is not compatible with previous versions
# {
# platform: seafile,
# version: 8.0.8
# },
# {
# platform: seafile,
# version: 9.0.10
# },
# {
# platform: seafile,
# version: 10.0.1
# },
{
platform: seafile,
version: 11.0.5
Expand Down Expand Up @@ -128,6 +114,31 @@ jobs:
}
]
exclude:
# seafile doesn't support receiving ocm shares to other platforms yet! exclude tests.
- sender: {
platform: nextcloud,
version: v27.1.10
}
receiver: {
platform: seafile,
version: 11.0.5
}
- sender: {
platform: nextcloud,
version: v28.0.7
}
receiver: {
platform: seafile,
version: 11.0.5
}
- sender: {
platform: owncloud,
version: v10.14.0
}
receiver: {
platform: seafile,
version: 11.0.5
}
# seafile doesn't support sending ocm shares to other platforms yet! exclude tests.
- sender: {
platform: seafile,
Expand Down Expand Up @@ -189,7 +200,7 @@ jobs:
needs: [login]
strategy:
fail-fast: false
max-parallel: 3
max-parallel: 9
matrix:
sender: [
{
Expand Down
1 change: 1 addition & 0 deletions cypress/ocm-test-suite/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = defineConfig({
e2e: {
experimentalOriginDependencies: true,
},
chromeWebSecurity: false,
video: true,
videoCompression: true,
modifyObstructiveCode: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { createInviteLinkV27, createScienceMeshShareV27, renameFileV27 } from '../utils/nextcloud-v27'
import {
createInviteLinkV27,
verifyFederatedContactV27,
createScienceMeshShareV27,
renameFileV27
} from '../utils/nextcloud-v27'

describe('Invite link federated sharing via ScienceMesh functionality for Nextcloud', () => {
it('Send invitation from Nextcloud v27 to Nextcloud v27', () => {
Expand All @@ -24,22 +29,18 @@ describe('Invite link federated sharing via ScienceMesh functionality for Nextcl

cy.get('input[id="accept-button"]', { timeout: 10000 })
.click()

// validate 'einstein' is shown as a contact.
cy.visit('https://nextcloud2.docker/index.php/apps/sciencemesh/contacts')

cy.get('table[id="contact-table"]')
.find('p[class="displayname"]')
.should("have.text", "einstein");
// validate 'eisntein' is shown as a contact.
verifyFederatedContactV27('nextcloud2.docker', 'einstein', 'revanextcloud1.docker')
})
})

it('Send ScienceMesh share <file> from Nextcloud v27 to Nextcloud v27', () => {
// share from Nextcloud 1.
cy.loginNextcloud('https://nextcloud1.docker', 'einstein', 'relativity')

renameFileV27('welcome.txt', 'nc1-to-nc2-sciencemesh-share.txt')
createScienceMeshShareV27('nc1-to-nc2-sciencemesh-share.txt', 'michiel')
renameFileV27('welcome.txt', 'invite-link-nc-nc.txt')
createScienceMeshShareV27('nextcloud1.docker', 'michiel', 'revanextcloud2.docker', 'invite-link-nc-nc.txt')
})

it('Receive ScienceMesh share <file> from Nextcloud v27 to Nextcloud v27', () => {
Expand All @@ -52,6 +53,6 @@ describe('Invite link federated sharing via ScienceMesh functionality for Nextcl
.find('button[class="primary"]')
.click()

cy.get('[data-file="nc1-to-nc2-sciencemesh-share.txt"]', { timeout: 10000 }).should('be.visible')
cy.get('[data-file="invite-link-nc-nc.txt"]', { timeout: 10000 }).should('be.visible')
})
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
createInviteLinkV27,
verifyFederatedContactV27,
createScienceMeshShareAdvancedV27,
createScienceMeshShareV27,
renameFileV27
} from '../utils/nextcloud-v27'

Expand Down Expand Up @@ -48,7 +47,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')
createScienceMeshShareAdvancedV27('nextcloud1.docker', 'Albert Einstein', 'ocis1.docker', 'invite-link-nc-ocis.txt')
createScienceMeshShareV27('nextcloud1.docker', 'Albert Einstein', 'ocis1.docker', 'invite-link-nc-ocis.txt')
})

it('Receive ScienceMesh share <file> from Nextcloud v27 to oCIS v5', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { createInviteLinkV27, createScienceMeshShareV27, renameFileV27 } from '../utils/nextcloud-v27'
import {
createInviteLinkV27,
verifyFederatedContactV27,
createScienceMeshShareV27,
renameFileV27
} from '../utils/nextcloud-v27'

describe('Invite link federated sharing via ScienceMesh functionality for Nextcloud to ownCloud', () => {
it('Send invitation from Nextcloud v27 to ownCloud v10', () => {
Expand Down Expand Up @@ -38,8 +43,8 @@ describe('Invite link federated sharing via ScienceMesh functionality for Nextcl
// share from Nextcloud 1.
cy.loginNextcloud('https://nextcloud1.docker', 'einstein', 'relativity')

renameFileV27('welcome.txt', 'nc1-to-oc1-sciencemesh-share.txt')
createScienceMeshShareV27('nc1-to-oc1-sciencemesh-share.txt', 'marie')
renameFileV27('welcome.txt', 'invite-link-nc-oc.txt')
createScienceMeshShareV27('nextcloud1.docker', 'marie', 'revaowncloud1.docker', 'invite-link-nc-oc.txt')
})

it('Receive ScienceMesh share <file> from Nextcloud v27 to ownCloud v10', () => {
Expand All @@ -52,6 +57,6 @@ describe('Invite link federated sharing via ScienceMesh functionality for Nextcl
.find('button[class="primary"]')
.click()

cy.get('[data-file="nc1-to-oc1-sciencemesh-share.txt"]', { timeout: 10000 }).should('be.visible')
cy.get('[data-file="invite-link-nc-oc.txt"]', { timeout: 10000 }).should('be.visible')
})
})
40 changes: 18 additions & 22 deletions cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v27.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export function createShareV27(fileName, username, domain) {
})

// ensure selecting remote [sharetype="6"] instead of email!
cy.get(`[user="${username}"]`).click()
cy.get('div[class="button-group"]').contains('Save share').click()
cy.get(`[user="${username}"]`).should('be.visible').click()
cy.get('div[class="button-group"]').contains('Save share').should('be.visible').click()
}

export function createShareLinkV27(fileName) {
Expand All @@ -28,7 +28,9 @@ export function createShareLinkV27(fileName) {
cy.stub(win.navigator.clipboard, 'writeText').as('copy');

cy.get('#app-sidebar-vue').within(() => {
cy.get('*[class^="sharing-entry__actions"]').eq(0).click()
cy.get('button[title="Create a new share link"]')
.should('be.visible')
.click()
})

return cy.get('@copy').should('have.been.calledOnce').then((spy) => {
Expand Down Expand Up @@ -81,20 +83,6 @@ export function verifyFederatedContactV27(domain, displayName, contactDomain) {
)
}

export function createScienceMeshShareV27(fileName, username) {
openSharingPanelV27(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)
cy.wait('@userSearch')
})

cy.get(`[user="${username}"]`).click()
cy.get('div[class="button-group"]').contains('Save share').click()
}

export function getScienceMeshContactIdFromDisplayNameV27(domain, displayName, contactDomain) {
verifyFederatedContactV27(domain, displayName, contactDomain)

Expand All @@ -112,7 +100,7 @@ export function getScienceMeshContactIdFromDisplayNameV27(domain, displayName, c
)
}

export function createScienceMeshShareAdvancedV27(domain, displayName, contactDomain, filename) {
export function createScienceMeshShareV27(domain, displayName, contactDomain, filename) {
getScienceMeshContactIdFromDisplayNameV27(domain, displayName, contactDomain).then(
(shareWith) => {
cy.visit(`https://${domain}/index.php/apps/files`)
Expand All @@ -126,8 +114,15 @@ export function createScienceMeshShareAdvancedV27(domain, displayName, contactDo
cy.wait('@userSearch')
})

cy.get(`[sharewith="${shareWith}"]`).eq(0).click()
cy.get('div[class="button-group"]').contains('Save share').click()
cy.get(`[sharewith="${shareWith}"]`)
.eq(0)
.should('be.visible')
.click()

cy.get('div[class="button-group"]')
.contains('Save share')
.should('be.visible')
.click()
}
)
}
Expand All @@ -147,15 +142,16 @@ export function openSharingPanelV27(fileName) {

cy.get('#app-sidebar-vue')
.get('[aria-controls="tab-sharing"]')
.should('be.visible')
.click()
}

export function triggerActionInFileMenuV27(fileName, actionId) {
triggerActionForFileV27(fileName, 'menu')
getRowForFileV27(fileName).find('*[class^="filename"]').find('*[class^="fileActionsMenu"]').find(`[data-action="${CSS.escape(actionId)}"]`).should('exist').click()
getRowForFileV27(fileName).find('*[class^="filename"]').find('*[class^="fileActionsMenu"]').find(`[data-action="${CSS.escape(actionId)}"]`).should('be.visible').click()
}

export const triggerActionForFileV27 = (filename, actionId) => getActionsForFileV27(filename).find(`[data-action="${CSS.escape(actionId)}"]`).should('exist').click()
export const triggerActionForFileV27 = (filename, actionId) => getActionsForFileV27(filename).find(`[data-action="${CSS.escape(actionId)}"]`).should('be.visible').click()

export const getActionsForFileV27 = (filename) => getRowForFileV27(filename).find('*[class^="filename"]').find('*[class^="name"]').find('*[class^="fileactions"]')

Expand Down
32 changes: 20 additions & 12 deletions cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v28.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export function acceptShareV28() {
cy.get('div[class="oc-dialog"]', { timeout: 10000 })
.should('be.visible')
.find('*[class^="oc-dialog-buttonrow"]')
.find('button[class="primary"]')
.click()
.should('be.visible')
.find('*[class^="oc-dialog-buttonrow"]')
.find('button[class="primary"]')
.should('be.visible')
.click()
}

export function createShareV28(fileName, username, domain) {
Expand All @@ -17,10 +18,15 @@ export function createShareV28(fileName, username, domain) {
})

// ensure selecting remote [sharetype="6"] instead of email!
cy.get(`[user="${username}"]`).click()
cy.get(`[user="${username}"]`).should('be.visible').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()
cy.get('*[class^="sharingTabDetailsView"]')
.find('*[class^="sharingTabDetailsView__footer"]')
.find('*[class^="button-group"]')
.find('*[class^="button-vue button-vue--text-only button-vue--vue-primary"]')
.should('be.visible')
.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.
Expand All @@ -30,18 +36,19 @@ export function createShareLinkV28(fileName) {
openSharingPanelV28(fileName)

return cy.window().then(win => {
cy.stub(win.navigator.clipboard, 'writeText').as('copy');
cy.stub(win.navigator.clipboard, 'writeText').as('copy');

cy.get('#app-sidebar-vue').within(() => {
cy.get('#app-sidebar-vue').within(() => {
cy.get('*[id^="tab-sharing"]')
.find('*[title^="Create a new share link"]')
.should('be.visible')
.click()
})

return cy.get('@copy').should('have.been.calledOnce').then((spy) => {
return (spy).lastCall.args[0];
});
})
return cy.get('@copy').should('have.been.calledOnce').then((spy) => {
return (spy).lastCall.args[0];
});
})
}

export function updateShareV28(fileName, index) {
Expand Down Expand Up @@ -87,6 +94,7 @@ export function openSharingPanelV28(fileName) {

cy.get('#app-sidebar-vue')
.get('[aria-controls="tab-sharing"]')
.should('be.visible')
.click()
}

Expand Down
2 changes: 0 additions & 2 deletions dev/ocm-test-suite/invite-link/nextcloud-nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ if [ "${SCRIPT_MODE}" = "dev" ]; then
# this way you can view inside cypress container through vnc server.
docker run --detach --network=testnet \
--name="cypress.docker" \
--ipc=host \
-e DISPLAY=vnc-server:0.0 \
-v "${ENV_ROOT}/cypress/ocm-test-suite:/ocm" \
-v "${ENV_ROOT}/temp/.X11-unix:/tmp/.X11-unix" \
Expand Down Expand Up @@ -308,7 +307,6 @@ else
# run Cypress test suite headlessly and with the defined browser.
docker run --network=testnet \
--name="cypress.docker" \
--ipc=host \
-v "${ENV_ROOT}/cypress/ocm-test-suite:/ocm" \
-w /ocm \
cypress/included:13.13.1 cypress run \
Expand Down
2 changes: 0 additions & 2 deletions dev/ocm-test-suite/invite-link/nextcloud-ocis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ if [ "${SCRIPT_MODE}" = "dev" ]; then
# this way you can view inside cypress container through vnc server.
docker run --detach --network=testnet \
--name="cypress.docker" \
--ipc=host \
-e DISPLAY=vnc-server:0.0 \
-v "${ENV_ROOT}/cypress/ocm-test-suite:/ocm" \
-v "${ENV_ROOT}/temp/.X11-unix:/tmp/.X11-unix" \
Expand Down Expand Up @@ -376,7 +375,6 @@ else
# run Cypress test suite headlessly and with the defined browser.
docker run --network=testnet \
--name="cypress.docker" \
--ipc=host \
-v "${ENV_ROOT}/cypress/ocm-test-suite:/ocm" \
-w /ocm \
cypress/included:13.13.1 cypress run \
Expand Down
2 changes: 0 additions & 2 deletions dev/ocm-test-suite/invite-link/nextcloud-owncloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ if [ "${SCRIPT_MODE}" = "dev" ]; then
# this way you can view inside cypress container through vnc server.
docker run --detach --network=testnet \
--name="cypress.docker" \
--ipc=host \
-e DISPLAY=vnc-server:0.0 \
-v "${ENV_ROOT}/cypress/ocm-test-suite:/ocm" \
-v "${ENV_ROOT}/temp/.X11-unix:/tmp/.X11-unix" \
Expand Down Expand Up @@ -308,7 +307,6 @@ else
# run Cypress test suite headlessly and with the defined browser.
docker run --network=testnet \
--name="cypress.docker" \
--ipc=host \
-v "${ENV_ROOT}/cypress/ocm-test-suite:/ocm" \
-w /ocm \
cypress/included:13.13.1 cypress run \
Expand Down
2 changes: 0 additions & 2 deletions dev/ocm-test-suite/invite-link/ocis-nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ if [ "${SCRIPT_MODE}" = "dev" ]; then
# this way you can view inside cypress container through vnc server.
docker run --detach --network=testnet \
--name="cypress.docker" \
--ipc=host \
-e DISPLAY=vnc-server:0.0 \
-v "${ENV_ROOT}/cypress/ocm-test-suite:/ocm" \
-v "${ENV_ROOT}/temp/.X11-unix:/tmp/.X11-unix" \
Expand Down Expand Up @@ -376,7 +375,6 @@ else
# run Cypress test suite headlessly and with the defined browser.
docker run --network=testnet \
--name="cypress.docker" \
--ipc=host \
-v "${ENV_ROOT}/cypress/ocm-test-suite:/ocm" \
-w /ocm \
cypress/included:13.13.1 cypress run \
Expand Down
Loading

0 comments on commit 80a7375

Please sign in to comment.