Skip to content

Commit

Permalink
fix(cy): create user once and upload files once
Browse files Browse the repository at this point in the history
Signed-off-by: Max <max@nextcloud.com>
  • Loading branch information
max-nextcloud committed Dec 13, 2024
1 parent 3cfd707 commit 95cee60
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions cypress/e2e/openreadonly.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,31 @@ const user = randUser()

describe('Open read-only mode', function() {

before(function() {
cy.createUser(user)
cy.login(user)
cy.uploadFile('test.md', 'text/markdown')
cy.uploadFile('test.md', 'text/markdown', 'test.txt')
})

const setReadOnlyMode = function(mode) {
cy.login(admin)
cy.setAppConfig('open_read_only_enabled', mode)
cy.logout()
}

describe('Disabled', function() {
const checkMenubar = function() {
cy.get('.text-editor--readonly-bar').should('not.exist')
cy.get('.text-menubar').getActionEntry('done').should('not.exist')
cy.get('.text-menubar', { timeout: 10000 })
.getActionEntry('done').should('not.exist')
}

beforeEach(function() {
before(function() {
setReadOnlyMode(0)
})

cy.createUser(user)
beforeEach(function() {
cy.login(user)

cy.uploadFile('test.md', 'text/markdown')
cy.uploadFile('test.md', 'text/markdown', 'test.txt')

cy.visit('/apps/files')
})

Expand All @@ -57,18 +61,12 @@ describe('Open read-only mode', function() {
cy.get('.text-menubar').getActionEntry('done').should('exist')
}

beforeEach(function() {
before(function() {
setReadOnlyMode(1)
})

cy.createUser(user)
beforeEach(function() {
cy.login(user)

cy.removeFile('test.md')
cy.removeFile('test.txt')

cy.uploadFile('test.md', 'text/markdown')
cy.uploadFile('test.md', 'text/plain', 'test.txt')

cy.visit('/apps/files')
})

Expand Down

0 comments on commit 95cee60

Please sign in to comment.