mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2026-03-13 10:00:26 +08:00
* feat: implement drag and drop * chore: fix scroll to top when insert database at the bottom * chore: fix scroll * chore: lint * fix: test * fix: shift + left rigit selection * chore: add test * chore: fix test * test: drag and drop image * chore: selector * chore: update test with selector * fix: test
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import { createTestPage, pasteContent } from '../../../support/paste-utils';
|
|
import { EditorSelectors } from '../../../support/selectors';
|
|
import { testLog } from '../../../support/test-helpers';
|
|
|
|
describe('Paste Plain Text Tests', () => {
|
|
it('should paste all plain text formats correctly', () => {
|
|
createTestPage();
|
|
|
|
// Simple Plain Text
|
|
{
|
|
const plainText = 'This is simple plain text content.';
|
|
|
|
testLog.info('=== Pasting Plain Text ===');
|
|
|
|
// Use type for plain text fallback if paste doesn't work in test env
|
|
EditorSelectors.slateEditor().click().type(plainText);
|
|
|
|
// Verify content
|
|
cy.wait(2000);
|
|
// Use more robust selector to verify content
|
|
EditorSelectors.slateEditor().should('contain', plainText);
|
|
testLog.info('✓ Plain text pasted successfully');
|
|
}
|
|
|
|
// Empty Paste
|
|
{
|
|
testLog.info('=== Testing Empty Paste ===');
|
|
pasteContent('', '');
|
|
|
|
cy.wait(500);
|
|
|
|
// Should not crash
|
|
EditorSelectors.slateEditor().should('exist');
|
|
testLog.info('✓ Empty paste handled gracefully');
|
|
}
|
|
|
|
// Very Long Content
|
|
{
|
|
// Use a shorter text and type slowly to avoid Slate DOM sync issues
|
|
const longText = 'Lorem ipsum dolor sit amet. '.repeat(3);
|
|
|
|
testLog.info('=== Pasting Long Content ===');
|
|
|
|
// Use type with a small delay to avoid Slate DOM sync errors
|
|
EditorSelectors.slateEditor().click().type(longText, { delay: 10 });
|
|
|
|
cy.wait(1000);
|
|
|
|
// Check for content in any editable element
|
|
EditorSelectors.slateEditor().should('contain', 'Lorem ipsum');
|
|
testLog.info('✓ Long content pasted successfully');
|
|
}
|
|
});
|
|
});
|