How to write test in Cypress for Google translator

Viewed 127

Test-case:

pre-conditions: visit https://translate.google.com/

steps:

  1. Select English language for left side
  2. Select russian language for the right side
  3. Enter "Test" on the left
  4. Validate all UI

Expected Result: UI appears correctly

My veri bad code in cypress:

    beforeEach(() => {
        cy.visit('https://translate.google.com/')  
    });

    it('test', function() {
        /* ==== Generated with Cypress Studio ==== */
        cy.get('.aCQag > .kHGNJd > .zXU7Rb > .EO28P > :nth-child(2) > .VfPpkd-Bz112c-LgbsSe > .VfPpkd-Bz112c-RLmnJb').click();
        cy.get('.aCQag > .kHGNJd > :nth-child(2) > .bvzp8c > .OoYv6d > .pEyuac > .MeCBDd > .vSUSRc > [jsname="rPx1uf"] > .KKjvXb > .Llmcnf').click();
        cy.get('.aCQag > .kHGNJd > .zXU7Rb > .EO28P > :nth-child(5) > .VfPpkd-Bz112c-LgbsSe > .VfPpkd-Bz112c-RLmnJb').click();
        cy.get('.aCQag > .kHGNJd > :nth-child(2) > .bvzp8c > .ykTHSe > .pEyuac > .MeCBDd > .vSUSRc > [jsname="rPx1uf"] > .KKjvXb > .Llmcnf').click();
        cy.get('.er8xn').click();
        cy.get('.Q4iAWc').should('be.visible');
        /* ==== End Cypress Studio ==== */
    });
});

It is not work, because locators on this page changes all the time. How can I make it work?

0 Answers
Related