|
| 1 | +/// <reference types="cypress" /> |
| 2 | +/// <reference types="@testing-library/cypress" /> |
| 3 | +/// <reference types="@commercetools-frontend/cypress" /> |
| 4 | + |
| 5 | +import { |
| 6 | + entryPointUriPath, |
| 7 | + APPLICATION_BASE_ROUTE, |
| 8 | +} from '../support/constants'; |
| 9 | +beforeEach(() => { |
| 10 | + cy.loginToMerchantCenter({ |
| 11 | + entryPointUriPath, |
| 12 | + initialRoute: APPLICATION_BASE_ROUTE, |
| 13 | + }); |
| 14 | + |
| 15 | + cy.fixture('forward-to').then((response) => { |
| 16 | + cy.intercept('GET', '/proxy/forward-to', { |
| 17 | + statusCode: 200, |
| 18 | + body: response, |
| 19 | + }); |
| 20 | + }); |
| 21 | +}); |
| 22 | + |
| 23 | +describe('Test welcome.cy.ts', () => { |
| 24 | + it('should render method details page', () => { |
| 25 | + const LOCALE = Cypress.env('LOCALE'); |
| 26 | + const paymentMethods = [ |
| 27 | + 'PayPal', |
| 28 | + 'iDEAL Pay in 3 instalments, 0% interest', |
| 29 | + 'iDEAL', |
| 30 | + 'Bancontact', |
| 31 | + 'Blik', |
| 32 | + ]; |
| 33 | + |
| 34 | + cy.findByText(paymentMethods[0]).click(); |
| 35 | + cy.url().should('contain', 'general'); |
| 36 | + |
| 37 | + cy.findByTestId('status-select').should('exist'); |
| 38 | + |
| 39 | + cy.findByTestId(`name-input-${LOCALE}`).should('exist'); |
| 40 | + cy.findByTestId(`description-input-${LOCALE}`).should('exist'); |
| 41 | + cy.findByTestId(`display-order-input`).should('exist'); |
| 42 | + }); |
| 43 | + |
| 44 | + it('should update display order successfully', () => { |
| 45 | + const paymentMethodIds = ['paypal', 'ideal', 'bancontact']; |
| 46 | + |
| 47 | + cy.findByTestId(`display-order-column-${paymentMethodIds[0]}`).click(); |
| 48 | + cy.url().should('contain', 'general'); |
| 49 | + |
| 50 | + cy.findByTestId(`display-order-input`).should('exist'); |
| 51 | + cy.findByTestId(`display-order-input`).clear(); |
| 52 | + cy.findByTestId(`display-order-input`).type('20'); |
| 53 | + cy.findByTestId(`save-button`).click(); |
| 54 | + cy.findByLabelText('Go back').click(); |
| 55 | + cy.findByTestId(`display-order-column-${paymentMethodIds[0]}`).should( |
| 56 | + 'have.text', |
| 57 | + 20 |
| 58 | + ); |
| 59 | + }); |
| 60 | +}); |
0 commit comments