Skip to content

Commit

Permalink
Merge pull request #116 from pondersource/ocm-cypress-seafile
Browse files Browse the repository at this point in the history
[OCM][Test Suite][Cypress] add Seafile tests
  • Loading branch information
MahdiBaghbani authored Apr 3, 2024
2 parents 16a3a04 + 0ebed4d commit 3eb2f6d
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 11 deletions.
6 changes: 6 additions & 0 deletions cypress/ocm-test-suite/cypress/e2e/login/seafile.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
describe('Login Seafile', () => {
it('Login test for Seafile', () => {
cy.loginSeafile('http://seafile1.docker', 'jonathan@seafile.com', 'xu')
})
})

Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
describe('Native federated sharing functionality for Seafile', () => {
it('Send federated share from Seafile to Seafile', () => {
// share from Seafile 1.
cy.loginSeafile('http://seafile1.docker', 'jonathan@seafile.com', 'xu')

// cy.get('*[role^="dialog"]')
// .find('*[class^="modal-dialog"]')
// .find('*[class^="modal-content"]')
// .find('*[class^="modal-body"]')
// .find('button')
// .click()

cy.get('*[id^="wrapper"]')
.find('*[class^="main-panel"]')
.find('*[class^="reach-router"]')
.find('*[class^="main-panel-center"]')
.find('*[class^="cur-view-container"]')
.find('*[class^="cur-view-content"]')
.find('table>tbody')
.eq(0)
.find('tr>td')
.eq(3).trigger('mouseover')

cy.get('*[id^="wrapper"]')
.find('*[class^="main-panel"]')
.find('*[class^="reach-router"]')
.find('*[class^="main-panel-center"]')
.find('*[class^="cur-view-container"]')
.find('*[class^="cur-view-content"]')
.find('table>tbody')
.eq(0)
.find('tr>td')
.eq(3)
.find('*[title^="Share"]')
.click()

cy.get('*[class^="share-dialog-side"]')
.find('ul>li')
.eq(4)
.click()

cy.get('*[id^="share-to-other-server-panel"]')
.find('table>tbody')
.eq(0)
.find('tr>td')
.eq(0)
.find('svg')
.click()

cy.get('*[role^="dialog"]')
.contains(/^seafile\w+/)
.click()

cy.get('*[id^="share-to-other-server-panel"]')
.find('table>tbody')
.eq(0)
.find('tr>td')
.eq(1)
.within(() => {
cy.get('input[class="form-control"]').type('giuseppe@cern.ch')
})

cy.get('*[id^="share-to-other-server-panel"]')
.find('table>tbody')
.eq(0)
.find('tr>td')
.eq(3)
.contains('Submit')
.click()

})

it('Receive federated share from Seafile to Seafile', () => {
cy.loginSeafile('http://seafile2.docker', 'giuseppe@cern.ch', 'lopresti')

// cy.get('*[role^="dialog"]')
// .find('*[class^="modal-dialog"]')
// .find('*[class^="modal-content"]')
// .find('*[class^="modal-body"]')
// .find('button')
// .click()

cy.get('*[id^="wrapper"]')
.find('*[class^="side-panel"]')
.find('*[class^="side-panel-center"]')
.find('*[class^="side-nav"]')
.find('*[class^="side-nav-con"]')
.find('ul>li')
.eq(5)
.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.
})
})
14 changes: 14 additions & 0 deletions cypress/ocm-test-suite/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,17 @@ Cypress.Commands.add('loginNextcloud', (url, username, password) => {
// files app should be visible.
cy.url().should('match', /apps\/files(\/|$)/)
})

Cypress.Commands.add('loginSeafile', (url, username, password) => {
cy.visit(url)

// login page is visible in browser.
cy.get('*[id^="wrapper"]').find('*[id^="log-in-panel"]').find('*[id^="login-form"]').should('be.visible')

// login with username and password.
cy.get('*[id^="wrapper"]').find('*[id^="log-in-panel"]').find('*[id^="login-form"]').within(() => {
cy.get('input[name="login"]').type(username)
cy.get('input[name="password"]').type(password)
cy.get('*[type=submit]').click()
})
})
27 changes: 16 additions & 11 deletions dev/ocm-test-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function waitForCollabora() {
function createSeafile() {
local platform="${1}"
local number="${2}"
local user="${3}"
local user_email="${3}"
local password="${4}"
local remote_ocm_server="${5}"

Expand All @@ -85,7 +85,7 @@ function createSeafile() {
-e TIME_ZONE="Etc/UTC" \
-e DB_HOST="maria${platform}${number}.docker" \
-e DB_ROOT_PASSWD="eilohtho9oTahsuongeeTh7reedahPo1Ohwi3aek" \
-e SEAFILE_ADMIN_EMAIL="${user}@seafile.com" \
-e SEAFILE_ADMIN_EMAIL="${user_email}" \
-e SEAFILE_ADMIN_PASSWORD="${password}" \
-e SEAFILE_SERVER_LETSENCRYPT=false \
-e FORCE_HTTPS_IN_CONF=false \
Expand Down Expand Up @@ -114,6 +114,11 @@ function createSeafile() {
# run init script inside seafile.
docker exec -e remote_ocm_server="${remote_ocm_server}" "${platform}${number}.docker" bash -c "/init.sh ${remote_ocm_server}"

# restart seafile to apply our changes.
sleep 2
docker restart "${platform}${number}.docker"
sleep 2

redirect_to_null_cmd echo ""
}

Expand Down Expand Up @@ -263,19 +268,19 @@ fi
# image: which image variation to use for container.

# ownClouds
createEfss owncloud 1 marie radioactivity latest ocm-test-suite
createEfss owncloud 2 mahdi baghbani latest ocm-test-suite
createEfss owncloud 1 marie radioactivity latest ocm-test-suite
createEfss owncloud 2 mahdi baghbani latest ocm-test-suite

# Nextclouds
createEfss nextcloud 1 einstein relativity latest sciencemesh
createEfss nextcloud 2 michiel dejong latest sciencemesh
createEfss nextcloud 1 einstein relativity latest sciencemesh
createEfss nextcloud 2 michiel dejong latest sciencemesh

createEfss nextcloud 3 yashar pmh v28.0.3
createEfss nextcloud 4 madeline oleary v28.0.3
createEfss nextcloud 3 yashar pmh v28.0.3
createEfss nextcloud 4 madeline oleary v28.0.3

# Seafiles
createSeafile seafile 1 jonathan xu seafile2
createSeafile seafile 2 giuseppe lopresti seafile1
createSeafile seafile 1 jonathan@seafile.com xu seafile2
createSeafile seafile 2 giuseppe@cern.ch lopresti seafile1

############
### Reva ###
Expand Down Expand Up @@ -392,7 +397,7 @@ if [ "${SCRIPT_MODE}" = "dev" ]; then
echo "https://nextcloud3.docker -> username: yahsar password: pmh"
echo "https://nextcloud4.docker -> username: madeline password: oleary"
echo "https://seafile1.docker -> username: jonathan@seafile.com password: pmh"
echo "https://seafile2.docker -> username: giuseppe@seafile.com password: lopresti"
echo "https://seafile2.docker -> username: giuseppe@cern.ch password: lopresti"
else
# only record when testing on electron.
if [ "${TEST_PLATFORM}" != "electron" ]; then
Expand Down

0 comments on commit 3eb2f6d

Please sign in to comment.