diff --git a/cypress.config.ts b/cypress.config.ts index 53b4e3f52..59307470c 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -11,8 +11,10 @@ export default defineConfig({ viewportWidth: 1280, viewportHeight: 720, + requestTimeout: 20000, + retries: { - runMode: 5, + runMode: 0, // do not retry in `cypress open` openMode: 0, }, @@ -36,8 +38,6 @@ export default defineConfig({ trashAssetsBeforeRuns: true, e2e: { - testIsolation: false, - // We've imported your old cypress plugins here. // You may want to clean this up later by importing these. async setupNodeEvents(on, config) { @@ -84,7 +84,7 @@ export default defineConfig({ // Before the browser launches // starting Nextcloud testing container - const ip = await startNextcloud(process.env.BRANCH || 'master') + const ip = await startNextcloud(process.env.BRANCH || 'master', undefined, { exposePort: 8080 }) // Setting container's IP as base Url config.baseUrl = `http://${ip}/index.php` await waitOnNextcloud(ip) diff --git a/cypress/e2e/settings.cy.ts b/cypress/e2e/settings.cy.ts index 9e51aadb5..a8010634d 100644 --- a/cypress/e2e/settings.cy.ts +++ b/cypress/e2e/settings.cy.ts @@ -3,13 +3,19 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +import type { User } from "@nextcloud/cypress" + describe('Check that user\'s settings survive a reload', () => { + let user: User + before(() => { cy.createRandomUser() - .then((user) => { - cy.login(user) - cy.visit('/settings/user/notifications') - }) + .then(_user => user = _user) + }) + + beforeEach(() => { + cy.login(user) + cy.visit('/settings/user/notifications') }) it('Form survive a reload', () => { diff --git a/cypress/e2e/sidebar.cy.ts b/cypress/e2e/sidebar.cy.ts index 2e10965aa..92d7ff5fe 100644 --- a/cypress/e2e/sidebar.cy.ts +++ b/cypress/e2e/sidebar.cy.ts @@ -4,7 +4,7 @@ */ import { createFolder, getFileListRow, navigateToFolder, moveFile, renameFile } from './filesUtils' -import { addComment, addTag, createPublicShare, toggleFavorite, showActivityTab } from './sidebarUtils' +import { addComment, addTag, createPublicShare, toggleFavorite, showActivityTab, randHash } from './sidebarUtils' describe('Check activity listing in the sidebar', { testIsolation: true }, () => { beforeEach(function() { @@ -39,6 +39,7 @@ describe('Check activity listing in the sidebar', { testIsolation: true }, () => it('Has share activity', () => { createPublicShare('welcome.txt') cy.visit('/apps/files') + getFileListRow('welcome.txt').should('be.visible') showActivityTab('welcome.txt') cy.get('.activity-entry').first().should('contains.text', 'Shared as public link') @@ -62,7 +63,7 @@ describe('Check activity listing in the sidebar', { testIsolation: true }, () => }) it('Has tag activity', () => { - addTag('welcome.txt', 'my_tag') + addTag('welcome.txt', `my_tag_${randHash()}`) cy.visit('/apps/files') showActivityTab('welcome.txt') diff --git a/cypress/e2e/sidebarUtils.ts b/cypress/e2e/sidebarUtils.ts index ef3a8ffed..3caaefdf5 100644 --- a/cypress/e2e/sidebarUtils.ts +++ b/cypress/e2e/sidebarUtils.ts @@ -109,3 +109,7 @@ export function addComment(fileName: string, comment: string) { cy.wait('@comment') } + +export function randHash() { + return Math.random().toString(36).replace(/[^a-z]+/g, '').slice(0, 10) +}