Files
AppFlowy-Web/cypress/e2e/page/paste/paste-plain-text.cy.ts
Nathan.fooo 81880f0a41 Implement document drag and drop3 (#178)
* 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
2025-11-27 20:38:55 +08:00

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');
}
});
});