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,64 @@
const config = require( './config' );
const getScenarios = () => {
const scenarios = [];
const origin = config.url_origin;
config.templates.forEach( ( pathname ) => {
scenarios.push( {
label: pathname,
url: `${ origin }/${ pathname }`,
referenceUrl: `${ origin }/${ pathname }`,
readyEvent: '',
readySelector: '',
delay: 2000,
selectors: [ 'document' ], // With the `document` selector it takes a full page shot.
onBeforeScript: `${ __dirname }/scripts/on-before-ready.js`,
misMatchThreshold: 0,
requireSameDimensions: true,
} );
} );
return scenarios;
};
const testsViewports = () => {
const view = [];
config.tests_viewports.forEach( ( viewport ) => {
view.push( {
label: viewport.label,
width: viewport.width,
height: viewport.height,
} );
} );
return view;
};
module.exports = {
id: 'elementor_screenshotter',
viewports: testsViewports(),
scenarios: getScenarios(),
paths: {
bitmaps_reference: `backstop_data/reference`,
bitmaps_test: `backstop_data/bitmaps_test`,
engine_scripts: `backstop_data/engine_scripts`,
html_report: `backstop_data/html_report`,
ci_report: `backstop_data/ci_report`,
},
report: [ 'browser', 'CI' ],
ciReport: {
format: 'junit',
},
engine: 'puppeteer',
engineOptions: {
slowMo: 500,
args: [ '--no-sandbox' ],
},
asyncCaptureLimit: 10,
asyncCompareLimit: 10,
debug: false,
debugWindow: false,
fileNameTemplate: '{scenarioLabel}_{viewportLabel}',
};

View File

@@ -0,0 +1,80 @@
const config = {
/**
* Set DB params for settings
*/
db_name: 'wordpress_test',
db_user: 'root',
db_pass: 'root',
db_host: 'localhost',
/**
* Set WP params for settings
*/
wp_version: 'latest',
wp_locale: 'en_US',
wp_user: 'test',
wp_user_pass: 'test',
wp_user_email: 'user@example.org',
wp_site_name: 'test',
/**
* Current plugin (where the PR)
*/
name: 'elementor',
/**
* When needed to used things that exists in yours plugin zip url and not exists in wordpress market plugin folder,
* Than use "pluginUrl" : "emptyVrsion"
* When the download link of plugin included version, leave the version empty otherwise the process can fail
*
* Example - "pluginUrl": ""
* Download plugin with version from github -> "https://github.com/elementor/elementor/archive/v3.0.15.zip": ""
*
* Example - "pluginName": "version"
* Download plugin with version from wordpress market -> "elementor": "3.0.15"
*/
plugins: {},
theme: {
'hello-elementor': '2.3.1',
},
/**
* Declare an array of templates to import for testing
* The name of template must be same as the post_name
*/
templates: [
'buttons',
'dividers',
'global-settings',
'headings',
'icons',
'icons-box',
'icons-list',
'image',
'image-box',
'social-icons',
'testimonials',
'text-editor',
],
/**
* Declare the url origin of local server for testing
*/
url_origin: 'http://localhost:8080',
/**
* An array of screen size objects your DOM will be tested against. Add as many as you like -- but add at least one.
*/
tests_viewports: [
{
label: 'phone',
width: 767,
height: 575,
},
{
label: 'tablet',
width: 1024,
height: 768,
},
{
label: 'desktop',
width: 1366,
height: 768,
},
],
};
module.exports = config;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"version":"0.4","title":"Dividers","type":"page","content":[{"id":"4ede5583","settings":[],"elements":[{"id":"60b597dd","settings":{"_column_size":100,"_inline_size":null},"elements":[{"id":"65b6654c","settings":{"editor":"<p>Alignment<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"1c9607f8","settings":{"width":{"unit":"%","size":50,"sizes":[]},"look":"line_text","text":"No Alignment"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"7c94b059","settings":{"width":{"unit":"%","size":50,"sizes":[]},"align":"left","look":"line_text","text":"Aligned Left"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"2a29fa9a","settings":{"width":{"unit":"%","size":50,"sizes":[]},"align":"center","look":"line_text","text":"Aligned Center"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"1e8ee379","settings":{"width":{"unit":"%","size":50,"sizes":[]},"align":"right","look":"line_text","text":"Aligned Right"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"52f1f63b","settings":{"editor":"<p>Styles<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"34973b4","settings":{"text":"Divider"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"411a8a6b","settings":{"style":"slashes","text":"Divider"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"47c759a4","settings":{"style":"wavy","text":"Divider"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"60200c9e","settings":{"style":"rhombus","text":"Divider"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"1a4f4510","settings":{"style":"dots_tribal","text":"Divider"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"683e19e2","settings":{"style":"planes_tribal","text":"Divider"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"13183a94","settings":{"editor":"<p>Elements<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"62b4fd88","settings":{"look":"line_text","text":"Text"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"c39b0f5","settings":{"look":"line_icon","text":"Text"},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"13700aed","settings":{"editor":"<p>Other Controls<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"73c5903d","settings":{"editor":"<p>Weight<\/p>"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"4278c84e","settings":{"text":"Text","weight":{"unit":"px","size":10,"sizes":[]},"gap":{"unit":"px","size":"","sizes":[]}},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"},{"id":"ac4d0f3","settings":{"editor":"<p>Gap<\/p>"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"1fc0a5e","settings":{"text":"Text","weight":{"unit":"px","size":"","sizes":[]},"gap":{"unit":"px","size":50,"sizes":[]}},"elements":[],"isInner":false,"widgetType":"divider","elType":"widget"}],"isInner":false,"elType":"column"}],"isInner":false,"elType":"section"}]}

View File

@@ -0,0 +1 @@
{"version":"0.4","title":"Global Settings","type":"page","content":[{"id":"55048bff","settings":[],"elements":[{"id":"5f8ae2aa","settings":{"_column_size":100,"_inline_size":null},"elements":[{"id":"d94062f","settings":{"editor":"<p>Colors<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"6119e3d1","settings":{"title":"Primary","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600","__globals__":{"title_color":"globals\/colors?id=primary"}},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"598b8229","settings":{"title":"Secondary","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600","__globals__":{"title_color":"globals\/colors?id=secondary"}},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"697b1e02","settings":{"title":"Text","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600","__globals__":{"title_color":"globals\/colors?id=text"}},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"1d270a56","settings":{"title":"Accent","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600","__globals__":{"title_color":"globals\/colors?id=accent"}},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"735e678c","settings":[],"elements":[],"isInner":false,"widgetType":"spacer","elType":"widget"},{"id":"53b32a4e","settings":{"editor":"<p>Typography<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"5480a1f2","settings":{"title":"Primary","__globals__":{"title_color":"","typography_typography":"globals\/typography?id=primary"},"title_color":"#000000"},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"158825c3","settings":{"title":"Secondary","__globals__":{"title_color":"","typography_typography":"globals\/typography?id=secondary"},"title_color":"#000000"},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"16461838","settings":{"title":"Text","__globals__":{"title_color":"","typography_typography":"globals\/typography?id=text"},"title_color":"#000000"},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"4c3b821c","settings":{"title":"Accent","__globals__":{"title_color":"","typography_typography":"globals\/typography?id=accent"},"title_color":"#000000"},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"}],"isInner":false,"elType":"column"}],"isInner":false,"elType":"section"}]}

View File

@@ -0,0 +1 @@
{"version":"0.4","title":"Headings","type":"page","content":[{"id":"7edbdefe","settings":[],"elements":[{"id":"64def3af","settings":{"_column_size":100,"_inline_size":null},"elements":[{"id":"6a689c3a","settings":{"editor":"<p>Alignment<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"4f843a7d","settings":{"title":"No Alignment","title_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600"},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"191761e1","settings":{"title":"Align Left","align":"left","title_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600"},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"391f67bc","settings":{"title":"Align Center","align":"center","title_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600"},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"f8e9a80","settings":{"title":"Align Right","align":"right","title_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600"},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"639cb28c","settings":{"title":"This is justified. This is justified. This is justified. This is justified. This is justified. This is justified","align":"justify","title_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600"},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"65a8c04f","settings":[],"elements":[],"isInner":false,"widgetType":"spacer","elType":"widget"},{"id":"6e12e483","settings":{"editor":"<p>HTML tag<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"2875b39","settings":{"title":"H1","align":"justify","header_size":"h1","title_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600","__dynamic__":[]},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"2a64a5dc","settings":{"title":"H2","align":"justify","title_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600","__dynamic__":[]},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"9e302f9","settings":{"title":"H3","align":"justify","header_size":"h3","title_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600","__dynamic__":[]},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"},{"id":"1683acb","settings":{"title":"H4","align":"justify","header_size":"h4","title_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"600","__dynamic__":[]},"elements":[],"isInner":false,"widgetType":"heading","elType":"widget"}],"isInner":false,"elType":"column"}],"isInner":false,"elType":"section"}]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"version":"0.4","title":"Icons","type":"page","content":[{"id":"3888aef3","settings":[],"elements":[{"id":"20af21b6","settings":{"_column_size":100,"_inline_size":null},"elements":[{"id":"769e05ef","settings":{"editor":"<p>Alignment<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"185bef21","settings":{"align":"","primary_color":"#000000"},"elements":[],"isInner":false,"widgetType":"icon","elType":"widget"},{"id":"157da400","settings":{"align":"left","primary_color":"#000000"},"elements":[],"isInner":false,"widgetType":"icon","elType":"widget"},{"id":"2c5eacd3","settings":{"primary_color":"#000000"},"elements":[],"isInner":false,"widgetType":"icon","elType":"widget"},{"id":"77e24d44","settings":{"align":"right","primary_color":"#000000"},"elements":[],"isInner":false,"widgetType":"icon","elType":"widget"},{"id":"66d1b709","settings":[],"elements":[],"isInner":false,"widgetType":"spacer","elType":"widget"},{"id":"1381926","settings":{"editor":"<p>Size<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"68377bde","settings":{"primary_color":"#000000","size":{"unit":"px","size":200,"sizes":[]}},"elements":[],"isInner":false,"widgetType":"icon","elType":"widget"},{"id":"3c0dcf4a","settings":[],"elements":[],"isInner":false,"widgetType":"spacer","elType":"widget"},{"id":"46c52551","settings":{"editor":"<p>Rotation<\/p>","text_color":"#000000","typography_typography":"custom","typography_font_family":"Roboto","typography_font_weight":"400","_background_background":"classic","_background_color":"#FFFF00"},"elements":[],"isInner":false,"widgetType":"text-editor","elType":"widget"},{"id":"233595cc","settings":{"selected_icon":{"value":"fas fa-arrow-up","library":"fa-solid"},"primary_color":"#000000","rotate":{"unit":"deg","size":45,"sizes":[]}},"elements":[],"isInner":false,"widgetType":"icon","elType":"widget"},{"id":"33160bbb","settings":{"selected_icon":{"value":"fas fa-arrow-up","library":"fa-solid"},"primary_color":"#000000","rotate":{"unit":"deg","size":180,"sizes":[]}},"elements":[],"isInner":false,"widgetType":"icon","elType":"widget"},{"id":"3c430958","settings":[],"elements":[],"isInner":false,"widgetType":"spacer","elType":"widget"}],"isInner":false,"elType":"column"}],"isInner":false,"elType":"section"}]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -0,0 +1,78 @@
module.exports = async function( page ) {
const config = require( '../config' );
const url = require( 'url' );
const fs = require( 'fs' );
const path = require( 'path' );
const chalk = require( 'chalk' );
const pathname = 'backstop_data/html_snapshots';
if ( ! fs.existsSync( pathname ) ) {
const __dirname = path.resolve();
// Remove leading directory markers, and remove ending /file-name.extension if exists
pathname.replace( /^\.*\/|\/?[^\/]+\.[a-z]+|\/$/g, '' );
fs.mkdir( path.resolve( __dirname, pathname ), { recursive: true }, ( e ) => {
if ( e ) {
// eslint-disable-next-line no-console
console.error( e );
} else {
// eslint-disable-next-line no-console
console.log( chalk.green( 'Success created folder - snapshot' ) );
}
} );
}
page.setRequestInterception( true );
page
.on( 'request', async ( request ) => {
const requestUrl = request.url();
const configHost = url.parse( config.url_origin, true ).host;
const requestHost = url.parse( requestUrl, true ).host;
if ( 'localhost' === requestHost ) {
request.respond( {
status: 302,
headers: {
location: requestUrl.replace( requestHost, configHost ),
},
} );
} else {
request.continue();
}
} )
.on( 'console', ( message ) => {
const type = message.type().substr( 0, 3 ).toUpperCase();
const colors = {
LOG: ( text ) => text,
ERR: chalk.red,
WAR: chalk.yellow,
INF: chalk.cyan,
};
const color = colors[ type ] || chalk.blue;
// eslint-disable-next-line no-console
console.log( color( `${ type } ${ message.text() }` ) );
} )
.on( 'pageerror', ( { message } ) => {
// eslint-disable-next-line no-console
console.log( chalk.red( message ) );
} )
.on( 'response', async ( response ) => {
// eslint-disable-next-line no-console
console.log( chalk.green( `${ response.status() } ${ response.url() }` ) );
} )
.on( 'requestfailed', ( request ) => {
// eslint-disable-next-line no-console
console.log( chalk.magenta( `${ request.failure().errorText } ${ request.url() }` ) );
} )
.on( 'load', async () => {
const pageTitle = await page.title();
const cdp = await page.target().createCDPSession();
const { data } = await cdp.send( 'Page.captureSnapshot', { format: 'mhtml' } );
const filePath = `backstop_data/html_snapshots/${ pageTitle }.mhtml`;
fs.writeFileSync( filePath, data );
if ( ! fs.existsSync( filePath ) ) {
// eslint-disable-next-line no-console
console.log( chalk.red( `Failed to created file - ${ filePath }` ) );
}
} );
};