Skip to content

Commit

Permalink
test(cy): start using aliases in session test
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Apr 25, 2024
1 parent 4cc24c2 commit 3ca333e
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions cypress/e2e/api/SessionApi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,28 @@ describe('The session Api', function() {
})

describe('open the session', function() {
let fileId
let filePath

beforeEach(function() {
cy.uploadTestFile('test.md')
.then(id => {
fileId = id
})
cy.testName().then(name => {
filePath = `/${name}.md`
})
cy.uploadTestFile('test.md').as('fileId')
cy.testName().then(name => `/${name}.md`).as('filePath')
})

it('returns connection', function() {
cy.createTextSession(fileId).then(connection => {
cy.createTextSession(this.fileId).then(connection => {
cy.wrap(connection)
.its('document.id')
.should('equal', fileId)
.should('equal', this.fileId)
connection.close()
})
})

it('provides initial content', function() {
cy.createTextSession(fileId, { filePath }).then(connection => {
cy.wrap(connection)
.its('state.documentSource')
.should('eql', '## Hello world\n')
connection.close()
})
cy.createTextSession(this.fileId, { filePath: this.filePath })
.then(connection => {
cy.wrap(connection)
.its('state.documentSource')
.should('eql', '## Hello world\n')
connection.close()
})
})

it('handles invalid file id', function() {
Expand Down

0 comments on commit 3ca333e

Please sign in to comment.