Skip to content

Commit

Permalink
test(cy): rely on @nextcloud/axios for requests
Browse files Browse the repository at this point in the history
This greatly simplifies the handling of csrf-tokens and auth.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Apr 25, 2024
1 parent a8c437f commit 2902033
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 267 deletions.
4 changes: 0 additions & 4 deletions cypress/e2e/api/SessionApi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ describe('The session Api', function() {

beforeEach(function() {
cy.login(user)
cy.prepareSessionApi()
})

describe('open the session', function() {
Expand Down Expand Up @@ -223,7 +222,6 @@ describe('The session Api', function() {
})
.then(() => cy.clearCookies())
.then(() => {
cy.prepareSessionApi()
return cy.createTextSession(undefined, { filePath: '', shareToken })
.then(con => {
connection = con
Expand All @@ -247,7 +245,6 @@ describe('The session Api', function() {
.should('be.at.least', 1)
cy.save(connection, { version: 1, autosaveContent: '# Heading 1', manualSave: true })
cy.login(user)
cy.prepareSessionApi()
cy.downloadFile('saves.md')
.its('data')
.should('eql', '# Heading 1')
Expand Down Expand Up @@ -290,7 +287,6 @@ describe('The session Api', function() {
cy.log(token)
shareToken = token
cy.clearCookies()
cy.prepareSessionApi()
cy.createTextSession(undefined, { filePath: '', shareToken })
.then(con => {
connection = con
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/api/SyncServiceProvider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('Sync service provider', function() {

beforeEach(function() {
cy.login(user)
cy.prepareSessionApi()
cy.uploadTestFile('test.md')
.then(id => {
fileId = id
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/api/UsersApi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('The user mention API', function() {
cy.login(user)
cy.uploadTestFile('test.md').as('fileId')
.then(cy.createTextSession).as('connection')
cy.getRequestToken()
})

afterEach(function() {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/propfind.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Text PROPFIND extension ', function() {
cy.uploadFile('test.md', 'text/markdown', '/Readme.md')
cy.propfindFolder('/')
.should('have.property', richWorkspace, '## Hello world\n')
cy.removeFile('/Readme.md')
cy.deleteFile('/Readme.md')
cy.propfindFolder('/')
.should('have.property', richWorkspace, '')
})
Expand Down
Loading

0 comments on commit 2902033

Please sign in to comment.