From f9fd402db3444b82e0a5b07b310af8f57ade3934 Mon Sep 17 00:00:00 2001 From: Marta Motyczynska Date: Mon, 27 May 2024 21:48:30 +0200 Subject: [PATCH 1/8] Add testing env global variable by default to manual and automated tests. --- .../lib/tasks/runautomatedtests.js | 3 +++ .../lib/utils/automated-tests/beforetestsetup.js | 11 +++++++++++ .../lib/utils/manual-tests/compilehtmlfiles.js | 1 + .../lib/utils/manual-tests/copyassets.js | 1 + .../lib/utils/manual-tests/globalsettings.js | 8 ++++++++ .../tests/utils/manual-tests/compilehtmlfiles.js | 5 +++++ 6 files changed, 29 insertions(+) create mode 100644 packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js create mode 100644 packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js diff --git a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js index 41bf1273d..95300d76e 100644 --- a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js +++ b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js @@ -95,6 +95,9 @@ function createEntryFile( globPatterns, production ) { throw new Error( 'Not found files to tests. Specified patterns are invalid.' ); } + // Inject the initialization settings to be executed in the `before` hook such as global variables, etc. + allFiles.unshift( path.join( __dirname, '..', 'utils', 'automated-tests', 'beforetestsetup.js' ).replace( /\\/g, '/' ) ); + // Inject the leak detector root hooks. Need to be split into two parts due to #598. allFiles.splice( 0, 0, path.join( __dirname, '..', 'utils', 'automated-tests', 'leaksdetectorbefore.js' ).replace( /\\/g, '/' ) ); allFiles.push( path.join( __dirname, '..', 'utils', 'automated-tests', 'leaksdetectorafter.js' ).replace( /\\/g, '/' ) ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js new file mode 100644 index 000000000..86a6c93c8 --- /dev/null +++ b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. + * For licensing, see LICENSE.md. + */ + +/* global window */ + +// eslint-disable-next-line mocha/no-top-level-hooks +before( function() { + window.CKEDITOR_IS_TEST_ENV = true; +} ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js index cf9cd295c..cc03c60e0 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js @@ -134,6 +134,7 @@ function compileHtmlFile( buildDir, options ) { '' + '' + '' + + '' + `${ languagesToLoad.map( language => { return ``; } ).join( '' ) }` + diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js index 423d661af..18ed547a3 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js @@ -10,6 +10,7 @@ const assets = [ path.join( __dirname, 'togglesidebar.js' ), path.join( __dirname, 'attachinspector.js' ), path.join( __dirname, 'websocket.js' ), + path.join( __dirname, 'globalsettings.js' ), require.resolve( '@ckeditor/ckeditor5-inspector' ) ]; diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js new file mode 100644 index 000000000..d326bdc90 --- /dev/null +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js @@ -0,0 +1,8 @@ +/** + * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. + * For licensing, see LICENSE.md. + */ + +/* global window */ + +window.CKEDITOR_IS_TEST_ENV = true; diff --git a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js index fa34f921b..e1cda2e52 100644 --- a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js @@ -160,6 +160,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' ].join( '\n' ) @@ -207,6 +208,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' + '' + @@ -251,6 +253,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' ].join( '\n' ) @@ -324,6 +327,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' ].join( '\n' ) @@ -404,6 +408,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' ].join( '\n' ) From 62ab5d6014ceca0ff66ffb0469a60718ff74952d Mon Sep 17 00:00:00 2001 From: Marta Motyczynska Date: Thu, 6 Jun 2024 14:07:07 +0200 Subject: [PATCH 2/8] Pass 'GPL' as global license key in tests (automated & manual). --- .../ckeditor5-dev-tests/lib/tasks/runautomatedtests.js | 4 ++-- .../{beforetestsetup.js => licensekeybefore.js} | 2 +- .../lib/utils/manual-tests/compilehtmlfiles.js | 2 +- .../lib/utils/manual-tests/copyassets.js | 2 +- .../{globalsettings.js => globallicensekey.js} | 2 +- .../tests/utils/manual-tests/compilehtmlfiles.js | 10 +++++----- 6 files changed, 11 insertions(+), 11 deletions(-) rename packages/ckeditor5-dev-tests/lib/utils/automated-tests/{beforetestsetup.js => licensekeybefore.js} (83%) rename packages/ckeditor5-dev-tests/lib/utils/manual-tests/{globalsettings.js => globallicensekey.js} (77%) diff --git a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js index 95300d76e..055f52c9c 100644 --- a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js +++ b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js @@ -95,8 +95,8 @@ function createEntryFile( globPatterns, production ) { throw new Error( 'Not found files to tests. Specified patterns are invalid.' ); } - // Inject the initialization settings to be executed in the `before` hook such as global variables, etc. - allFiles.unshift( path.join( __dirname, '..', 'utils', 'automated-tests', 'beforetestsetup.js' ).replace( /\\/g, '/' ) ); + // Set global license key in the `before` hook. + allFiles.unshift( path.join( __dirname, '..', 'utils', 'automated-tests', 'licensekeybefore.js' ).replace( /\\/g, '/' ) ); // Inject the leak detector root hooks. Need to be split into two parts due to #598. allFiles.splice( 0, 0, path.join( __dirname, '..', 'utils', 'automated-tests', 'leaksdetectorbefore.js' ).replace( /\\/g, '/' ) ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/licensekeybefore.js similarity index 83% rename from packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js rename to packages/ckeditor5-dev-tests/lib/utils/automated-tests/licensekeybefore.js index 86a6c93c8..6fec56bcd 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js +++ b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/licensekeybefore.js @@ -7,5 +7,5 @@ // eslint-disable-next-line mocha/no-top-level-hooks before( function() { - window.CKEDITOR_IS_TEST_ENV = true; + window.CKEDITOR_GLOBAL_LICENSE_KEY = 'GPL'; } ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js index cc03c60e0..796d41fed 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js @@ -134,7 +134,7 @@ function compileHtmlFile( buildDir, options ) { '' + '' + '' + - '' + + '' + `${ languagesToLoad.map( language => { return ``; } ).join( '' ) }` + diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js index 18ed547a3..36c583200 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js @@ -10,7 +10,7 @@ const assets = [ path.join( __dirname, 'togglesidebar.js' ), path.join( __dirname, 'attachinspector.js' ), path.join( __dirname, 'websocket.js' ), - path.join( __dirname, 'globalsettings.js' ), + path.join( __dirname, 'globallicensekey.js' ), require.resolve( '@ckeditor/ckeditor5-inspector' ) ]; diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globallicensekey.js similarity index 77% rename from packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js rename to packages/ckeditor5-dev-tests/lib/utils/manual-tests/globallicensekey.js index d326bdc90..2b5a50de2 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globallicensekey.js @@ -5,4 +5,4 @@ /* global window */ -window.CKEDITOR_IS_TEST_ENV = true; +window.CKEDITOR_GLOBAL_LICENSE_KEY = 'GPL'; diff --git a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js index e1cda2e52..e94a529da 100644 --- a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js @@ -160,7 +160,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) @@ -208,7 +208,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' + '' + @@ -253,7 +253,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) @@ -327,7 +327,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) @@ -408,7 +408,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) From 0092f828ddaea136f5d33481dd3f811b747c7c0e Mon Sep 17 00:00:00 2001 From: Marta Motyczynska Date: Tue, 3 Sep 2024 10:14:49 +0200 Subject: [PATCH 3/8] Revert "Pass 'GPL' as global license key in tests (automated & manual)." This reverts commit 62ab5d6014ceca0ff66ffb0469a60718ff74952d. --- .../ckeditor5-dev-tests/lib/tasks/runautomatedtests.js | 4 ++-- .../{licensekeybefore.js => beforetestsetup.js} | 2 +- .../lib/utils/manual-tests/compilehtmlfiles.js | 2 +- .../lib/utils/manual-tests/copyassets.js | 2 +- .../{globallicensekey.js => globalsettings.js} | 2 +- .../tests/utils/manual-tests/compilehtmlfiles.js | 10 +++++----- 6 files changed, 11 insertions(+), 11 deletions(-) rename packages/ckeditor5-dev-tests/lib/utils/automated-tests/{licensekeybefore.js => beforetestsetup.js} (83%) rename packages/ckeditor5-dev-tests/lib/utils/manual-tests/{globallicensekey.js => globalsettings.js} (77%) diff --git a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js index 055f52c9c..95300d76e 100644 --- a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js +++ b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js @@ -95,8 +95,8 @@ function createEntryFile( globPatterns, production ) { throw new Error( 'Not found files to tests. Specified patterns are invalid.' ); } - // Set global license key in the `before` hook. - allFiles.unshift( path.join( __dirname, '..', 'utils', 'automated-tests', 'licensekeybefore.js' ).replace( /\\/g, '/' ) ); + // Inject the initialization settings to be executed in the `before` hook such as global variables, etc. + allFiles.unshift( path.join( __dirname, '..', 'utils', 'automated-tests', 'beforetestsetup.js' ).replace( /\\/g, '/' ) ); // Inject the leak detector root hooks. Need to be split into two parts due to #598. allFiles.splice( 0, 0, path.join( __dirname, '..', 'utils', 'automated-tests', 'leaksdetectorbefore.js' ).replace( /\\/g, '/' ) ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/licensekeybefore.js b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js similarity index 83% rename from packages/ckeditor5-dev-tests/lib/utils/automated-tests/licensekeybefore.js rename to packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js index 6fec56bcd..86a6c93c8 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/licensekeybefore.js +++ b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js @@ -7,5 +7,5 @@ // eslint-disable-next-line mocha/no-top-level-hooks before( function() { - window.CKEDITOR_GLOBAL_LICENSE_KEY = 'GPL'; + window.CKEDITOR_IS_TEST_ENV = true; } ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js index 796d41fed..cc03c60e0 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js @@ -134,7 +134,7 @@ function compileHtmlFile( buildDir, options ) { '' + '' + '' + - '' + + '' + `${ languagesToLoad.map( language => { return ``; } ).join( '' ) }` + diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js index 36c583200..18ed547a3 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js @@ -10,7 +10,7 @@ const assets = [ path.join( __dirname, 'togglesidebar.js' ), path.join( __dirname, 'attachinspector.js' ), path.join( __dirname, 'websocket.js' ), - path.join( __dirname, 'globallicensekey.js' ), + path.join( __dirname, 'globalsettings.js' ), require.resolve( '@ckeditor/ckeditor5-inspector' ) ]; diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globallicensekey.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js similarity index 77% rename from packages/ckeditor5-dev-tests/lib/utils/manual-tests/globallicensekey.js rename to packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js index 2b5a50de2..d326bdc90 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globallicensekey.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js @@ -5,4 +5,4 @@ /* global window */ -window.CKEDITOR_GLOBAL_LICENSE_KEY = 'GPL'; +window.CKEDITOR_IS_TEST_ENV = true; diff --git a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js index e94a529da..e1cda2e52 100644 --- a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js @@ -160,7 +160,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) @@ -208,7 +208,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' + '' + @@ -253,7 +253,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) @@ -327,7 +327,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) @@ -408,7 +408,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) From 9bd4f309d5df5b3fd6de1cb85dd7c3837751f076 Mon Sep 17 00:00:00 2001 From: Marta Motyczynska Date: Tue, 3 Sep 2024 10:14:57 +0200 Subject: [PATCH 4/8] Revert "Add testing env global variable by default to manual and automated tests." This reverts commit f9fd402db3444b82e0a5b07b310af8f57ade3934. --- .../lib/tasks/runautomatedtests.js | 3 --- .../lib/utils/automated-tests/beforetestsetup.js | 11 ----------- .../lib/utils/manual-tests/compilehtmlfiles.js | 1 - .../lib/utils/manual-tests/copyassets.js | 1 - .../lib/utils/manual-tests/globalsettings.js | 8 -------- .../tests/utils/manual-tests/compilehtmlfiles.js | 5 ----- 6 files changed, 29 deletions(-) delete mode 100644 packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js delete mode 100644 packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js diff --git a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js index 95300d76e..41bf1273d 100644 --- a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js +++ b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js @@ -95,9 +95,6 @@ function createEntryFile( globPatterns, production ) { throw new Error( 'Not found files to tests. Specified patterns are invalid.' ); } - // Inject the initialization settings to be executed in the `before` hook such as global variables, etc. - allFiles.unshift( path.join( __dirname, '..', 'utils', 'automated-tests', 'beforetestsetup.js' ).replace( /\\/g, '/' ) ); - // Inject the leak detector root hooks. Need to be split into two parts due to #598. allFiles.splice( 0, 0, path.join( __dirname, '..', 'utils', 'automated-tests', 'leaksdetectorbefore.js' ).replace( /\\/g, '/' ) ); allFiles.push( path.join( __dirname, '..', 'utils', 'automated-tests', 'leaksdetectorafter.js' ).replace( /\\/g, '/' ) ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js deleted file mode 100644 index 86a6c93c8..000000000 --- a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* global window */ - -// eslint-disable-next-line mocha/no-top-level-hooks -before( function() { - window.CKEDITOR_IS_TEST_ENV = true; -} ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js index cc03c60e0..cf9cd295c 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js @@ -134,7 +134,6 @@ function compileHtmlFile( buildDir, options ) { '' + '' + '' + - '' + `${ languagesToLoad.map( language => { return ``; } ).join( '' ) }` + diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js index 18ed547a3..423d661af 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js @@ -10,7 +10,6 @@ const assets = [ path.join( __dirname, 'togglesidebar.js' ), path.join( __dirname, 'attachinspector.js' ), path.join( __dirname, 'websocket.js' ), - path.join( __dirname, 'globalsettings.js' ), require.resolve( '@ckeditor/ckeditor5-inspector' ) ]; diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js deleted file mode 100644 index d326bdc90..000000000 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* global window */ - -window.CKEDITOR_IS_TEST_ENV = true; diff --git a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js index e1cda2e52..fa34f921b 100644 --- a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js @@ -160,7 +160,6 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + '' + '' ].join( '\n' ) @@ -208,7 +207,6 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + '' + '' + '' + @@ -253,7 +251,6 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + '' + '' ].join( '\n' ) @@ -327,7 +324,6 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + '' + '' ].join( '\n' ) @@ -408,7 +404,6 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + '' + '' ].join( '\n' ) From e0775b7c213e68ed0eef9f007da1209f93a77757 Mon Sep 17 00:00:00 2001 From: Marta Motyczynska Date: Tue, 3 Sep 2024 10:42:45 +0200 Subject: [PATCH 5/8] Add global license key to manual and automated tests. --- .../lib/utils/automated-tests/getwebpackconfig.js | 2 ++ .../lib/utils/manual-tests/getwebpackconfig.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/getwebpackconfig.js b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/getwebpackconfig.js index a15cc5770..072943f3e 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/getwebpackconfig.js +++ b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/getwebpackconfig.js @@ -18,6 +18,8 @@ const TreatWarningsAsErrorsWebpackPlugin = require( './treatwarningsaserrorswebp module.exports = function getWebpackConfigForAutomatedTests( options ) { const definitions = Object.assign( {}, getDefinitionsFromFile( options.identityFile ) ); + definitions[ 'window.CKEDITOR_GLOBAL_LICENSE_KEY' ] = JSON.stringify( 'GPL' ); + const config = { mode: 'development', diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/getwebpackconfig.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/getwebpackconfig.js index 4dbab390b..28b6c0601 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/getwebpackconfig.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/getwebpackconfig.js @@ -29,6 +29,8 @@ const getDefinitionsFromFile = require( '../getdefinitionsfromfile' ); module.exports = function getWebpackConfigForManualTests( options ) { const definitions = Object.assign( {}, getDefinitionsFromFile( options.identityFile ) ); + definitions[ 'window.CKEDITOR_GLOBAL_LICENSE_KEY' ] = JSON.stringify( 'GPL' ); + const webpackConfig = { mode: 'none', From aa3c3240315cfb40934258947e4ae8ab3a15ad42 Mon Sep 17 00:00:00 2001 From: Marta Motyczynska Date: Wed, 4 Sep 2024 13:54:24 +0200 Subject: [PATCH 6/8] Revert "Add global license key to manual and automated tests." This reverts commit e0775b7c213e68ed0eef9f007da1209f93a77757. --- .../lib/utils/automated-tests/getwebpackconfig.js | 2 -- .../lib/utils/manual-tests/getwebpackconfig.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/getwebpackconfig.js b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/getwebpackconfig.js index 072943f3e..a15cc5770 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/getwebpackconfig.js +++ b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/getwebpackconfig.js @@ -18,8 +18,6 @@ const TreatWarningsAsErrorsWebpackPlugin = require( './treatwarningsaserrorswebp module.exports = function getWebpackConfigForAutomatedTests( options ) { const definitions = Object.assign( {}, getDefinitionsFromFile( options.identityFile ) ); - definitions[ 'window.CKEDITOR_GLOBAL_LICENSE_KEY' ] = JSON.stringify( 'GPL' ); - const config = { mode: 'development', diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/getwebpackconfig.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/getwebpackconfig.js index 28b6c0601..4dbab390b 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/getwebpackconfig.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/getwebpackconfig.js @@ -29,8 +29,6 @@ const getDefinitionsFromFile = require( '../getdefinitionsfromfile' ); module.exports = function getWebpackConfigForManualTests( options ) { const definitions = Object.assign( {}, getDefinitionsFromFile( options.identityFile ) ); - definitions[ 'window.CKEDITOR_GLOBAL_LICENSE_KEY' ] = JSON.stringify( 'GPL' ); - const webpackConfig = { mode: 'none', From 0b94cd28b97ab5b1c8b9a5fb12135f821f75f63b Mon Sep 17 00:00:00 2001 From: Marta Motyczynska Date: Wed, 4 Sep 2024 13:54:38 +0200 Subject: [PATCH 7/8] Revert "Revert "Add testing env global variable by default to manual and automated tests."" This reverts commit 9bd4f309d5df5b3fd6de1cb85dd7c3837751f076. --- .../lib/tasks/runautomatedtests.js | 3 +++ .../lib/utils/automated-tests/beforetestsetup.js | 11 +++++++++++ .../lib/utils/manual-tests/compilehtmlfiles.js | 1 + .../lib/utils/manual-tests/copyassets.js | 1 + .../lib/utils/manual-tests/globalsettings.js | 8 ++++++++ .../tests/utils/manual-tests/compilehtmlfiles.js | 5 +++++ 6 files changed, 29 insertions(+) create mode 100644 packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js create mode 100644 packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js diff --git a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js index 41bf1273d..95300d76e 100644 --- a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js +++ b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js @@ -95,6 +95,9 @@ function createEntryFile( globPatterns, production ) { throw new Error( 'Not found files to tests. Specified patterns are invalid.' ); } + // Inject the initialization settings to be executed in the `before` hook such as global variables, etc. + allFiles.unshift( path.join( __dirname, '..', 'utils', 'automated-tests', 'beforetestsetup.js' ).replace( /\\/g, '/' ) ); + // Inject the leak detector root hooks. Need to be split into two parts due to #598. allFiles.splice( 0, 0, path.join( __dirname, '..', 'utils', 'automated-tests', 'leaksdetectorbefore.js' ).replace( /\\/g, '/' ) ); allFiles.push( path.join( __dirname, '..', 'utils', 'automated-tests', 'leaksdetectorafter.js' ).replace( /\\/g, '/' ) ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js new file mode 100644 index 000000000..86a6c93c8 --- /dev/null +++ b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js @@ -0,0 +1,11 @@ +/** + * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. + * For licensing, see LICENSE.md. + */ + +/* global window */ + +// eslint-disable-next-line mocha/no-top-level-hooks +before( function() { + window.CKEDITOR_IS_TEST_ENV = true; +} ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js index cf9cd295c..cc03c60e0 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js @@ -134,6 +134,7 @@ function compileHtmlFile( buildDir, options ) { '' + '' + '' + + '' + `${ languagesToLoad.map( language => { return ``; } ).join( '' ) }` + diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js index 423d661af..18ed547a3 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js @@ -10,6 +10,7 @@ const assets = [ path.join( __dirname, 'togglesidebar.js' ), path.join( __dirname, 'attachinspector.js' ), path.join( __dirname, 'websocket.js' ), + path.join( __dirname, 'globalsettings.js' ), require.resolve( '@ckeditor/ckeditor5-inspector' ) ]; diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js new file mode 100644 index 000000000..d326bdc90 --- /dev/null +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js @@ -0,0 +1,8 @@ +/** + * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. + * For licensing, see LICENSE.md. + */ + +/* global window */ + +window.CKEDITOR_IS_TEST_ENV = true; diff --git a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js index fa34f921b..e1cda2e52 100644 --- a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js @@ -160,6 +160,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' ].join( '\n' ) @@ -207,6 +208,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' + '' + @@ -251,6 +253,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' ].join( '\n' ) @@ -324,6 +327,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' ].join( '\n' ) @@ -404,6 +408,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + + '' + '' + '' ].join( '\n' ) From def11e01a2dbe3dd720c84dcbcf8b583c1ef07ad Mon Sep 17 00:00:00 2001 From: Marta Motyczynska Date: Wed, 4 Sep 2024 13:54:43 +0200 Subject: [PATCH 8/8] Revert "Revert "Pass 'GPL' as global license key in tests (automated & manual)."" This reverts commit 0092f828ddaea136f5d33481dd3f811b747c7c0e. --- .../ckeditor5-dev-tests/lib/tasks/runautomatedtests.js | 4 ++-- .../{beforetestsetup.js => licensekeybefore.js} | 2 +- .../lib/utils/manual-tests/compilehtmlfiles.js | 2 +- .../lib/utils/manual-tests/copyassets.js | 2 +- .../{globalsettings.js => globallicensekey.js} | 2 +- .../tests/utils/manual-tests/compilehtmlfiles.js | 10 +++++----- 6 files changed, 11 insertions(+), 11 deletions(-) rename packages/ckeditor5-dev-tests/lib/utils/automated-tests/{beforetestsetup.js => licensekeybefore.js} (83%) rename packages/ckeditor5-dev-tests/lib/utils/manual-tests/{globalsettings.js => globallicensekey.js} (77%) diff --git a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js index 95300d76e..055f52c9c 100644 --- a/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js +++ b/packages/ckeditor5-dev-tests/lib/tasks/runautomatedtests.js @@ -95,8 +95,8 @@ function createEntryFile( globPatterns, production ) { throw new Error( 'Not found files to tests. Specified patterns are invalid.' ); } - // Inject the initialization settings to be executed in the `before` hook such as global variables, etc. - allFiles.unshift( path.join( __dirname, '..', 'utils', 'automated-tests', 'beforetestsetup.js' ).replace( /\\/g, '/' ) ); + // Set global license key in the `before` hook. + allFiles.unshift( path.join( __dirname, '..', 'utils', 'automated-tests', 'licensekeybefore.js' ).replace( /\\/g, '/' ) ); // Inject the leak detector root hooks. Need to be split into two parts due to #598. allFiles.splice( 0, 0, path.join( __dirname, '..', 'utils', 'automated-tests', 'leaksdetectorbefore.js' ).replace( /\\/g, '/' ) ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/licensekeybefore.js similarity index 83% rename from packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js rename to packages/ckeditor5-dev-tests/lib/utils/automated-tests/licensekeybefore.js index 86a6c93c8..6fec56bcd 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/automated-tests/beforetestsetup.js +++ b/packages/ckeditor5-dev-tests/lib/utils/automated-tests/licensekeybefore.js @@ -7,5 +7,5 @@ // eslint-disable-next-line mocha/no-top-level-hooks before( function() { - window.CKEDITOR_IS_TEST_ENV = true; + window.CKEDITOR_GLOBAL_LICENSE_KEY = 'GPL'; } ); diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js index cc03c60e0..796d41fed 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/compilehtmlfiles.js @@ -134,7 +134,7 @@ function compileHtmlFile( buildDir, options ) { '' + '' + '' + - '' + + '' + `${ languagesToLoad.map( language => { return ``; } ).join( '' ) }` + diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js index 18ed547a3..36c583200 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/copyassets.js @@ -10,7 +10,7 @@ const assets = [ path.join( __dirname, 'togglesidebar.js' ), path.join( __dirname, 'attachinspector.js' ), path.join( __dirname, 'websocket.js' ), - path.join( __dirname, 'globalsettings.js' ), + path.join( __dirname, 'globallicensekey.js' ), require.resolve( '@ckeditor/ckeditor5-inspector' ) ]; diff --git a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globallicensekey.js similarity index 77% rename from packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js rename to packages/ckeditor5-dev-tests/lib/utils/manual-tests/globallicensekey.js index d326bdc90..2b5a50de2 100644 --- a/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globalsettings.js +++ b/packages/ckeditor5-dev-tests/lib/utils/manual-tests/globallicensekey.js @@ -5,4 +5,4 @@ /* global window */ -window.CKEDITOR_IS_TEST_ENV = true; +window.CKEDITOR_GLOBAL_LICENSE_KEY = 'GPL'; diff --git a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js index e1cda2e52..e94a529da 100644 --- a/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js +++ b/packages/ckeditor5-dev-tests/tests/utils/manual-tests/compilehtmlfiles.js @@ -160,7 +160,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) @@ -208,7 +208,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' + '' + @@ -253,7 +253,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) @@ -327,7 +327,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' ) @@ -408,7 +408,7 @@ describe( 'compileHtmlFiles', () => { '' + '' + '' + - '' + + '' + '' + '' ].join( '\n' )