|
| 1 | +/// <reference types="cypress" /> |
| 2 | + |
| 3 | +'use strict'; |
| 4 | + |
| 5 | +import { TestMethods } from '../support/phoenix_test_methods.js'; |
| 6 | + |
| 7 | +describe('paylike plugin full test', () => { |
| 8 | + /** |
| 9 | + * Login into admin and frontend to store cookies. |
| 10 | + */ |
| 11 | + before(() => { |
| 12 | + cy.phoenixGoToPage(TestMethods.StoreUrl + '/login.php'); |
| 13 | + TestMethods.loginIntoClientAccount(); |
| 14 | + cy.phoenixGoToPage(Cypress.env('ENV_PHOENIX_ADMIN_URL')); |
| 15 | + TestMethods.loginIntoAdminBackend(); |
| 16 | + }); |
| 17 | + |
| 18 | + /** |
| 19 | + * Run this on every test case bellow |
| 20 | + * - preserve cookies between tests |
| 21 | + */ |
| 22 | + beforeEach(() => { |
| 23 | + Cypress.Cookies.defaults({ |
| 24 | + preserve: (cookie) => { |
| 25 | + return true; |
| 26 | + } |
| 27 | + }); |
| 28 | + }); |
| 29 | + |
| 30 | + let captureModes = ['Instant', 'Delayed']; |
| 31 | + let currenciesToTest = Cypress.env('ENV_CURRENCIES_TO_TEST'); |
| 32 | + |
| 33 | + context(`make payments in "${captureModes[0]}" mode`, () => { |
| 34 | + /** Modify Paylike settings. */ |
| 35 | + it(`change Paylike capture mode to "${captureModes[0]}"`, () => { |
| 36 | + TestMethods.changePaylikeCaptureMode(captureModes[0]); |
| 37 | + }); |
| 38 | + |
| 39 | + /** Make Instant payments */ |
| 40 | + for (var currency of currenciesToTest) { |
| 41 | + TestMethods.payWithSelectedCurrency(currency); |
| 42 | + } |
| 43 | + }); |
| 44 | + |
| 45 | + context(`make payments in "${captureModes[1]}" mode`, () => { |
| 46 | + /** Modify Paylike settings. */ |
| 47 | + it(`change Paylike capture mode to "${captureModes[1]}"`, () => { |
| 48 | + TestMethods.changePaylikeCaptureMode(captureModes[1]); |
| 49 | + }); |
| 50 | + |
| 51 | + for (var currency of currenciesToTest) { |
| 52 | + /** |
| 53 | + * HARDCODED currency |
| 54 | + */ |
| 55 | + if ('USD' == currency || 'RON' == currency) { |
| 56 | + TestMethods.payWithSelectedCurrency(currency); |
| 57 | + } |
| 58 | + } |
| 59 | + }); |
| 60 | +}); // describe |
0 commit comments