-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsaplings-content-types.cy.js
637 lines (633 loc) · 43.9 KB
/
saplings-content-types.cy.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
import { randText, randLines, randPhrase } from '@ngneat/falso';
describe('Verify the Saplings Content Types recipe applied properly.', () => {
/**************************************************************
* Module install and verification section.
*************************************************************/
it('Verify all modules were installed and enabled.', () => {
// Login and visit the extend/modules page.
cy.login()
cy.visit('/admin/modules')
// Verify Menu UI module was installed and enabled.
cy.get('#edit-modules-menu-ui-enable').should('be.checked')
// Verify Access Unpublished module was installed and enabled.
cy.get('#edit-modules-access-unpublished-enable').should('be.checked')
// Verify Field Group module was installed and enabled.
cy.get('#edit-modules-field-group-enable').should('be.checked')
// Verify Metatag: Open Graph module was installed and enabled.
cy.get('#edit-modules-metatag-open-graph-enable').should('be.checked')
// Verify Metatag: Twitter Cards module was installed and enabled.
cy.get('#edit-modules-metatag-twitter-cards-enable').should('be.checked')
// Verify Pathauto module was installed and enabled.
cy.get('#edit-modules-pathauto-enable').should('be.checked')
// Verify Publication Date module was installed and enabled.
cy.get('#edit-modules-publication-date-enable').should('be.checked')
// Verify Scheduler module was installed and enabled.
cy.get('#edit-modules-scheduler-enable').should('be.checked')
// Verify Scheduler Content Mederation Integration module was installed and enabled.
cy.get('#edit-modules-scheduler-content-moderation-integration-enable').should('be.checked')
// Verify Schema.org Article module was installed and enabled.
cy.get('#edit-modules-schema-article-enable').should('be.checked')
// Verify Simple Sitemap module was installed and enabled.
cy.get('#edit-modules-simple-sitemap-enable').should('be.checked')
// Verify Token Or module was installed and enabled.
cy.get('#edit-modules-token-or-enable').should('be.checked')
})
/*********************************************************
* Configuration Import verification section.
********************************************************/
it('Verify Content: Page and Content: Post default metatags are configured.', () => {
cy.login()
// Verify Page default metatags
cy.visit('/admin/config/search/metatag/node__sa_page?destination=/admin/config/search/metatag')
cy.get('#edit-title').should('have.value', '[node:sa_seo_page_title|node:title] | [site:name]')
cy.get('#edit-description').should('contain.text', '[node:sa_seo_description|node:sa_description]')
cy.get('#edit-canonical-url').should('have.value', '[current-page:url:absolute]')
cy.get('#edit-image-src').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook]')
cy.get('#edit-rights').should('have.value', 'Copyright ©[date:html_year] All rights reserved.')
cy.get('#edit-og-site-name').should('have.value', '[site:name]')
cy.get('#edit-og-type').should('have.value', 'website')
cy.get('#edit-og-url').should('have.value', '[current-page:url:absolute]')
cy.get('#edit-og-title').should('have.value', '[node:sa_seo_page_title|node:title]')
cy.get('#edit-og-description').should('contain.text', '[node:sa_seo_description|node:sa_description]')
cy.get('#edit-og-image').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook]')
cy.get('#edit-og-image-type').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook:mimetype|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:mimetype]')
cy.get('#edit-og-image-width').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook:width|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:width]')
cy.get('#edit-og-image-height').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook:height|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:height]')
cy.get('#edit-og-image-alt').should('have.value', '[node:sa_seo_image:entity:field_media_image:alt|node:sa_featured_image:entity:field_media_image:alt]')
cy.get('#edit-og-updated-time').should('have.value', '[node:changed:custom:c]')
cy.get('#edit-og-locale').should('have.value', 'en_US')
cy.get('#edit-twitter-cards-type').should('have.value', 'summary_large_image')
cy.get('#edit-twitter-cards-description').should('have.value', '[node:sa_seo_description|node:sa_description]')
cy.get('#edit-twitter-cards-title').should('have.value', '[node:sa_seo_page_title|node:title]')
cy.get('#edit-twitter-cards-image').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_x:url|node:sa_featured_image:entity:field_media_image:sa_social_media_x:url]')
cy.get('#edit-twitter-cards-image-alt').should('have.value', '[node:sa_seo_image:entity:field_media_image:alt|node:sa_featured_image:entity:field_media_image:alt]')
// Verify Post default metatags
cy.visit('/admin/config/search/metatag/node__sa_post?destination=/admin/config/search/metatag')
cy.get('#edit-title').should('have.value', '[node:sa_seo_page_title|node:title] | [site:name]')
cy.get('#edit-description').should('contain.text', '[node:sa_seo_description|node:sa_description]')
cy.get('#edit-canonical-url').should('have.value', '[current-page:url:absolute]')
cy.get('#edit-image-src').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook]')
cy.get('#edit-rights').should('have.value', 'Copyright ©[date:html_year] All rights reserved.')
cy.get('#edit-og-site-name').should('have.value', '[site:name]')
cy.get('#edit-og-type').should('have.value', 'article')
cy.get('#edit-og-url').should('have.value', '[current-page:url:absolute]')
cy.get('#edit-og-title').should('have.value', '[node:sa_seo_page_title|node:title]')
cy.get('#edit-og-description').should('contain.text', '[node:sa_seo_description|node:sa_description]')
cy.get('#edit-og-image').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook]')
cy.get('#edit-og-image-type').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook:mimetype|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:mimetype]')
cy.get('#edit-og-image-width').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook:width|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:width]')
cy.get('#edit-og-image-height').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_facebook:height|node:sa_featured_image:entity:field_media_image:sa_social_media_facebook:height]')
cy.get('#edit-og-image-alt').should('have.value', '[node:sa_seo_image:entity:field_media_image:alt|node:sa_featured_image:entity:field_media_image:alt]')
cy.get('#edit-og-updated-time').should('have.value', '[node:changed:custom:c]')
cy.get('#edit-og-locale').should('have.value', 'en_US')
cy.get('#edit-twitter-cards-type').should('have.value', 'summary_large_image')
cy.get('#edit-twitter-cards-description').should('have.value', '[node:sa_seo_description|node:sa_description]')
cy.get('#edit-twitter-cards-title').should('have.value', '[node:sa_seo_page_title|node:title]')
cy.get('#edit-twitter-cards-image').should('have.value', '[node:sa_seo_image:entity:field_media_image:sa_social_media_x:url|node:sa_featured_image:entity:field_media_image:sa_social_media_x:url]')
cy.get('#edit-twitter-cards-image-alt').should('have.value', '[node:sa_seo_image:entity:field_media_image:alt|node:sa_featured_image:entity:field_media_image:alt]')
})
it('Verify Pathauto pattern for Page and Post path is set.', () => {
cy.login()
cy.visit('/admin/config/search/path/patterns')
cy.get('[data-drupal-selector="edit-entities-sa-page"]').should('contain.text', '[node:menu-link:parents:join-path]/[node:title]')
cy.get('[data-drupal-selector="edit-entities-sa-post"]').should('contain.text', '[node:content-type]/[node:sa_type]/[node:title]')
})
it('Verify Simple Sitemap Page and Post settings are set.', () => {
cy.login()
cy.visit('/admin/config/search/simplesitemap/entities/node?destination=/admin/config/search/simplesitemap/entities')
// Verify Page Sitemap settings.
cy.get('#edit-bundles-sa-page-default-index-1').should('be.checked')
cy.get('#edit-bundles-sa-page-default-priority').should('have.value', '0.8')
cy.get('#edit-bundles-sa-page-default-changefreq').should('have.value', '')
cy.get('#edit-bundles-sa-page-default-include-images').should('have.value', '0')
// Verify Post Sitemap settings.
cy.get('#edit-bundles-sa-post-default-index-1').should('be.checked')
cy.get('#edit-bundles-sa-post-default-priority').should('have.value', '0.5')
cy.get('#edit-bundles-sa-post-default-changefreq').should('have.value', '')
cy.get('#edit-bundles-sa-post-default-include-images').should('have.value', '0')
})
it('Verify Page and Post content type edit settings.', () => {
cy.login()
// Verify Page content type edit settings.
cy.visit('/admin/structure/types/manage/sa_page?destination=/admin/structure/types')
cy.get('#edit-name').should('have.value', 'Page')
cy.get('#edit-description').should('contain.text', "Used for the primary pages of the site like the homepage and other pages that are in the site's menus.")
cy.get('#edit-title-label').should('have.value', 'Title')
cy.get('#edit-preview-mode-1').should('be.checked')
cy.get('#edit-help').should('contain.text', '')
cy.get('#edit-options-status').should('not.be.checked')
cy.get('#edit-options-promote').should('not.be.checked')
cy.get('#edit-options-sticky').should('not.be.checked')
cy.get('#edit-options-revision').should('be.checked')
cy.get('#edit-display-submitted').should('not.be.checked')
cy.get('#edit-menu-options-admin').should('not.be.checked')
cy.get('#edit-menu-options-footer').should('not.be.checked')
cy.get('#edit-menu-options-main').should('be.checked')
cy.get('#edit-menu-options-tools').should('not.be.checked')
cy.get('#edit-menu-options-account').should('not.be.checked')
cy.get('#edit-menu-parent').should('have.value', 'main:')
cy.get('#edit-scheduler-publish-enable').should('be.checked')
cy.get('#edit-scheduler-publish-touch').should('be.checked')
cy.get('#edit-scheduler-publish-required').should('not.be.checked')
cy.get('#edit-scheduler-publish-revision').should('not.be.checked')
cy.get('#edit-scheduler-publish-past-date-publish').should('be.checked')
cy.get('#edit-scheduler-unpublish-enable').should('not.be.checked')
cy.get('#edit-scheduler-fields-display-mode-vertical-tab').should('be.checked')
cy.get('#edit-scheduler-expand-fieldset-when-required').should('be.checked')
cy.get('#edit-scheduler-show-message-after-update').should('be.checked')
// Verify Post content type edit settings.
cy.visit('/admin/structure/types/manage/sa_post?destination=/admin/structure/types')
cy.get('#edit-name').should('have.value', 'Post')
cy.get('#edit-description').should('contain.text', "Used for filterable pieces of content like articles, news, press releases, etc. Can be categorized, and then filtered using the Post Type and Category taxonomies.")
cy.get('#edit-title-label').should('have.value', 'Title')
cy.get('#edit-preview-mode-1').should('be.checked')
cy.get('#edit-help').should('contain.text', '')
cy.get('#edit-options-status').should('not.be.checked')
cy.get('#edit-options-promote').should('not.be.checked')
cy.get('#edit-options-sticky').should('not.be.checked')
cy.get('#edit-options-revision').should('be.checked')
cy.get('#edit-display-submitted').should('not.be.checked')
cy.get('#edit-menu-options-admin').should('not.be.checked')
cy.get('#edit-menu-options-footer').should('not.be.checked')
cy.get('#edit-menu-options-main').should('not.be.checked')
cy.get('#edit-menu-options-tools').should('not.be.checked')
cy.get('#edit-menu-options-account').should('not.be.checked')
cy.get('#edit-scheduler-publish-enable').should('be.checked')
cy.get('#edit-scheduler-publish-touch').should('be.checked')
cy.get('#edit-scheduler-publish-required').should('not.be.checked')
cy.get('#edit-scheduler-publish-revision').should('not.be.checked')
cy.get('#edit-scheduler-publish-past-date-publish').should('be.checked')
cy.get('#edit-scheduler-unpublish-enable').should('not.be.checked')
cy.get('#edit-scheduler-fields-display-mode-vertical-tab').should('be.checked')
cy.get('#edit-scheduler-expand-fieldset-when-required').should('be.checked')
cy.get('#edit-scheduler-show-message-after-update').should('be.checked')
})
it('Verify Page and Post content types contain all the correct fields and field types', () => {
cy.login()
// Verify the Page content type fields.
cy.visit('/admin/structure/types/manage/sa_page/fields')
cy.get('#sa-components').should('exist')
cy.get('#sa-components').find('.item-list').should('include.text', 'Entity reference revisions')
cy.get('#sa-components').find('.item-list').should('include.text', 'Reference type: Paragraph')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (plain, long)')
cy.get('#sa-featured-image').should('exist')
cy.get('#sa-featured-image').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-featured-image').find('.item-list').should('include.text', 'Reference type: Media')
cy.get('#sa-featured-image').find('.item-list').should('include.text', 'Media type: Image')
cy.get('#sa-robots').should('exist')
cy.get('#sa-robots').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-seo-description').should('exist')
cy.get('#sa-seo-description').find('.item-list').should('include.text', 'Text (plain, long)')
cy.get('#sa-seo-image').should('exist')
cy.get('#sa-seo-image').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-seo-image').find('.item-list').should('include.text', 'Reference type: Media')
cy.get('#sa-seo-image').find('.item-list').should('include.text', 'Media type: Image')
cy.get('#sa-seo-page-title').should('exist')
cy.get('#sa-seo-page-title').find('.item-list').should('include.text', 'Text (plain)')
// Verify the Post content type fields.
cy.visit('/admin/structure/types/manage/sa_post/fields')
cy.get('#sa-author').should('exist')
cy.get('#sa-author').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-author-url').should('exist')
cy.get('#sa-author-url').find('.item-list').should('include.text', 'Link')
cy.get('#sa-body').should('exist')
cy.get('#sa-body').find('.item-list').should('include.text', 'Text (formatted, long, with summary)')
cy.get('#sa-category').should('exist')
cy.get('#sa-category').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-category').find('.item-list').should('include.text', 'Reference type: Taxonomy term')
cy.get('#sa-category').find('.item-list').should('include.text', 'Vocabulary: Category')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (plain, long)')
cy.get('#sa-external-source').should('exist')
cy.get('#sa-external-source').find('.item-list').should('include.text', 'Link')
cy.get('#sa-featured-image').should('exist')
cy.get('#sa-featured-image').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-featured-image').find('.item-list').should('include.text', 'Reference type: Media')
cy.get('#sa-featured-image').find('.item-list').should('include.text', 'Media type: Image')
cy.get('#sa-related-posts').should('exist')
cy.get('#sa-related-posts').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-related-posts').find('.item-list').should('include.text', 'Reference type: Content')
cy.get('#sa-related-posts').find('.item-list').should('include.text', 'Content type:')
cy.get('#sa-robots').should('exist')
cy.get('#sa-robots').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-seo-description').should('exist')
cy.get('#sa-seo-description').find('.item-list').should('include.text', 'Text (plain, long)')
cy.get('#sa-seo-image').should('exist')
cy.get('#sa-seo-image').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-seo-image').find('.item-list').should('include.text', 'Reference type: Media')
cy.get('#sa-seo-image').find('.item-list').should('include.text', 'Media type: Image')
cy.get('#sa-seo-page-title').should('exist')
cy.get('#sa-seo-page-title').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-type').should('exist')
cy.get('#sa-type').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-type').find('.item-list').should('include.text', 'Reference type: Taxonomy term')
cy.get('#sa-type').find('.item-list').should('include.text', 'Vocabulary: Post Type')
})
it('Verify creation of Page and Post content types.', () => {
cy.login()
// Verify the Page content type creation.
const pageTitle = "Page Test - " + randText()
const pageDescription = randLines()
const seoDescription = randLines()
const robotMeta = "Robots metatag test"
cy.visit('/node/add/sa_page')
cy.get("#edit-title-wrapper").type(pageTitle)
cy.get('#edit-sa-description-wrapper').type(pageDescription)
cy.mediaLibraryAdd('#sa_featured_image-media-library-wrapper', 'image-sample_01.png')
cy.get('.horizontal-tabs-list').contains('Advanced SEO').click()
cy.get("#edit-sa-seo-page-title-wrapper").type(pageTitle)
cy.get('#edit-sa-seo-description-wrapper').type(seoDescription)
cy.mediaLibraryAdd('#sa_seo_image-media-library-wrapper', 'image-sample_01.png')
cy.get("#edit-sa-robots-0-value").type(robotMeta)
cy.get("#edit-submit").click()
cy.get('body').should('contain', pageTitle)
// Verify the Post content type creation.
const postTitle = "Post Test - " + randText()
const postDescription = randLines()
const postAuthor = "Author - " + randText()
const postAuthorExternalURL = "http://www.google.com"
const postBody = randLines()
cy.visit('/node/add/sa_post')
cy.get("#edit-title-wrapper").type(postTitle)
cy.get('#edit-sa-description-wrapper').type(postDescription)
cy.mediaLibraryAdd('#sa_featured_image-media-library-wrapper', 'image-sample_01.png')
cy.get('#edit-sa-author-wrapper').type(postAuthor)
cy.get('#edit-sa-author-url-0-uri').type(postAuthorExternalURL)
cy.get('#edit-sa-external-source-0-uri').type(postAuthorExternalURL)
cy.get('.horizontal-tabs-list').contains('Content').click()
cy.ckeditorType('#edit-sa-body-wrapper', postBody);
cy.get('.horizontal-tabs-list').contains('Advanced SEO').click()
cy.get("#edit-sa-seo-page-title-wrapper").type(postTitle)
cy.get('#edit-sa-seo-description-wrapper').type(postDescription)
cy.mediaLibraryAdd('#sa_seo_image-media-library-wrapper', 'image-sample_01.png')
cy.get("#edit-sa-robots-0-value").type(robotMeta)
cy.get("#edit-submit").click()
cy.get('body').should('contain', postTitle)
cy.get('body').should('contain', postAuthor)
cy.get('body').should('contain', postAuthorExternalURL)
cy.get('body').should('contain', postBody)
})
/**************************************************************
* saplings-component-types recipe verification section.
*************************************************************/
it('Verify all core modules were installed and enabled for saplings-component-types recipe.', () => {
// Login and visit the extend/modules page.
cy.login()
cy.visit('/admin/modules')
// Verify Block Content module was installed and enabled.
cy.get('#edit-modules-block-content-enable').should('be.checked')
// Verify Media module was installed and enabled.
cy.get('#edit-modules-media-enable').should('be.checked')
// Verify Media Library module was installed and enabled.
cy.get('#edit-modules-media-library-enable').should('be.checked')
// Verify Text module was installed and enabled.
cy.get('#edit-modules-text-enable').should('be.checked')
})
it('Verify all contrib modules were installed and enabled for saplings-component-types recipe.', () => {
// Login and visit the extend/modules page.
cy.login()
cy.visit('/admin/modules')
// Verify Block Field module was installed and enabled.
cy.get('#edit-modules-block-field-enable').should('be.checked')
// Verify Display Suite module was installed and enabled.
cy.get('#edit-modules-ds-enable').should('be.checked')
// Verify Element Class Formatter module was installed and enabled.
cy.get('#edit-modules-element-class-formatter-enable').should('be.checked')
// Verify Entity Reference Revisions module was installed and enabled.
cy.get('#edit-modules-entity-reference-revisions-enable').should('be.checked')
// Verify No Markup module was installed and enabled.
cy.get('#edit-modules-nomarkup-enable').should('be.checked')
// Verify Paragraphs module was installed and enabled.
cy.get('#edit-modules-paragraphs-enable').should('be.checked')
// Verify Views Reference Field module was installed and enabled.
cy.get('#edit-modules-viewsreference-enable').should('be.checked')
})
it('Verify all paragraph types exist from the saplings-component-types recipe.', () => {
cy.login()
cy.visit('/admin/structure/paragraphs_type')
cy.get('#block-gin-content').should('include.text', 'Accordion')
cy.get('#block-gin-content').should('include.text', 'sa_accordion')
cy.get('#block-gin-content').should('include.text', 'Accordion Item')
cy.get('#block-gin-content').should('include.text', 'sa_accordion_item')
cy.get('#block-gin-content').should('include.text', 'Block')
cy.get('#block-gin-content').should('include.text', 'sa_block')
cy.get('#block-gin-content').should('include.text', 'Card')
cy.get('#block-gin-content').should('include.text', 'sa_card')
cy.get('#block-gin-content').should('include.text', 'Carousel')
cy.get('#block-gin-content').should('include.text', 'sa_carousel')
cy.get('#block-gin-content').should('include.text', 'Carousel Item')
cy.get('#block-gin-content').should('include.text', 'sa_carousel_item')
cy.get('#block-gin-content').should('include.text', 'Filtered List')
cy.get('#block-gin-content').should('include.text', 'sa_filtered_list')
cy.get('#block-gin-content').should('include.text', 'Media')
cy.get('#block-gin-content').should('include.text', 'sa_media')
cy.get('#block-gin-content').should('include.text', 'Side by Side')
cy.get('#block-gin-content').should('include.text', 'sa_side_by_side')
cy.get('#block-gin-content').should('include.text', 'Tab')
cy.get('#block-gin-content').should('include.text', 'sa_tab')
cy.get('#block-gin-content').should('include.text', 'Tabs')
cy.get('#block-gin-content').should('include.text', 'sa_tabs')
cy.get('#block-gin-content').should('include.text', 'Text')
cy.get('#block-gin-content').should('include.text', 'sa_text')
})
it('Verify all the correct fields exists on paragraphs from saplings-component-types recipe.', () => {
cy.login()
// Verify the Accordion paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_accordion/fields')
cy.get('#sa-accordion-item').should('exist')
cy.get('#sa-accordion-item').find('.item-list').should('include.text', 'Entity reference revisions')
cy.get('#sa-accordion-item').find('.item-list').should('include.text', 'Reference type: Paragraph')
cy.get('#sa-accordion-item').find('.item-list').should('include.text', 'Paragraph type: Accordion Item')
cy.get('#sa-background').should('exist')
cy.get('#sa-background').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-width').should('exist')
cy.get('#sa-width').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-margin').should('exist')
cy.get('#sa-margin').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-padding').should('exist')
cy.get('#sa-padding').find('.item-list').should('include.text', 'List (text)')
// Verify the Accordion Item paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_accordion_item/fields')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
// Verify the Block paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_block/fields')
cy.get('#sa-background').should('exist')
cy.get('#sa-background').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-block').should('exist')
cy.get('#sa-block').find('.item-list').should('include.text', 'Block (plugin)')
cy.get('#sa-width').should('exist')
cy.get('#sa-width').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-margin').should('exist')
cy.get('#sa-margin').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-padding').should('exist')
cy.get('#sa-padding').find('.item-list').should('include.text', 'List (text)')
// Verify the Card paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_card/fields')
cy.get('#sa-card-image').should('exist')
cy.get('#sa-card-image').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-card-image').find('.item-list').should('include.text', 'Reference type: Media')
cy.get('#sa-card-image').find('.item-list').should('include.text', 'Media type: Image')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-link').should('exist')
cy.get('#sa-link').find('.item-list').should('include.text', 'Link')
// Verify the Carousel paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_carousel/fields')
cy.get('#sa-background').should('exist')
cy.get('#sa-background').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-carousel-item').should('exist')
cy.get('#sa-carousel-item').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-carousel-item').find('.item-list').should('include.text', 'Reference type: Paragraph')
cy.get('#sa-carousel-item').find('.item-list').should('include.text', 'Paragraph type: Carousel Item')
cy.get('#sa-width').should('exist')
cy.get('#sa-width').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-margin').should('exist')
cy.get('#sa-margin').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-padding').should('exist')
cy.get('#sa-padding').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
// Verify the Carousel Item paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_carousel_item/fields')
cy.get('#sa-carousel-caption').should('exist')
cy.get('#sa-carousel-caption').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-carousel-image').should('exist')
cy.get('#sa-carousel-image').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-carousel-image').find('.item-list').should('include.text', 'Reference type: Media')
cy.get('#sa-carousel-image').find('.item-list').should('include.text', 'Media type: Image')
// Verify the Filtered List paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_filtered_list/fields')
cy.get('#sa-background').should('exist')
cy.get('#sa-background').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-width').should('exist')
cy.get('#sa-width').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-filtered-list').should('exist')
cy.get('#sa-filtered-list').find('.item-list').should('include.text', 'Views reference')
cy.get('#sa-filtered-list').find('.item-list').should('include.text', 'Reference type: View')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-margin').should('exist')
cy.get('#sa-margin').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-padding').should('exist')
cy.get('#sa-padding').find('.item-list').should('include.text', 'List (text)')
// Verify the Media paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_media/fields')
cy.get('#sa-background').should('exist')
cy.get('#sa-background').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-width').should('exist')
cy.get('#sa-width').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-margin').should('exist')
cy.get('#sa-margin').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-media').should('exist')
cy.get('#sa-media').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-media').find('.item-list').should('include.text', 'Reference type: Media')
cy.get('#sa-media').find('.item-list').should('include.text', 'Media type: Image, Remote video')
cy.get('#sa-padding').should('exist')
cy.get('#sa-padding').find('.item-list').should('include.text', 'List (text)')
// Verify the Side by Side paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_side_by_side/fields')
cy.get('#sa-background').should('exist')
cy.get('#sa-background').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-width').should('exist')
cy.get('#sa-width').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-margin').should('exist')
cy.get('#sa-margin').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-media').should('exist')
cy.get('#sa-media').find('.item-list').should('include.text', 'Entity reference')
cy.get('#sa-media').find('.item-list').should('include.text', 'Reference type: Media')
cy.get('#sa-media').find('.item-list').should('include.text', 'Media type: Image, Remote video')
cy.get('#sa-reverse-order').should('exist')
cy.get('#sa-reverse-order').find('.item-list').should('include.text', 'Boolean')
cy.get('#sa-padding').should('exist')
cy.get('#sa-padding').find('.item-list').should('include.text', 'List (text)')
// Verify the Tab paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_tab/fields')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
// Verify the Tabs paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_tabs/fields')
cy.get('#sa-background').should('exist')
cy.get('#sa-background').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-width').should('exist')
cy.get('#sa-width').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-margin').should('exist')
cy.get('#sa-margin').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-padding').should('exist')
cy.get('#sa-padding').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-tab-item').should('exist')
cy.get('#sa-tab-item').find('.item-list').should('include.text', 'Entity reference revisions')
cy.get('#sa-tab-item').find('.item-list').should('include.text', 'Reference type: Paragraph')
cy.get('#sa-tab-item').find('.item-list').should('include.text', 'Paragraph type: Tab')
// Verify the Text paragraph fields.
cy.visit('/admin/structure/paragraphs_type/sa_text/fields')
cy.get('#sa-background').should('exist')
cy.get('#sa-background').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-width').should('exist')
cy.get('#sa-width').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-description').should('exist')
cy.get('#sa-description').find('.item-list').should('include.text', 'Text (formatted, long)')
cy.get('#sa-header').should('exist')
cy.get('#sa-header').find('.item-list').should('include.text', 'Text (plain)')
cy.get('#sa-margin').should('exist')
cy.get('#sa-margin').find('.item-list').should('include.text', 'List (text)')
cy.get('#sa-padding').should('exist')
cy.get('#sa-padding').find('.item-list').should('include.text', 'List (text)')
})
it('Verify creation of Page and all paragraph types.', () => {
cy.login()
// Variables for testing all the fields and verify after page creation.
const pageTitle = "Page Test - " + randText()
const pageDescription = randLines()
const seoDescription = randLines()
const robotMeta = "Robots metatag test"
const paragraphAccordionMainTitle = "Paragraph Accordion Title 1 - " + randText()
const paragraphAccordionMainDescription = randLines()
const paragraphAccordionTitle1 = "Paragraph Accordion Title 1 - " + randText()
const paragraphAccordionDescription1 = randLines()
const paragraphAccordionTitle2 = "Paragraph Accordion Title 2 - " + randText()
const paragraphAccordionDescription2 = randLines()
const paragraphBlockTitle = "Paragraph Block Title - " + randText()
const paragraphBlockDescription = randLines()
const paragraphBlockSelect = "system_powered_by_block";
const paragraphCardTitle = "Paragraph Card Title - " + randText()
const paragraphCardDescription = randLines()
const paragraphFilteredListTitle = "Paragraph Filtered List Title - " + randText()
const paragraphFilteredListDescription = randLines()
const paragraphFilteredListSelect = "media";
const paragraphMediaTitle = "Paragraph Media Title - " + randText()
const paragraphMediaDescription = randLines()
const paragraphSideBySideDescription = randLines()
const paragraphTabTitle1 = "Paragraph Tab Title 1 - " + randText()
const paragraphTabDescription1 = randLines()
const paragraphTabTitle2 = "Paragraph Tab Title 2 - " + randText()
const paragraphTabDescription2 = randLines()
const paragraphTextTitle = "Paragraph Text Title - " + randText()
const paragraphTextDescription = randLines()
//Create the page.
cy.visit('/node/add/sa_page')
cy.get("#edit-title-wrapper").type(pageTitle)
cy.get('#edit-sa-description-wrapper').type(pageDescription)
cy.mediaLibraryAdd('#sa_featured_image-media-library-wrapper', 'image-sample_01.png')
// Add all the paragraphs types with data for testing.
cy.get('.horizontal-tabs-list').contains('Content').click()
// Add an Accordion paragraph.
cy.get('input[name="sa_components_sa_accordion_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.get('input[name="sa_components[0][subform][sa_header][0][value]"]').type(paragraphAccordionMainTitle)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-0-subform-sa-description-wrapper"]', paragraphAccordionMainDescription)
cy.get('input[name="sa_components[0][subform][sa_accordion_item][0][subform][sa_header][0][value]"]').type(paragraphAccordionTitle1)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-0-subform-sa-accordion-item-0-subform-sa-description-wrapper"]', paragraphAccordionDescription1)
cy.get('input[name="sa_components_0_subform_sa_accordion_item_sa_accordion_item_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.get('input[name="sa_components[0][subform][sa_accordion_item][1][subform][sa_header][0][value]"]').type(paragraphAccordionTitle2)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-0-subform-sa-accordion-item-1-subform-sa-description-wrapper"]', paragraphAccordionDescription2)
// Add a Block paragraph.
cy.get('input[name="sa_components_sa_block_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.get('input[name="sa_components[1][subform][sa_header][0][value]"]').type(paragraphBlockTitle)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-1-subform-sa-description-wrapper"]', paragraphBlockDescription)
cy.get('[data-drupal-selector="edit-sa-components-1-subform-sa-block-0-plugin-id"]').select(paragraphBlockSelect);
cy.get('[data-drupal-selector="edit-sa-components-1-subform-sa-block-0-settings-label-display"]').check();
// Add a Card paragraph.
cy.get('input[name="sa_components_sa_card_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.get('input[name="sa_components[2][subform][sa_header][0][value]"]').type(paragraphCardTitle)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-2-subform-sa-description-wrapper"]', paragraphCardDescription)
cy.mediaLibraryAdd('#sa_card_image-media-library-wrapper-sa_components-2-subform', 'image-sample_01.png')
// Add a Carousel paragraph.
cy.get('input[name="sa_components_sa_carousel_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.mediaLibraryAdd('#sa_carousel_image-media-library-wrapper-sa_components-3-subform-sa_carousel_item-0-subform', 'image-sample_01.png')
cy.get('input[name="sa_components_3_subform_sa_carousel_item_sa_carousel_item_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.mediaLibraryAdd('#sa_carousel_image-media-library-wrapper-sa_components-3-subform-sa_carousel_item-1-subform', 'image-sample_01.png')
// Add a Filtered List paragraph.
cy.get('input[name="sa_components_sa_filtered_list_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.get('input[name="sa_components[4][subform][sa_header][0][value]"]').type(paragraphFilteredListTitle)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-4-subform-sa-description-wrapper"]', paragraphFilteredListDescription)
cy.get('[data-drupal-selector="edit-sa-components-4-subform-sa-filtered-list-0-target-id"]').select(paragraphFilteredListSelect);
// Add a Media paragraph.
cy.get('input[name="sa_components_sa_media_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.get('input[name="sa_components[5][subform][sa_header][0][value]"]').type(paragraphMediaTitle)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-5-subform-sa-description-wrapper"]', paragraphMediaDescription)
// cy.mediaLibraryAdd('#sa_media-media-library-wrapper-sa_components-5-subform', 'image-sample_01.png')
// Add a Side by Side paragraph.
cy.get('input[name="sa_components_sa_side_by_side_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.ckeditorType('[data-drupal-selector="edit-sa-components-5-subform-sa-description-wrapper"]', paragraphSideBySideDescription)
cy.mediaLibraryAdd('#sa_media-media-library-wrapper-sa_components-5-subform', 'image-sample_01.png')
// Add a Tabs paragraph.
cy.get('input[name="sa_components_sa_tabs_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.get('input[name="sa_components[6][subform][sa_tab_item][0][subform][sa_header][0][value]"]').type(paragraphTabTitle1)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-6-subform-sa-tab-item-0-subform-sa-description-wrapper"]', paragraphTabDescription1)
cy.get('input[name="sa_components_6_subform_sa_tab_item_sa_tab_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.get('input[name="sa_components[6][subform][sa_tab_item][1][subform][sa_header][0][value]"]').type(paragraphTabTitle2)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-6-subform-sa-tab-item-1-subform-sa-description-wrapper"]', paragraphTabDescription2)
// Add a Text paragraph.
cy.get('input[name="sa_components_sa_text_add_more"]').click()
cy.wait(3000) // Wait for the UI to catch up.
cy.get('input[name="sa_components[7][subform][sa_header][0][value]"]').type(paragraphTextTitle)
cy.ckeditorType('[data-drupal-selector="edit-sa-components-7-subform-sa-description-wrapper"]', paragraphTextDescription)
cy.get('.horizontal-tabs-list').contains('Advanced SEO').click()
cy.get("#edit-sa-seo-page-title-wrapper").type(pageTitle)
cy.get('#edit-sa-seo-description-wrapper').type(seoDescription)
cy.mediaLibraryAdd('#sa_seo_image-media-library-wrapper', 'image-sample_01.png')
cy.get("#edit-sa-robots-0-value").type(robotMeta)
cy.get("#edit-submit").click()
// Verify display of all created content on the page.
cy.get('body').should('contain', pageTitle)
cy.get('body').should('contain', paragraphAccordionTitle1)
cy.get('body').should('contain', paragraphAccordionDescription1)
cy.get('body').should('contain', paragraphAccordionTitle2)
cy.get('body').should('contain', paragraphAccordionDescription2)
cy.get('body').should('contain', paragraphBlockTitle)
cy.get('body').should('contain', paragraphBlockDescription)
cy.get('body').should('contain', paragraphCardTitle)
cy.get('body').should('contain', paragraphCardDescription)
cy.get('body').should('contain', paragraphFilteredListTitle)
cy.get('body').should('contain', paragraphFilteredListDescription)
// cy.get('body').should('contain', paragraphSideBySideDescription)
// cy.get('body').should('contain', paragraphTabTitle1)
// cy.get('body').should('contain', paragraphTabDescription1)
// cy.get('body').should('contain', paragraphTabTitle2)
// cy.get('body').should('contain', paragraphTabDescription2)
cy.get('body').should('contain', paragraphTextTitle)
cy.get('body').should('contain', paragraphTextDescription)
})
})