From 364e7148e0e6515d97eeba4460e2e809dd746760 Mon Sep 17 00:00:00 2001 From: Arie Peterson <arie@greenhost.nl> Date: Fri, 23 Aug 2024 15:56:01 +0200 Subject: [PATCH] Click to open new office document only if necessary --- README.md | 5 +---- cypress/e2e/test-nextcloud.cy.js | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index baf8a9dd..e06bbe68 100644 --- a/README.md +++ b/README.md @@ -260,9 +260,6 @@ To publish a new version of the helm chart: 3. Update `CHANGELOG.md` and check that it includes relevant changes, including ones added by renovatebot. 4. Commit and push these changes to `main`. -5. Create a new git tag for the new release and push it to gitlab as well. Note - that both the pipeline for the `main` branch and for the tag will use the - `nc` namespace, so you may not want to push the branch and tag right after - each other. +5. Create a new git tag for the new release and push it to gitlab as well. The last step will trigger a CI run that will package and publish the helm chart. diff --git a/cypress/e2e/test-nextcloud.cy.js b/cypress/e2e/test-nextcloud.cy.js index 1f229825..e56acb54 100644 --- a/cypress/e2e/test-nextcloud.cy.js +++ b/cypress/e2e/test-nextcloud.cy.js @@ -59,12 +59,19 @@ describe('Test nextcloud', () => { const file_rand = 'test-' + Math.random().toString(16).substr(2, 12) cy.contains('button', 'New document').click() cy.get('input[placeholder="Filename"]').type('{selectAll}{del}' + file_rand + '.docx{enter}') - // With older Nextcloud, creating the new document this way would also open - // it automatically. It seems with newer nextcloud/onlyoffice that is no - // longer the case. - // Ah with 29 it seems to work again. Keeping this in commented form in - // case it breaks again. - // cy.contains('a:not(.recommendation)', file_rand).should('exist').click() + // Nextcloud and/or the onlyoffice app has unpredictable behaviour at this + // point: sometimes when creating the new office document, it will be + // opened automatically and sometimes it won't. This is rather painful to + // check in an automated test, not least because we don't know how long + // we should wait for the automatic opening to happen. + cy.wait(10000) + cy.get('body').then((bodyElement) => { + if (bodyElement.find('#onlyofficeFrame').length == 0) { + // After waiting 10 seconds, we don't see the frame yet. We assume it's + // not going to be opened automatically so we click the new file now. + cy.contains('a:not(.recommendation)', file_rand).should('exist').click() + } + }) // Test Onlyoffice cy.frameLoaded('#onlyofficeFrame') -- GitLab