Skip to content

Commit

Permalink
Merge pull request #172 from pondersource/fix-ocm-test
Browse files Browse the repository at this point in the history
Better Documentation and GH Pages
  • Loading branch information
MahdiBaghbani authored Jan 30, 2025
2 parents 194ef32 + 7a2fee6 commit 2838851
Show file tree
Hide file tree
Showing 22 changed files with 1,108 additions and 577 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/zola.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy Zola site to Pages

on:
push:
branches: ["main"]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Zola
run: |
ZOLA_VERSION="0.18.0"
wget -q "https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
tar xzf "zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
sudo mv zola /usr/local/bin
- name: Build
run: zola build --root site

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: site/public

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
544 changes: 55 additions & 489 deletions README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import {
} from '../utils/nextcloud-v27';

import {
acceptShareV28,
ensureFileExistsV28,
handleShareAcceptanceV28,
} from '../utils/nextcloud-v28';

describe('Native Federated Sharing Functionality for Nextcloud', () => {
Expand Down Expand Up @@ -60,14 +59,8 @@ describe('Native Federated Sharing Functionality for Nextcloud', () => {
// Step 1: Log in to the recipient's Nextcloud instance
cy.loginNextcloud(recipientUrl, recipientUsername, recipientPassword);

// Step 2: Wait for the share dialog to appear and accept the incoming federated share
acceptShareV28();

// Step 3: Reload the page to ensure the shared file appears in the file list
cy.reload(true);

// Step 4: Verify the shared file is visible
ensureFileExistsV28(sharedFileName);
// Step 2: Handle any share acceptance pop-ups and verify the file exists
handleShareAcceptanceV28(sharedFileName);

// TODO @MahdiBaghbani: Download or open the file to verify content (if required)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
*/

import {
acceptShareV28,
createShareV28,
renameFileV28,
ensureFileExistsV28,
handleShareAcceptanceV28,
} from '../utils/nextcloud-v28';

describe('Native Federated Sharing Functionality for Nextcloud v28', () => {
Expand Down Expand Up @@ -56,14 +56,8 @@ describe('Native Federated Sharing Functionality for Nextcloud v28', () => {
// Step 1: Log in to the recipient's Nextcloud instance
cy.loginNextcloud(recipientUrl, recipientUsername, recipientPassword);

// Step 2: Wait for the share dialog to appear and accept the incoming federated share
acceptShareV28();

// Step 3: Reload the page to ensure the shared file appears in the file list
cy.reload(true);

// Step 4: Verify the shared file is visible
ensureFileExistsV28(sharedFileName);
// Step 2: Handle any share acceptance pop-ups and verify the file exists
handleShareAcceptanceV28(sharedFileName);

// TODO @MahdiBaghbani: Download or open the file to verify content (if required)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
*/

import {
acceptShareV28,
ensureFileExistsV28,
handleShareAcceptanceV28,
} from '../utils/nextcloud-v28';

describe('Federated sharing functionality from OcmStub to Nextcloud', () => {
Expand Down Expand Up @@ -44,14 +43,8 @@ describe('Federated sharing functionality from OcmStub to Nextcloud', () => {
// Step 1: Log in to the recipient's Nextcloud instance
cy.loginNextcloud(recipientUrl, recipientUsername, recipientPassword);

// Step 2: Wait for the share dialog to appear and accept the incoming federated share
acceptShareV28();

// Step 3: Reload the page to ensure the shared file appears in the file list
cy.reload(true);

// Step 4: Verify the shared file is visible
ensureFileExistsV28(sharedFileName);
// Step 2: Handle any share acceptance pop-ups and verify the file exists
handleShareAcceptanceV28(sharedFileName);

// TODO @MahdiBaghbani: Download or open the file to verify content (if required)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

import {
acceptShareV28,
ensureFileExistsV28,
handleShareAcceptanceV28,
} from '../utils/nextcloud-v28';

import {
Expand Down Expand Up @@ -60,14 +59,8 @@ describe('OCM federated sharing functionality for ownCloud', () => {
// Step 1: Log in to the recipient's Nextcloud instance
cy.loginNextcloud(recipientUrl, recipientUsername, recipientPassword);

// Step 2: Wait for the share dialog to appear and accept the incoming federated share
acceptShareV28();

// Step 3: Reload the page to ensure the shared file appears in the file list
cy.reload(true);

// Step 4: Verify the shared file is visible
ensureFileExistsV28(sharedFileName);
// Step 2: Handle any share acceptance pop-ups and verify the file exists
handleShareAcceptanceV28(sharedFileName);

// TODO @MahdiBaghbani: Download or open the file to verify content (if required)
});
Expand Down
1 change: 0 additions & 1 deletion cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v27.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export function acceptShareV27() {
// Wait for the share dialog to appear and ensure it's visible
cy.get('div.oc-dialog', { timeout: 10000 })
.should('be.visible')
.first()
.within(() => {
// Locate the button row and click the primary button
cy.get('div.oc-dialog-buttonrow')
Expand Down
39 changes: 38 additions & 1 deletion cypress/ocm-test-suite/cypress/e2e/utils/nextcloud-v28.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export function acceptShareV28() {
// Wait for the share dialog to appear and ensure it's visible
cy.get('div.oc-dialog', { timeout: 10000 })
.should('be.visible')
.first()
.within(() => {
// Locate the button row and click the primary button
cy.get('div.oc-dialog-buttonrow')
Expand All @@ -54,6 +53,44 @@ export function acceptShareV28() {
});
}

/**
* Handles multiple share acceptance pop-ups that may appear after reloads.
* This function recursively checks for and accepts share dialogs until none remain,
* then verifies the shared file exists.
*
* @param {string} fileName - The name of the shared file to verify exists.
* @param {number} [timeout=10000] - Optional timeout for the final file existence check.
*/
export function handleShareAcceptanceV28(fileName, timeout = 10000) {
// Wait for the page to be fully loaded
cy.wait(500);

// Try to find the share dialog with a reasonable timeout
cy.get('body', { timeout: 10000 }).then($body => {
// Check if dialog exists and is visible
const hasDialog = $body.find('div.oc-dialog:visible').length > 0;

if (hasDialog) {
// If dialog exists, accept it
acceptShareV28();
// Wait a bit for the acceptance to be processed
cy.wait(500);
// Reload and continue checking
cy.reload(true).then(() => {
// Wait for page load after reload
cy.wait(500);
// Recursively check for more pop-ups
handleShareAcceptanceV28(fileName, timeout);
});
} else {
// No more pop-ups, wait for the file list to be loaded
cy.wait(1000);
// Verify the shared file exists with specified timeout
ensureFileExistsV28(fileName, timeout);
}
});
}

/**
* Creates a share for a specific file and user.
* @param {string} fileName - The name of the file to be shared.
Expand Down
21 changes: 13 additions & 8 deletions cypress/ocm-test-suite/cypress/e2e/utils/owncloud-v10.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export function acceptShare() {
// Wait for the share dialog to appear and ensure it's visible
cy.get('div.oc-dialog', { timeout: 10000 })
.should('be.visible')
.first()
.within(() => {
// Locate the button row and click the primary button
cy.get('div.oc-dialog-buttonrow')
Expand Down Expand Up @@ -327,13 +326,14 @@ export function openSharingPanel(fileName) {
// Trigger the "Share" action for the specified file
triggerActionForFile(fileName, 'Share');

// Ensure the sharing tab is visible and click it
// Wait for the sharing panel to be fully loaded
cy.get('#app-sidebar')
.should('be.visible')
.within(() => {
cy.get('[data-tabid="shareTabView"]')
.should('be.visible')
.click();
.click()
.should('have.class', 'selected');
});
}

Expand Down Expand Up @@ -401,14 +401,13 @@ export function triggerActionInFileMenu(fileName, actionId) {
export function triggerActionForFile(fileName, actionId) {
// Find the actions container for the file and click the desired action
getActionsForFile(fileName)
.should('exist')
.and('be.visible')
.within(() => {
// Find the action button and ensure it's properly loaded
cy.get(`*[data-action="${actionId}"]`)
.should('exist')
.and('be.visible')
.and('not.be.disabled')
// Use { force: true } to handle cases where the element might be covered
.click({ force: true });
});
}
Expand All @@ -419,9 +418,13 @@ export function triggerActionForFile(fileName, actionId) {
* @returns {Cypress.Chainable<JQuery<HTMLElement>>} - The actions container element.
*/
export function getActionsForFile(fileName) {
// Wait for the file row to be stable before proceeding
return getRowForFile(fileName)
.find('.fileactions')
.should('be.visible');
.within(() => {
return cy.get('.fileactions')
.should('exist')
.and('be.visible');
});
}

/**
Expand All @@ -430,5 +433,7 @@ export function getActionsForFile(fileName) {
* @returns {Cypress.Chainable<JQuery<HTMLElement>>} - The row element for the file.
*/
export function getRowForFile(fileName) {
return cy.get(`[data-file="${fileName}"]`).should('exist');
return cy.get(`[data-file="${escapeCssSelector(fileName)}"]`)
.should('exist')
.and('be.visible');
}
3 changes: 3 additions & 0 deletions dev/ocm-test-suite/login/ocis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ main() {
initialize_environment "../../.."
setup "$@"

# Configure OCM providers for oCIS
prepare_ocis_environment "ocis1.docker,ocis1.docker,dav/" "ocis2.docker,ocis2.docker,dav/"

# Create EFSS containers
# # id # image # tag
create_ocis 1 owncloud/ocis "${EFSS_PLATFORM_1_VERSION}"
Expand Down
39 changes: 0 additions & 39 deletions docs/act.md

This file was deleted.

Loading

0 comments on commit 2838851

Please sign in to comment.