Skip to content
Merged
Prev Previous commit
Next Next commit
test(cypress): Enable test isolation
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed May 26, 2025
commit 6d3f77319748ecb6e757d0a3b20e59929ef11fb5
7 changes: 3 additions & 4 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ export default defineConfig({
viewportWidth: 1280,
viewportHeight: 720,

// Tries again 2 more times on failure
requestTimeout: 20000,

retries: {
runMode: 2,
runMode: 0,
// do not retry in `cypress open`
openMode: 0,
},
Expand All @@ -37,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) {
Expand Down
14 changes: 10 additions & 4 deletions cypress/e2e/settings.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/sidebar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { createFolder, moveFile, navigateToFolder, renameFile } from './filesUtils'
import { createFolder, navigateToFolder, moveFile, renameFile } from './filesUtils'
import { addComment, addTag, addToFavorites, createPublicShare, removeFromFavorites, showActivityTab } from './sidebarUtils'

describe('Check activity listing in the sidebar', { testIsolation: true }, () => {
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/sidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,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)
}