diff --git a/packages/mindplot/cypress/support/commands.js b/packages/mindplot/cypress/support/commands.js index bcb624c8..85cef3a6 100644 --- a/packages/mindplot/cypress/support/commands.js +++ b/packages/mindplot/cypress/support/commands.js @@ -3,7 +3,10 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; // make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set // otherwise it calls a noop if (Cypress.env('imageSnaphots')) { - addMatchImageSnapshotCommand(); + addMatchImageSnapshotCommand({ + failureThreshold: 0.001, + failureThresholdType: 'percent', + }); } else { Cypress.Commands.add( 'matchImageSnapshot', diff --git a/packages/web2d/cypress/support/commands.js b/packages/web2d/cypress/support/commands.js index cf3e92fd..77d192ad 100644 --- a/packages/web2d/cypress/support/commands.js +++ b/packages/web2d/cypress/support/commands.js @@ -3,7 +3,10 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; // make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set // otherwise it calls a noop if (Cypress.env('imageSnaphots')) { - addMatchImageSnapshotCommand(); + addMatchImageSnapshotCommand({ + failureThreshold: 0.001, + failureThresholdType: 'percent', + }); } else { Cypress.Commands.add( 'matchImageSnapshot', diff --git a/packages/web2d/src/components/peer/svg/Font.js b/packages/web2d/src/components/peer/svg/Font.js index a9ee7ca2..31ee1740 100644 --- a/packages/web2d/src/components/peer/svg/Font.js +++ b/packages/web2d/src/components/peer/svg/Font.js @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { $defined } from '@wisemapping/core-js'; +import { $assert, $defined } from '@wisemapping/core-js'; class Font { constructor() { @@ -26,7 +26,7 @@ class Font { init(args) { if ($defined(args.size)) { - this._size = parseInt(args.size, 10); + this._size = Number.parseInt(args.size, 10); } if ($defined(args.style)) { this._style = args.style; @@ -68,7 +68,9 @@ class Font { return this._weight; } - setSize(size) { + setSize(value) { + const size = Number.parseInt(value, 10); + $assert(!Number.isFinite(size), 'size must be a valid integer'); this._size = size; } diff --git a/packages/webapp/cypress/support/commands.ts b/packages/webapp/cypress/support/commands.ts index 5a2a7981..4f1ceb2d 100644 --- a/packages/webapp/cypress/support/commands.ts +++ b/packages/webapp/cypress/support/commands.ts @@ -1,12 +1,13 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; import '@testing-library/cypress/add-commands'; -addMatchImageSnapshotCommand(); - // make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set // otherwise it calls a noop if (Cypress.env('imageSnaphots')) { - addMatchImageSnapshotCommand(); + addMatchImageSnapshotCommand({ + failureThreshold: 0.001, + failureThresholdType: 'percent', + }); } else { Cypress.Commands.add( 'matchImageSnapshot',