UNPKG

qe-fe-automation

Version:
28 lines (24 loc) 828 B
import { ClientOAuthToken } from '../navanProCommands'; import { HttpRequest } from '../../base'; export function checkSuccessfulCallToImportEndpoint(trip: any): Cypress.Chainable<any> { const callImportEndpoint = (authToken: ClientOAuthToken) => { cy.allure().logStep('Calling import trip endpoint'); return cy.request({ method: HttpRequest.Post, url: '/v1/reedmackay/trips', headers: { Authorization: `${authToken.type} ${authToken.token}` }, retryOnStatusCodeFailure: true, body: trip }); }; return cy .getClientOAuthTokenForReedMackay() .then(callImportEndpoint) .then(({ status, body }) => { expect(status).to.eq(200); expect(body.message).to.eq('Trip imported with success.'); expect(body.userTrips.length).to.gt(0); }); }