mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 07:04:45 -04:00
Replace "cypress-file-upload" with cypress selectFile
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
a32984e052
commit
57f01e8903
6 changed files with 79 additions and 56 deletions
|
@ -133,39 +133,58 @@ describe('History', () => {
|
|||
})
|
||||
cy.visitHistory()
|
||||
cy.logout()
|
||||
|
||||
cy.fixture('history.json').as('history')
|
||||
cy.fixture('history-2.json').as('history-2')
|
||||
cy.fixture('invalid-history.txt').as('invalid-history')
|
||||
})
|
||||
|
||||
it('works with valid file', () => {
|
||||
cy.getByCypressId('import-history-file-button').should('be.visible')
|
||||
cy.getByCypressId('import-history-file-input').attachFixture({
|
||||
filePath: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
})
|
||||
cy.getByCypressId('import-history-file-input').selectFile(
|
||||
{
|
||||
contents: '@history',
|
||||
fileName: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
},
|
||||
{ force: true }
|
||||
)
|
||||
cy.getByCypressId('history-entry-title').should('have.length', 1).contains('cy-Test')
|
||||
})
|
||||
|
||||
it('fails on invalid file', () => {
|
||||
cy.getByCypressId('import-history-file-button').should('be.visible')
|
||||
cy.getByCypressId('import-history-file-input').attachFixture({
|
||||
filePath: 'invalid-history.txt',
|
||||
mimeType: 'text/plain'
|
||||
})
|
||||
cy.getByCypressId('import-history-file-input').selectFile(
|
||||
{
|
||||
contents: '@invalid-history',
|
||||
fileName: 'invalid-history.txt',
|
||||
mimeType: 'text/plain'
|
||||
},
|
||||
{ force: true }
|
||||
)
|
||||
cy.getByCypressId('notification-toast').should('be.visible')
|
||||
})
|
||||
|
||||
it('works when selecting two files with the same name', () => {
|
||||
cy.getByCypressId('import-history-file-button').should('be.visible')
|
||||
cy.getByCypressId('import-history-file-input').attachFixture({
|
||||
filePath: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
})
|
||||
cy.getByCypressId('import-history-file-input').selectFile(
|
||||
{
|
||||
contents: '@history',
|
||||
fileName: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
},
|
||||
{ force: true }
|
||||
)
|
||||
cy.getByCypressId('history-entry-title').should('have.length', 1).contains('cy-Test')
|
||||
cy.getByCypressId('import-history-file-button').should('be.visible')
|
||||
cy.getByCypressId('import-history-file-input').attachFixture({
|
||||
filePath: 'history-2.json',
|
||||
fileName: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
})
|
||||
cy.getByCypressId('import-history-file-input').selectFile(
|
||||
{
|
||||
contents: '@history-2',
|
||||
fileName: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
},
|
||||
{ force: true }
|
||||
)
|
||||
cy.getByCypressId('history-entry-title').should('have.length', 2).contains('cy-Test2')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue