first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
/// <reference types="Cypress" />
describe( 'Test If The Editor Load', () => {
it( 'Should Load', () => {
cy.visit( '/wp-admin/' );
cy.addElementorPage();
} );
} );

View File

@@ -0,0 +1,48 @@
/// <reference types="Cypress" />
const canvasTemplate = 'Canvas-Template' + Date.now();
describe( 'Tests if Canvas Template works', () => {
it( 'should show elementor-template-canvas without editing in elementor', () => {
cy.visit( '/wp-admin/post-new.php' );
cy.wait( 200 );
cy.get( '.components-popover__content > .components-icon-button' ).click();
cy.get( '#post-title-0' ).click().type( canvasTemplate );
cy.get( ':nth-child(7) > .components-panel__body-title > .components-button' )
.should( 'be.visible' ).click();
cy.get( 'select' ).contains( 'Elementor Canvas' ).parent( 'select' ).select( 'Elementor Canvas' );
cy.get( '.editor-default-block-appender__content' ).click();
cy.get( '[aria-label="Empty block; start writing or type forward slash to choose a block"]' ).click()
.type( 'Text' );
cy.get( '.editor-post-publish-panel__toggle' ).click();
cy.get( '.editor-post-publish-panel__header-publish-button > .components-button' ).click();
cy.get( '.editor-post-publish-panel__header-published' ).should( 'exist' );
cy.get( '.post-publish-panel__postpublish-buttons > a.components-button' ).click();
cy.get( '.elementor-template-canvas' ).should( 'exist' );
} );
it( 'should show elementor-template-canvas with editing in elementor', () => {
cy.visit( '/wp-admin/edit.php' );
cy.get( 'a[class="row-title"]' ).contains( canvasTemplate ).click();
cy.get( '#elementor-switch-mode-button' ).click();
cy.addWidget( 'basic', 'heading' );
cy.get( '#elementor-panel-saver-button-save-options' ).click();
cy.get( '#elementor-panel-saver-menu-save-draft > .elementor-title' ).click();
cy.disableElementorPopup();
cy.visit( '/wp-admin/edit.php' );
cy.get( 'a[class="row-title"]' ).contains( canvasTemplate ).click();
cy.wait( 200 );
cy.get( '#elementor-switch-mode-button' ).click();
cy.get( '.editor-block-list__block' ).click();
cy.get( '#mce_0' ).type( 'some-test' );
cy.get( '.editor-post-publish-button' ).should( 'have.attr', 'aria-disabled', 'true' );
cy.get( '.editor-post-publish-button' ).should( 'have.attr', 'aria-disabled', 'false' );
cy.get( '.editor-post-preview' ).invoke( 'attr', 'href' ).then( ( url ) => {
cy.visit( url );
} );
cy.get( '.elementor-template-canvas' ).should( 'exist' );
} );
} );

View File

@@ -0,0 +1,22 @@
/// <reference types="Cypress" />
describe( 'Test If The Frontend handlers works', () => {
it( 'Should open the `Toggle` content', () => {
cy.addElementorPage().then( ( pageId ) => {
cy.addWidget( 'general', 'toggle' );
cy.wait( 100 );
cy.get( '#elementor-panel-saver-button-publish' ).click();
cy.wait( 100 );
cy.get( '#elementor-toast' ).should( 'be.visible' );
cy.visit( '/?p=' + pageId ).then( () => {
cy.get( '.elementor-tab-title:first' ).click();
cy.get( '.elementor-tab-content:first' ).should( 'be.visible' );
} );
} );
} );
} );

View File

@@ -0,0 +1,44 @@
/// <reference types="Cypress" />
const templateName = 'presetPage' + Date.now();
describe( 'Tests if maintenance mode works properly', () => {
before( () => {
cy.login( 'admin' );
cy.addTemplate( {
templateType: 'page',
presetSearch: 'COMING SOON 5',
name: templateName,
} ).then( ( templateId ) => {
Cypress.env( 'maintenanceModeTemplateId', templateId );
} );
} );
it( 'should show maintenance mode in the main page', () => {
cy.visit( 'wp-admin/admin.php?page=elementor-tools#tab-maintenance_mode' );
cy.get( 'select[name="elementor_maintenance_mode_mode"]' ).select( 'Coming Soon' );
cy.get( 'select[name="elementor_maintenance_mode_template_id"]' ).select( templateName );
cy.get( '#submit' ).click();
cy.clearCookies();
cy.setCookie( 'wordpress_test_cookie', 'WP+Cookie+check' );
cy.visit( '/' );
cy.get( '.elementor-' + Cypress.env( 'maintenanceModeTemplateId' ) );
cy.request( { url: '/' } ).then( ( res ) => {
expect( res.status ).to.eq( 200 );
} );
} );
it( 'should return 503', () => {
cy.visit( 'wp-admin/admin.php?page=elementor-tools#tab-maintenance_mode' );
cy.get( 'select[name="elementor_maintenance_mode_mode"]' ).select( 'Maintenance' );
cy.get( 'select[name="elementor_maintenance_mode_template_id"]' ).select( templateName );
cy.get( '#submit' ).click();
cy.clearCookies();
cy.setCookie( 'wordpress_test_cookie', 'WP+Cookie+check' );
cy.visit( '/', { failOnStatusCode: false } );
cy.get( '.elementor-' + Cypress.env( 'maintenanceModeTemplateId' ) );
cy.request( { url: '/', failOnStatusCode: false } ).then( ( res ) => {
expect( res.status ).to.eq( 503 );
} );
} );
} );

View File

@@ -0,0 +1,25 @@
/// <reference types="Cypress" />
describe( 'Test the hide functionality of the navigator', () => {
it( 'Should hide the elementor in when hide in mobile is activated', () => {
cy.addElementorPage();
cy.addWidget( 'basic', 'heading' );
cy.get( '#elementor-preview-iframe' ).then( ( $iframe ) => {
cy.wrap( $iframe.contents().find( '.elementor-widget-heading' ) )
.click( { force: true } )
.trigger( 'contextmenu' );
} );
cy.get( '.elementor-context-menu-list__item-navigator' ).click();
cy.get( '.elementor-tab-control-advanced' ).click();
cy.get( '.elementor-control-_section_responsive' ).scrollIntoView().click();
cy.get( '.elementor-control-hide_mobile .elementor-switch-label' ).click();
cy.get( '.elementor-navigator__item.elementor-editing > .elementor-navigator__element__toggle' )
.click( { force: true } );
cy.get( '#elementor-preview-iframe' ).then( ( $iframe ) => {
cy.wrap( $iframe.contents().find( '.elementor-widget-heading' ), { timeout: 5000 } )
.should( 'not.be.visible' );
} );
} );
} );

View File

@@ -0,0 +1,31 @@
/// <reference types="Cypress" />
describe( 'Test If Try Safe Mode is shown', () => {
it( 'Should show the Safe Mode notice', () => {
cy.addElementorPage().then( ( pageId ) => {
// With `ELEMENTOR_TESTS=1` elementor should not run.
cy.visit( '/wp-admin/post.php?post=' + pageId + '&action=elementor&ELEMENTOR_TESTS=1' );
// On loading the Try Safe Mode should be hidden.
cy.get( '#elementor-try-safe-mode' ).should( 'not.be.visible' );
cy.wait( 10001 );
// After 10 sec that the editor is not loaded the Try Safe Mode should appear.
cy.get( '#elementor-try-safe-mode' ).should( 'be.visible' );
// Click on Try Safe Mode.
cy.get( '.elementor-safe-mode-button' ).click();
// After reload the Safe Mode message should appear But the Try Safe Mode should be removed..
cy.get( '#elementor-safe-mode-message' ).should( 'be.visible' );
cy.get( '#elementor-try-safe-mode' ).should( 'not.exist' );
// Exit Safe Mode.
cy.get( '.elementor-disable-safe-mode' ).click();
// The Safe Mode message should not exist.
cy.get( '#elementor-safe-mode-message' ).should( 'not.exist' );
} );
} );
} );

View File

@@ -0,0 +1,44 @@
/// <reference types="Cypress" />
describe( 'Test is section work as properly', () => {
it( 'Should add section', () => {
cy.addElementorPage().then( () => {
cy.get( '#elementor-preview-iframe' ).then( ( $iframe ) => {
cy.wrap( $iframe.contents().find( '.elementor-add-section-button' ) ).click();
cy.wrap( $iframe.contents().find( 'li[data-structure="20"]' ) ).click();
//cy.wrap( $iframe.contents().find( 'div.elementor-column' ) ).should( 'have.length', 2 );
} );
cy.get( '#elementor-preview-iframe' ).then( ( $iframe ) => {
cy.wrap( $iframe.contents().find( '.elementor-section' ).last().find( '.elementor-column' ) ).should( 'have.length', 2 );
} );
cy.testHistory( { addedLength: 1, title: 'Section', action: 'Added' } );
cy.get( '#elementor-preview-iframe' ).then( ( $iframe ) => {
cy.wrap( $iframe.contents().find( '.elementor-section' ).last().find( '.elementor-editor-element-setting.elementor-editor-element-edit.ui-sortable-handle' ).first() )
.click( { force: true } )
.trigger( 'contextmenu' );
} );
cy.get( '.elementor-context-menu-list__group-addNew' ).click();
cy.get( '#elementor-preview-iframe' ).then( ( $iframe ) => {
cy.wrap( $iframe.contents().find( '.elementor-section' ).last().find( '.elementor-column' ) ).should( 'have.length', 3 );
} );
cy.testHistory( { addedLength: 1, title: 'Column', action: 'Added' } );
cy.get( '#elementor-preview-iframe' ).then( ( $iframe ) => {
cy.wrap( $iframe.contents().find( '.elementor-section' ).last().find( '.elementor-editor-element-setting.elementor-editor-element-edit.ui-sortable-handle' ).first() )
.click( { force: true } )
.trigger( 'contextmenu' );
} );
cy.get( '.elementor-context-menu-list__item-duplicate' ).click();
cy.get( '#elementor-preview-iframe' ).then( ( $iframe ) => {
cy.wrap( $iframe.contents().find( '.elementor-section' ).last().find( '.elementor-column' ) ).should( 'have.length', 4 );
} );
cy.testHistory( { addedLength: 1, title: 'Column', action: 'Added' } );
} );
} );
} );

