mercredi 13 mars 2019

Why does the cypress recording take too much time?

I'm trying ton record my Test. There you can see below the whole test I'm trying to record. I only used once "It" because this is the only way i won't get kicked out of my session while testing, i tried to user a couples of "it" in my code but is did'nt work out, the page redirected me to the log in area after i selected one prodct ("ZBI Wohnwert") and tried to submit with a button for continuing to the next page.

describe('Investment in AIF ZBI Wohnwert 1 Happy Path', function () {

    before(function () {
        cy.clearLocalStorage();
        cy.clearCookies();

    });


    it('Goes  through whole Investment Process', function () {
        cy.visit('https://capitalpioneers.de')
        cy.contains('Login').click();
        cy.get('#email.form-control')
            .type(LogConst.TestUserCostumer.usercos);
        cy.get('#password.form-control')
            .type(LogConst.TestUserCostumer.usercospass);
        cy.contains('Anmelden').click();
        cy.url()
            .should('include', '/investor');
        cy.contains('Produkt').click();
        cy.url()
            .should('include', '/produkte');
        cy.contains('ZBI WohnWert1').click();
        cy.get('.input-range.js-inv-calc-input-sum-range.js-input-range[type=range]')
            .invoke('val', 50000)
            .trigger('change');
        cy.get('#ga-btn-invest-now-product-detail-zbi-wohnwert1-aif').click();
        cy.contains('Fondsprospekt').click();
        cy.contains('Wesentlichen Anlegerinformationen').click();
        cy.get('#pre_check_inGermany').click({force: true});
        cy.get('#pre_check_readDocument1').click({force: true});
        cy.get('#pre_check_readDocument2').click({force: true});


        //PERSÖNLICHE ANGABEN///
        cy.get('form.js-pre-check-form.js-ajax-form').submit().wait(3000);
        cy.get('form > .form-group > #user_profile_sex > .radio:nth-child(2) > .required').click();
        cy.get('form > .form-group > #user_profile_sex > .radio > #user_profile_sex_1').click({force: true});

        cy.get('.form-group > .select2 > .selection > .select2-selection > #select2-user_profile_title-container').click();
        cy.get('ul.select2-results__options');
        cy.get('li.select2-results__option').first().click();

        cy.get('.row > .col-sm-7 > form > .form-group > #user_profile_firstname').click();
        cy.get('.row > .col-sm-7 > form > .form-group > #user_profile_firstname').clear().type('Test User Name');
        cy.get('.row > .col-sm-7 > form > .form-group > #user_profile_lastname').clear().type('Test User Lastname');
        cy.get('.row > .col-sm-7 > form > .form-group > #user_profile_birthname').clear().type('Test Cypress');

        cy.get('.select-inline__select > .select2 > .selection > .select2-selection > #select2-user_profile_birthday_day-container').click();
        cy.get('input.select2-search__field').type('01');
        cy.get('.select-inline__select > .select2 > .selection > .select2-selection > #select2-user_profile_birthday_month-container').click();
        cy.get('input.select2-search__field').type('01');
        cy.get('.select-inline__select > .select2 > .selection > .select2-selection > #select2-user_profile_birthday_year-container').click();
        cy.get('input.select2-search__field').type('1990');
        cy.get('#user_profile_birthplace').click().clear().type('Musterstadt');
        cy.get('#select2-user_profile_countryOfBirth-container').click();
        cy.get('input.select2-search__field').type('Deutschland');
        cy.get('li.select2-results__option').click();
        cy.get('#user_profile_mobile').click().clear().type('01234569');

        //ANSCHRIFT UND WEITERE ANGABEN//
        cy.get('#user_profile_street').click().clear().type('Musterstraße');
        cy.get('#user_profile_streetNumber').click().clear().type('10000');
        cy.get('#user_profile_zipcode').click().clear().type('55555')
        cy.get('#user_profile_city').click().clear().type('Musterstadt Aktuell');
        cy.get('#select2-user_profile_country-container').click();
        cy.get('#select2-user_profile_country-results').contains('Deutschland').click();

        cy.get('.form-group > .select2 > .selection > .select2-selection > #select2-user_profile_occupation-container').click()
        cy.get('ul.select2-results__options');//.eq('3').click();
        cy.get('li.select2-results__option').eq('2').should('contain', 'Angestellter').click();

        //BANK DATEN//
        cy.get('.row > .col-sm-7 > form > .form-group > #user_profile_iban').click().clear().type(LogConst.TestBankData.UserIBAN);
        cy.get('.row > .col-sm-7 > form > .form-group > #user_profile_bic').click().clear().type(LogConst.TestBankData.UserBIC);
        cy.get('.row > .col-sm-7 > form > .form-group > #user_profile_bankname').click().clear().type(LogConst.TestBankData.UserBancName);


        ///PERSONALAUSWEIS ODER REISEPASS

       cy.get('form > .form-group > #user_profile_idCardType > .radio:nth-child(1) > .required').click();
       cy.get('.row > .col-sm-7 > form > .form-group > #user_profile_idCardNumber').click().clear().type(LogConst.TestUserIdent.IDCardNumber);
       cy.get(' #select2-user_profile_idCardValidUntil_day-container').click();
       cy.get('input.select2-search__field').type('01');
       cy.get('#select2-user_profile_idCardValidUntil_month-container').click();
       cy.get('input.select2-search__field').type('01');
       cy.get('#select2-user_profile_idCardValidUntil_year-container').click();
       cy.get('input.select2-search__field').type('2027');
       cy.get('#select2-user_profile_idCardIssueDate_day-container').click();
       cy.get('input.select2-search__field').type('02');
       cy.get('#select2-user_profile_idCardIssueDate_month-container').click();
       cy.get('input.select2-search__field').type('02');
       cy.get('#select2-user_profile_idCardIssueDate_year-container').click();
       cy.get('input.select2-search__field').type('2016');
       cy.get('#user_profile_idCardIssuer').click().clear().type('Stadt der Musterbehörde');
       cy.get('#select2-user_profile_nationality-container').click();
       cy.get('ul.select2-results__options');
       cy.get('li.select2-results__option').first().click();

        //STEUERDATEN
       cy.get('#user_profile_financialOffice').click().clear().type('Muster Finanzamt');
       cy.get('#user_profile_taxId').click().clear().type(LogConst.TestTaxData.UserTaxID);
       cy.get('#user_profile_taxNumber').click().clear().type(LogConst.TestTaxData.UserTaxNumber);
       cy.get('.button.button.button--yellow.form__submit').click();

       //AGM Seite1

       //Angaben zu Ihrer Person
       cy.get('#select2-user_reasonableness_part1_highestEducation-container').click();
       cy.get('ul.select2-results__options');
       cy.get('li.select2-results__option').eq('1').should('contain', 'Hochschulabschluss').click();
       cy.get('#select2-user_reasonableness_part1_occupationType-container').click();
       cy.get('ul.select2-results__options');
       cy.get('li.select2-results__option').eq('2').should('contain', 'Kaufmännische(r) Angestellte(r)').click();


       cy.get('#select2-user_reasonableness_part1_pastOccupationType-container').click();
       cy.get('#select2-user_reasonableness_part1_pastOccupationType-results');
       cy.get('li.select2-results__option').eq('4').should('contain', 'sonstige Tätigkeiten').click();
      //Ihre Kenntnisse und Erfahrungen
       cy.get('#select2-user_reasonableness_part1_experienceInvestingAif-container').click();
       cy.get('ul.select2-results__options');
       cy.get('li.select2-results__option').eq('2').should('contain', '1 bis 5').click();

       cy.get('#select2-user_reasonableness_part1_experiencePropertyValuesAif-container').click();
       cy.get('ul.select2-results__options');
       cy.get('li.select2-results__option').eq('2').should('contain', '1 - 3 Transaktionen in den letzten 3 Jahren').click();
       cy.get('.button.button--yellow.form__submit').click().wait(3000);
       cy.get('a.button.button--yellow.form__submit').click();

       //GWG Seite
        //GWG

       cy.get('#user_moneylaundering_confirmation1').click({force:true});
       cy.get('#user_moneylaundering_confirmation2').click({force:true});
       cy.get('#user_moneylaundering_confirmation3').click({force:true});

       //PEP Person
       cy.get('#user_moneylaundering_moneyLaunderingPoliticalPerson_0').click({force:true});
      // cy.get('.required control-label--text').click({force:true});
       cy.get('#user_moneylaundering_moneyLaunderingGermany_0').click({force:true});
      // cy.get('.required control-label--text').click({force:true});;
       cy.get('#user_moneylaundering_moneyLaunderingAmerican_1').click({force:true});

       cy.get('.button.button--yellow.form__submit').click();

       cy.get('.input-range.input-range--light.js-inv-calc-input-sum-range.js-input-range[type=range]')
            .invoke('val', 50000)
            .trigger('change');
       cy.get('.button.button--yellow.form__submit').click();

       cy.get('#summary_noConsultationConfirmation').click({force:true});
       cy.get('#summary_allowInvestmentDataSharing').click({force:true});
       cy.get('#summary_readDocumentsConfirmation').click({force:true});
       cy.contains('Verkaufsprospekt').click();
       cy.contains('Datenschutzerklärung').click();
       cy.contains('Wesentliche Anlegerinformationen').click();
       cy.contains('Gesetzlichen Pflichtangaben').click();
       cy.contains('Allgemeinen Geschäftsbedingungen').click();
       cy.contains('Prospektnachtrag Nr. 1 vom 01.12.2016').click();
       cy.contains('Prospektnachtrag Nr. 2 vom 01.12.2016').click();
       cy.contains('Investitionsinformation').click();
       cy.contains('Prospektnachtrag Nr. 3 vom 01.12.2016').click();
     // cy.contains('Kaufauftrag ansehen').click();
       // cy.get('#ga-btn-preview-contract-zbi-wohnwert1-aif').click();
       cy.get('#summary_readDraftContractConfirmation').click({force:true});
       cy.get('#summary_signedName').click().clear().type('Test User Name Lastname');
       cy.get('#summary_signedCity').click().clear().type('Musterstadt');
       cy.get('#ga-btn-buy-now-zbi-wohnwert1-aif').click();
       //cy.get('a.button.button--yellow').should('contain', 'Postident').click();
       //cy.contains('1. PostIdent Coupon herunterladen').click();
       cy.contains('Zum Investment').click();
       cy.get('.a.navigation-user.dropdown-toggle').click();
       cy.get('ul.dropdown-menu.navigation__dropdown__nav.navigation__nav--mobile.underline-links.underline-links--white');
       cy.get('li').eq('7').should('contain', 'Logout');



    })
});

I know it looks horrible, but I'm not familiar with testing or JavaScript and I don't think I'll ever be, but I need this for my bachelor thesis. So do you have any Idea why it takes so long when i try to record this test? and does any of you have any idea how to solve this? I don't get it because i don't get any error messages

Aucun commentaire:

Enregistrer un commentaire