-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Expand file tree
/
Copy pathindex_fields_spec.js
More file actions
80 lines (66 loc) · 2.15 KB
/
index_fields_spec.js
File metadata and controls
80 lines (66 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import '../utils/dismiss-local-backup';
import {
login,
createPostAndPublish,
assertPublishedEntry,
} from '../utils/steps';
const indexFileEntry = {
title: 'Index Page',
body: 'This is the index page content.',
};
const regularEntry = {
title: 'Regular Post',
body: 'This is a regular post content.',
};
const backend = 'test';
describe('Index File Feature', () => {
before(() => {
Cypress.config('defaultCommandTimeout', 4000);
cy.task('setupBackend', { backend, options: { publish_mode: 'simple' } });
});
after(() => {
cy.task('teardownBackend', { backend });
});
it('successfully loads with index file configured', () => {
login();
});
it('can create and publish an index file entry', () => {
login();
createPostAndPublish(indexFileEntry);
assertPublishedEntry(indexFileEntry);
});
it('can create and publish a regular entry alongside index file', () => {
login();
createPostAndPublish(regularEntry);
assertPublishedEntry(regularEntry);
});
it('displays correct entry type in list when index file exists', () => {
login();
// Verify that entries list loads and displays both regular and index entries
cy.contains('a', 'New Post');
cy.get('[data-testid="list-control"]').should('exist');
});
it('can distinguish between index and regular entries in editor', () => {
login();
// Navigate to entries list
cy.contains('a', 'Writing in').click();
// Should see entries listed
cy.get('[class*="entrylist"]').should('exist');
});
it('can edit and republish index file entry', () => {
login();
createPostAndPublish(indexFileEntry);
// Navigate to entries list
cy.contains('a', 'Writing in').click();
cy.contains(indexFileEntry.title).click();
// Update content
const updatedTitle = 'Updated Index Page';
cy.get('input[name="title"]').clear();
cy.get('input[name="title"]').type(updatedTitle);
cy.get('textarea[name="body"]').clear();
cy.get('textarea[name="body"]').type('Updated index content.');
// Publish changes
cy.contains('button', 'Publish').click();
cy.contains('Published to').should('exist');
});
});