-
Notifications
You must be signed in to change notification settings - Fork 27
/
block.test.js
63 lines (61 loc) · 2.16 KB
/
block.test.js
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
describe('Admin can publish posts with podcast block', () => {
const taxonomy = 'Remote work';
if (Cypress.env('HAS_BLOCK_EDITOR')) {
it('Can insert the block and publish the post', () => {
cy.login();
cy.uploadMedia('tests/cypress/fixtures/example.jpg');
cy.createTerm(taxonomy, 'podcasting_podcasts', {
beforeSave: () => {
cy.get('#podcasting_talent_name').type('Person Doe');
cy.get('#podcasting_summary').type('Lorem ipsum dolor');
cy.get('#image-podcasting_image').click();
cy.get('#menu-item-browse').click();
cy.get('.attachments-wrapper').click();
cy.get('.media-button-select').click();
},
});
cy.visit('/wp-admin/post-new.php');
cy.closeWelcomeGuide();
cy.get('h1.editor-post-title__input, #post-title-0')
.first()
.as('title-input');
cy.get('@title-input').click().type('Test episode');
cy.get('.edit-post-header-toolbar__inserter-toggle').click();
cy.get(
'#components-search-control-0, #block-editor-inserter__search-0'
)
.first()
.as('block-search');
cy.get('@block-search').click().type('Podcast');
cy.get('.editor-block-list-item-podcasting-podcast').click();
cy.get('.edit-post-header-toolbar__inserter-toggle').click();
cy.get(
'.wp-block-podcasting-podcast input[type="file"]'
).attachFile('example.mp3');
cy.get('.wp-block-podcasting-podcast audio')
.should('have.attr', 'src')
.and('include', 'example');
cy.openDocumentSettingsPanel('Podcasts');
cy.get('.components-panel__body')
.contains('Podcasts')
.parents('.components-panel__body')
.find('.components-checkbox-control__label')
.contains(taxonomy)
.click();
cy.get('.editor-post-publish-panel__toggle').click();
cy.get('.editor-post-publish-button').click();
cy.get('.components-snackbar', { timeout: 10000 }).should(
'be.visible'
);
cy.get('a.components-button.components-snackbar__action').click();
cy.get('.wp-block-podcasting-podcast audio')
.should('have.attr', 'src')
.and('include', 'example');
cy.visit('/wp-admin/edit.php');
cy.get('.column-taxonomy-podcasting_podcasts').should(
'contain.text',
taxonomy
);
});
}
});