From b2e522ab215b92e0fd8d744e4c9caac05273901d Mon Sep 17 00:00:00 2001 From: Stanislav Zaycev <102649815+KrollikRoddzer@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:01:17 +0300 Subject: [PATCH] refactor(demo-integrations): rewriting e2e tests to CT(multi-character-prefix tests) (#1130) --- .../multi-character-prefix.cy.ts | 26 +++++++++++++++++++ .../kit/number/number-prefix-postfix.cy.ts | 20 -------------- 2 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 projects/demo-integrations/src/tests/component-testing/multi-character-prefix/multi-character-prefix.cy.ts diff --git a/projects/demo-integrations/src/tests/component-testing/multi-character-prefix/multi-character-prefix.cy.ts b/projects/demo-integrations/src/tests/component-testing/multi-character-prefix/multi-character-prefix.cy.ts new file mode 100644 index 000000000..cd5b18f1b --- /dev/null +++ b/projects/demo-integrations/src/tests/component-testing/multi-character-prefix/multi-character-prefix.cy.ts @@ -0,0 +1,26 @@ +import {maskitoNumberOptionsGenerator} from '@maskito/kit'; + +import {TestInput} from '../utils'; + +describe('multi-character prefix "EUR " (no initial value & no caret guard)', () => { + beforeEach(() => { + cy.mount(TestInput, { + componentProperties: { + maskitoOptions: maskitoNumberOptionsGenerator({ + prefix: 'EUR ', + }), + }, + }); + cy.get('input').focus().should('have.value', '').as('input'); + }); + + ['E', 'U', 'R'].forEach(char => { + it(`Empty input => Type "${char} => Textfield's value is "EUR "`, () => { + cy.get('@input') + .type(char) + .should('have.value', 'EUR ') + .should('have.prop', 'selectionStart', 'EUR '.length) + .should('have.prop', 'selectionEnd', 'EUR '.length); + }); + }); +}); diff --git a/projects/demo-integrations/src/tests/kit/number/number-prefix-postfix.cy.ts b/projects/demo-integrations/src/tests/kit/number/number-prefix-postfix.cy.ts index fad27a6ad..c8ce91a8f 100644 --- a/projects/demo-integrations/src/tests/kit/number/number-prefix-postfix.cy.ts +++ b/projects/demo-integrations/src/tests/kit/number/number-prefix-postfix.cy.ts @@ -313,26 +313,6 @@ describe('Number | Prefix & Postfix', () => { }); }); - describe('multi-character prefix "EUR " (no initial value & no caret guard)', () => { - beforeEach(() => { - cy.visit(DemoPath.Cypress); - cy.get('#multi-character-prefix input') - .focus() - .should('have.value', '') - .as('input'); - }); - - ['E', 'U', 'R'].forEach(char => { - it(`Empty input => Type "${char} => Textfield's value is "EUR "`, () => { - cy.get('@input') - .type(char) - .should('have.value', 'EUR ') - .should('have.prop', 'selectionStart', 'EUR '.length) - .should('have.prop', 'selectionEnd', 'EUR '.length); - }); - }); - }); - describe('prefix ends with the same character as postfix starts', () => { const prefix = 'lbs.​'; // padded with zero-width space