Skip to content

Commit 34a659c

Browse files
authored
Refactor dispatch (#234)
* chore: optimize doc loading * chore: extract hooks * chore: lint * chore: add test * fix: row document sync * fix: row document create * fix: create document * fix: edit * chore: add test * chore: lint * fix: review comments * chore: fix test * chore: fix test * chore: use optional * chore: fix test * chore: fix test
1 parent 7328fc1 commit 34a659c

File tree

82 files changed

+5910
-1066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+5910
-1066
lines changed

cypress/e2e/app/view-modal.cy.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { AuthTestUtils } from '../../support/auth-utils';
2+
import { AddPageSelectors, EditorSelectors, waitForReactUpdate } from '../../support/selectors';
3+
import { generateRandomEmail } from '../../support/test-config';
4+
import { testLog } from '../../support/test-helpers';
5+
6+
describe('View Modal', () => {
7+
beforeEach(() => {
8+
cy.on('uncaught:exception', (err) => {
9+
if (
10+
err.message.includes('Minified React error') ||
11+
err.message.includes('View not found') ||
12+
err.message.includes('No workspace or service found') ||
13+
err.message.includes('ResizeObserver loop')
14+
) {
15+
return false;
16+
}
17+
return true;
18+
});
19+
20+
cy.viewport(1280, 720);
21+
});
22+
23+
it('creates a document and allows editing in ViewModal', () => {
24+
const testEmail = generateRandomEmail();
25+
const modalText = `modal-test-${Date.now()}`;
26+
27+
testLog.testStart('ViewModal document creation');
28+
testLog.info(`Test email: ${testEmail}`);
29+
30+
cy.visit('/login', { failOnStatusCode: false });
31+
cy.wait(2000);
32+
33+
const authUtils = new AuthTestUtils();
34+
authUtils.signInWithTestUrl(testEmail).then(() => {
35+
cy.url({ timeout: 30000 }).should('include', '/app');
36+
cy.wait(3000);
37+
38+
testLog.step(1, 'Create a new document (opens ViewModal)');
39+
AddPageSelectors.inlineAddButton().first().click({ force: true });
40+
waitForReactUpdate(1000);
41+
cy.get('[role="menuitem"]').first().click({ force: true });
42+
waitForReactUpdate(1000);
43+
44+
testLog.step(2, 'Verify ViewModal is open');
45+
cy.get('[role="dialog"]', { timeout: 10000 }).should('be.visible');
46+
47+
testLog.step(3, 'Verify URL updated with new document');
48+
cy.url({ timeout: 15000 }).should('match', /\/app\/[^/]+\/[^/]+/);
49+
50+
testLog.step(4, 'Type text in ViewModal editor');
51+
cy.get('[role="dialog"]').within(() => {
52+
EditorSelectors.slateEditor()
53+
.first()
54+
.click('topLeft', { force: true })
55+
.type(modalText, { force: true });
56+
});
57+
waitForReactUpdate(1500);
58+
59+
testLog.step(5, 'Verify text appears in editor');
60+
cy.get('[role="dialog"]')
61+
.find('[data-slate-editor="true"]', { timeout: 10000 })
62+
.should('contain.text', modalText);
63+
});
64+
});
65+
});

0 commit comments

Comments
 (0)