qe-fe-automation
Version:
FE test automation framework using cypress
44 lines (40 loc) • 1.26 kB
text/typescript
const FeesValidationSelectors = {
bookingFee: '.charge-item__amount'
};
export class TripFeeValidation {
static getAndStoreFeeModelUUID(feeModelName: string) {
cy.getChargeableEntity(feeModelName).then((result) => {
cy.task('putDataInCache', {
key: 'feesModelUuid',
data: result.uuid.toString()
});
cy.task('putDataInCache', {
key: 'feesModelName',
data: result.name.toString()
});
});
}
static getTripFeeUsingFeeModelUUID(emeaFeesTagSet: Array<string>) {
cy.task<string>('getDataFromCache', 'feesModelUuid').then((uuid) => {
cy.getChargeableEntityToFeeModel(uuid).then((result) => {
result.tagSetsFees.filter((element: any) => {
if (JSON.stringify(element.tags) == JSON.stringify(emeaFeesTagSet)) {
cy.task('putDataInCache', {
key: 'tripFee',
data: element.fees[0].amount.amount.toString()
});
}
});
});
});
}
static checkBookingFee() {
cy.task('getDataFromCache', 'fees').then((fees) => {
cy.get(FeesValidationSelectors.bookingFee)
.eq(3)
.should(($el) => {
expect($el.text().trim()).to.equal(`$${fees}`);
});
});
}
}