mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
wip dynamically switching gateways
This commit is contained in:
parent
eacbc138b1
commit
1e480c5c64
@ -1,5 +1,10 @@
|
||||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes",
|
||||
|
||||
"first": "VolejRejNm",
|
||||
"second": "Wpmbk5ezJn",
|
||||
|
||||
"url": "http://localhost:8000"
|
||||
}
|
@ -1,5 +1,10 @@
|
||||
import { second } from '../../fixtures/example.json';
|
||||
|
||||
describe('Checkout Credit Card Payments', () => {
|
||||
beforeEach(() => cy.clientLogin());
|
||||
beforeEach(() => {
|
||||
// cy.useGateway(second);
|
||||
cy.clientLogin();
|
||||
});
|
||||
|
||||
it('should be able to complete payment using checkout credit card', () => {
|
||||
cy.visit('/client/invoices');
|
||||
|
@ -1,5 +1,10 @@
|
||||
import { first } from '../../fixtures/example.json'
|
||||
|
||||
describe('Stripe Credit Card Payments', () => {
|
||||
beforeEach(() => cy.clientLogin());
|
||||
beforeEach(() => {
|
||||
// cy.useGateway(first);
|
||||
cy.clientLogin();
|
||||
});
|
||||
|
||||
it('should be able to add credit card using Stripe', () => {
|
||||
cy.visit('/client/payment_methods');
|
||||
|
32
cypress/support/commands.js
vendored
32
cypress/support/commands.js
vendored
@ -23,6 +23,8 @@
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||
const axios = require('axios');
|
||||
const fixture = require('../fixtures/example.json');
|
||||
|
||||
Cypress.Commands.add('clientLogin', () => {
|
||||
cy.visit('/client/login');
|
||||
@ -74,3 +76,33 @@ Cypress.Commands.add('getWithinIframe', (targetElement) =>
|
||||
.its('document')
|
||||
.getInDocument(targetElement)
|
||||
);
|
||||
|
||||
Cypress.Commands.add('useGateway', (gateway) => {
|
||||
let body = {
|
||||
settings: {
|
||||
entity: 'App\\Models\\Client',
|
||||
industry_id: '',
|
||||
size_id: '',
|
||||
currency_id: '1',
|
||||
company_gateway_ids: gateway,
|
||||
},
|
||||
};
|
||||
|
||||
let options = {
|
||||
headers: {
|
||||
'X-Api-Secret': 'superdoopersecrethere',
|
||||
'X-Api-Token':
|
||||
'S0x8behDk8HG8PI0i8RXdpf2AVud5b993pE8vata7xmm4RgW6u3NeGC8ibWIUjZv',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
};
|
||||
|
||||
axios
|
||||
.put(
|
||||
`http://localhost:8000/api/v1/clients/${fixture.first}`,
|
||||
body,
|
||||
options
|
||||
)
|
||||
.then((response) => console.log(response))
|
||||
.catch((error) => console.log(error.message));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user