View File

@@ -0,0 +1,69 @@
/// <reference types="Cypress" />
describe( 'Test if Widgets work as exprected', () => {
before( 'Test if Widgets work as exprected', () => {
cy.login( 'admin' );
cy.addElementorPage();
cy.getCookies().then( ( cookies ) => {
Cypress.env( 'cookies', cookies );
} );
} );
[
{ category: 'basic', widget: 'heading' },
{ category: 'basic', widget: 'image' },
{ category: 'basic', widget: 'video', delay: 3000 },
{ category: 'basic', widget: 'button' },
{ category: 'basic', widget: 'divider' },
{ category: 'basic', widget: 'spacer' },
{ category: 'basic', widget: 'google_maps', delay: 3000 },
{ category: 'basic', widget: 'icon' },
{ category: 'general', widget: 'image-box' },
{ category: 'general', widget: 'icon-box' },
{ category: 'general', widget: 'image-gallery', delay: 3000 },
{ category: 'general', widget: 'image-carousel', delay: 3000 },
{ category: 'general', widget: 'icon-list' },
{ category: 'general', widget: 'counter' },
{ category: 'general', widget: 'progress' },
{ category: 'general', widget: 'testimonial' },
{ category: 'general', widget: 'social-icons' },
{ category: 'general', widget: 'alert' },
{ category: 'general', widget: 'audio', delay: 3000 },
{ category: 'general', widget: 'shortcode', delay: 3000 },
{ category: 'general', widget: 'html' },
{ category: 'general', widget: 'menu-anchor' },
{ category: 'general', widget: 'sidebar', delay: 3000 },
].forEach( ( widget ) => {
it( 'Should show ' + widget.widget, () => {
Cypress.env( 'cookies' ).forEach( ( cookie ) => {
cy.setCookie( cookie.name, cookie.value );
} );
cy.get( '#elementor-panel-header-add-button' ).click();
cy.addWidget( widget.category, widget.widget ).then( ( colomeView ) => {
assert.equal( colomeView.model.get( 'elements' ).first().get( 'widgetType' ), widget.widget );
cy.testHistory( {
addedLength: 1,
title: 'audio' === widget.widget ? 'soundcloud' : widget.widget,
action: 'added',
caseSensitive: false,
} );
if ( widget.delay ) {
cy.wait( widget.delay );
}
cy.removeWidget( '[data-id="' + colomeView.model.get( 'elements' ).first().get( 'id' ) + '"]' );
cy.testHistory( {
addedLength: 1,
title: 'audio' === widget.widget ? 'soundcloud' : widget.widget,
action: 'removed',
caseSensitive: false,
} );
} );
} );
} );
} );

View File

@@ -0,0 +1,23 @@
/// <reference types="Cypress" />
describe( 'Tests the funcnaliti of the widget image', () => {
it( 'Should not dispaly empty image', () => {
cy.addElementorPage().then( ( pageId ) => {
cy.addWidget( 'basic', 'image' ).then( ( colomeView ) => {
const columnId = colomeView.model.get( 'id' ),
widgetId = colomeView.model.get( 'elements' ).first().get( 'id' );
cy.get( '.elementor-control-media__replace' ).click( { force: true } );
cy.get( '#elementor-panel-saver-button-publish' ).click();
cy.wait( 100 );
cy.get( '#elementor-panel-saver-button-publish' ).click();
cy.get( '.elementor-button.elementor-button-success.elementor-disabled' ).should( 'exist' );
cy.visit( '/?p=' + pageId );
cy.get( '[data-id=' + widgetId + ']' ).should( 'not.exist' );
cy.get( '[data-id=' + columnId + ']' ).should( 'exist' );
} );
} );
} );
} );