Skip to content

Commit e40f6bb

Browse files
Vinicius Reisvinicius73
authored andcommitted
✅ improve test test
remove table test from workspace. prevent errors from hide menu Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
1 parent c751073 commit e40f6bb

2 files changed

Lines changed: 42 additions & 28 deletions

File tree

cypress/e2e/Table.spec.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import createEditor from './../../src/tests/createEditor.js'
55
import EditableTable from './../../src/nodes/EditableTable.js'
66
import Markdown, { createMarkdownSerializer } from './../../src/extensions/Markdown.js'
77

8+
import { initUserAndFiles, randHash } from '../utils/index.js'
9+
10+
const randUser = randHash()
11+
const fileName = 'empty.md'
12+
813
describe('ListItem extension integrated in the editor', () => {
914

1015
const editor = createEditor({
@@ -67,3 +72,40 @@ describe('ListItem extension integrated in the editor', () => {
6772
return serializer.serialize(editor.state.doc)
6873
}
6974
})
75+
76+
describe('table plugin', () => {
77+
before(() => {
78+
initUserAndFiles(randUser)
79+
})
80+
81+
beforeEach(() => {
82+
cy.login(randUser, 'password')
83+
84+
cy.isolateTest({
85+
sourceFile: fileName,
86+
})
87+
88+
return cy.openFile(fileName, { force: true })
89+
})
90+
91+
it('inserts and removes a table', () => {
92+
cy.getContent()
93+
.type('Let\'s insert a Table')
94+
95+
cy.getActionEntry('table').click()
96+
97+
cy.getContent()
98+
.type('content')
99+
100+
cy.getContent()
101+
.find('table tr:first-child th:first-child')
102+
.should('contain', 'content')
103+
104+
cy.getContent()
105+
.find('[data-text-table-actions="settings"]').click()
106+
107+
cy.get('[data-text-table-action="delete"]').click()
108+
cy.getContent()
109+
.should('not.contain', 'content')
110+
})
111+
})

cypress/e2e/workspace.spec.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -153,34 +153,6 @@ describe('Workspace', function() {
153153
.should('contain', 'Hello world')
154154
})
155155

156-
it('inserts and removes a table', function() {
157-
cy.openWorkspace()
158-
.type('Let\'s insert a Table')
159-
160-
cy.getMenu()
161-
.then($el => {
162-
// sometimes actions can be hide
163-
if ($el.find('[data-text-action-entry="remain"]').length) {
164-
toggleMoreActions()
165-
return submenuButton('table').click()
166-
}
167-
168-
return menuButton('table').click()
169-
})
170-
171-
cy.getContent()
172-
.type('content')
173-
cy.getContent()
174-
.find('table tr:first-child th:first-child')
175-
.should('contain', 'content')
176-
cy.getContent()
177-
.find('[data-text-table-actions="settings"]').click()
178-
179-
cy.get('[data-text-table-action="delete"]').click()
180-
cy.getContent()
181-
.should('not.contain', 'content')
182-
})
183-
184156
it('emoji picker', () => {
185157
cy.openWorkspace()
186158
.type('# Let\'s smile together{enter}## ')

0 commit comments

Comments
 (0)