-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from pondersource/ocm-cypress-nc-v28
[OCM][Test Suite][Cypress] add Nextcloud v28 tests
- Loading branch information
Showing
10 changed files
with
267 additions
and
6 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
cypress/ocm-test-suite/cypress/e2e/re-route/nextcloud-v28-to-nextcloud-v28.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
}) | ||
}) | ||
}) |
35 changes: 35 additions & 0 deletions
35
cypress/ocm-test-suite/cypress/e2e/re-route/owncloud-to-nextcloud-v28.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
}) | ||
}) | ||
}) |
35 changes: 35 additions & 0 deletions
35
cypress/ocm-test-suite/cypress/e2e/share-with/5-nextcloud-v27-to-nextcloud-v28.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
}) | ||
}) | ||
}) |
35 changes: 35 additions & 0 deletions
35
cypress/ocm-test-suite/cypress/e2e/share-with/6-nextcloud-v28-to-nextcloud-v27.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
}) | ||
}) | ||
}) |
35 changes: 35 additions & 0 deletions
35
cypress/ocm-test-suite/cypress/e2e/share-with/7-nextcloud-v28-to-owncloud.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)}"]`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters