зеркало из https://github.com/nextcloud/text.git
refs #2049 cypress test: insert image from link
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
Родитель
3f1813437a
Коммит
0e74b10dd0
|
@ -39,14 +39,14 @@ describe('Open test.md in viewer', function() {
|
|||
cy.login(randUser, 'password')
|
||||
})
|
||||
|
||||
it('See test.md in the list', function() {
|
||||
it('See test.md in the list and open it', function() {
|
||||
cy.get('#fileList tr[data-file="test.md"]', { timeout: 10000 })
|
||||
.should('contain', 'test.md')
|
||||
|
||||
})
|
||||
|
||||
it('Insert an image from files', function() {
|
||||
cy.openFile('test.md')
|
||||
|
||||
cy.log('Open submenu')
|
||||
const viewer = cy.get('#viewer')
|
||||
const submenu = viewer.get('.action-item.submenu')
|
||||
|
@ -72,8 +72,6 @@ describe('Open test.md in viewer', function() {
|
|||
|
||||
cy.log('Check the image is visible and well formed')
|
||||
const editor = cy.get('#editor .ProseMirror')
|
||||
editor.should('contain', 'Hello world')
|
||||
editor.get('h2').should('contain', 'Hello world')
|
||||
editor.get('div.image')
|
||||
.should('be.visible')
|
||||
.invoke('attr', 'data-src')
|
||||
|
@ -88,6 +86,49 @@ describe('Open test.md in viewer', function() {
|
|||
cy.screenshot()
|
||||
})
|
||||
|
||||
it('Insert an image from a link', function() {
|
||||
cy.openFile('test.md')
|
||||
cy.log('Open submenu')
|
||||
const viewer = cy.get('#viewer')
|
||||
const submenu = viewer.get('.action-item.submenu')
|
||||
submenu.click()
|
||||
submenu.should('have.class', 'action-item--open')
|
||||
|
||||
const trigger = submenu.get('.action-item.submenu > div.v-popover > .trigger')
|
||||
trigger
|
||||
.should('have.class', 'trigger')
|
||||
.invoke('attr','aria-describedby')
|
||||
.should('contain', 'popover_')
|
||||
.as('popoverId')
|
||||
|
||||
cy.get('@popoverId').then(popoverId => {
|
||||
cy.log('Click on action entry')
|
||||
const popover = cy.get('div#' + popoverId)
|
||||
popover.should('have.class', 'open')
|
||||
cy.get('div#' + popoverId + ' li:nth-child(3)').click()
|
||||
cy.log('Type and validate')
|
||||
cy.get('div#' + popoverId + ' li:nth-child(3) input[type=text]')
|
||||
.type('https://nextcloud.com/wp-content/themes/next/assets/img/headers/engineering-small.jpg')
|
||||
.type('{enter}')
|
||||
//cy.get('div#' + popoverId + ' li:nth-child(3) form > label').click()
|
||||
|
||||
cy.wait(4000)
|
||||
cy.log('Check the image is visible and well formed')
|
||||
const editor = cy.get('#editor .ProseMirror')
|
||||
editor.get('div.image:nth-child(1)')
|
||||
.should('be.visible')
|
||||
.invoke('attr', 'data-src')
|
||||
.should('contain', '.jpg')
|
||||
editor.get('div.image:nth-child(1) img').invoke('attr', 'src')
|
||||
.should('contain', 'apps/text/image?documentId=')
|
||||
.should('contain', 'imageFileName')
|
||||
.should('contain', '.jpg')
|
||||
})
|
||||
|
||||
|
||||
cy.screenshot()
|
||||
})
|
||||
|
||||
it('Closes the editor', function() {
|
||||
cy.openFile('test.md')
|
||||
cy.get('#viewer .modal-header button.header-close').click()
|
||||
|
|
|
@ -384,6 +384,9 @@ export default {
|
|||
this.imageLink = newImageLink
|
||||
},
|
||||
onImageLinkSubmit(command) {
|
||||
if (!this.imageLink) {
|
||||
return
|
||||
}
|
||||
this.uploadingImage = true
|
||||
this.showImageLinkPrompt = false
|
||||
this.$refs.imageActions[0].closeMenu()
|
||||
|
|
Загрузка…
Ссылка в новой задаче