qe-fe-automation
Version:
FE test automation framework using cypress
155 lines (141 loc) • 5.65 kB
text/typescript
import { LoginPage, AdminPayment } from '@admin-lib/index';
import { Provider_Type, User_Type } from '@support-onboard/index';
import {
paymentMethodData,
cardNumber
} from '@fixtures/payment-method/payment-method-data';
import { stagingUsers } from '@fixtures/staging-users';
import { utilitySelector, Timeouts } from '@utility-lib/index';
import { CommerceApiIntercepts } from '@commerce-shared-lib/api-intercepts';
const { admin } = stagingUsers.admin;
const adminCredentials = Cypress.env('admin').admin.ADMIN_PASSWORD;
// All tests below require split "CM2-3788" to be turned ON in staging
describe.skip('Commerce: Admin- UATP Issuer/airline Auto Identified', () => {
it.skip(
'C377727 C377732: Should auto identify UA issuer/airline using UATP IIN ranges while adding and editing a card',
{ tags: ['@tier1'] },
() => {
const backupCard = paymentMethodData.creditCard.givenName;
const UAcard = paymentMethodData.creditCard.familyName;
const newName = paymentMethodData.nickname;
CommerceApiIntercepts.interceptCommerceApis();
LoginPage.createNewCompanyAndLoginWithUserByType({
providers: [Provider_Type.SABRE_FLIGHT],
users: [User_Type.ADMIN]
});
AdminPayment.visitPage();
AdminPayment.clickAddCard('SETTINGS_ADD_NEW_CARD');
// Add backup card
AdminPayment.enterNickname(backupCard);
AdminPayment.enterCardInfo();
AdminPayment.enterBillingAddressInfo();
AdminPayment.enterCardNumber(cardNumber.amex);
AdminPayment.enterCardCVC('2468');
AdminPayment.clickBottomButton('Save');
// Add UATP UA card
AdminPayment.clickAddCard('SETTINGS_ADD_NEW_CARD');
AdminPayment.enterNickname(UAcard);
AdminPayment.enterCardInfo();
AdminPayment.enterBillingAddressInfo();
AdminPayment.enterCardNumber('101653707146662');
AdminPayment.checkIssuerSupplierName('United Airlines');
AdminPayment.clickBottomButton('Next');
AdminPayment.selectOtherPayment();
AdminPayment.clickDesignateCard();
// Edit UA card
cy.get('app-ta-mat-table')
.contains(utilitySelector.listItemSelector, UAcard)
.parentsUntil(utilitySelector.tableRowSelector)
.parent()
.find(utilitySelector.buttonSelector)
.contains('Edit')
.click();
AdminPayment.enterNickname(newName);
AdminPayment.checkIssuerSupplierName('United Airlines');
AdminPayment.clickBottomButton('Save');
// Delete both cards
AdminPayment.deleteCard(newName);
cy.wait(Timeouts.SHORT_TIMEOUT_3_SEC.timeout);
AdminPayment.deleteCard(backupCard);
}
);
it(
'C377731: Should see error message when adding invalid UATP card',
{ tags: ['@tier1'] },
() => {
LoginPage.createNewCompanyAndLoginWithUserByType({
providers: [Provider_Type.SABRE_FLIGHT],
users: [User_Type.ADMIN]
});
AdminPayment.visitPage();
AdminPayment.clickAddCard('SETTINGS_ADD_NEW_CARD');
AdminPayment.enterCardNumber('123456789123456');
cy.get('mat-error')
.contains(
'Issuer/Airline not identified. Please make sure the card number is correct and try again.'
)
.should('be.visible');
AdminPayment.bottomButtonShould('Next', 'be.disabled');
}
);
it(
'C377729: Should see error message when adding Airplus card and not on adyen split',
{ tags: ['@tier1'] },
() => {
cy.loginWithAuthToken({
email: admin.email,
password: adminCredentials,
isSA: true
});
AdminPayment.visitPage();
AdminPayment.clickAddCard('SETTINGS_ADD_NEW_CARD');
AdminPayment.enterCardNumber('192056789123456');
cy.get('mat-error')
.contains(
'AirPlus is not supported for your company. Please reach out to support.'
)
.should('be.visible');
}
);
it(
'C3798428: Admin, we should not allow to add UATP airline card as a back up card',
{ tags: ['@tier1'] },
() => {
cy.allure().logStep(
`we should not allow to add UATP airline card as a back up card`
);
const UAcard = paymentMethodData.creditCard.familyName;
const Errormessage = paymentMethodData.errormessage;
const backupCard = paymentMethodData.creditCard.givenName;
LoginPage.createNewCompanyAndLoginWithUserByType({
providers: [Provider_Type.SABRE_FLIGHT],
users: [User_Type.ADMIN]
});
AdminPayment.visitPage();
AdminPayment.clickAddCard('SETTINGS_ADD_NEW_CARD');
// Add backup card
AdminPayment.enterNickname(backupCard);
AdminPayment.enterCardInfo();
AdminPayment.enterBillingAddressInfo();
AdminPayment.enterCardNumber(cardNumber.amex);
AdminPayment.enterCardCVC('2468');
AdminPayment.clickBottomButton('Save');
// shouldn't allow UATP as Backup card
AdminPayment.clickAddCard('SETTINGS_ADD_NEW_CARD');
AdminPayment.enterNickname(UAcard);
AdminPayment.enterCardInfo();
AdminPayment.enterBillingAddressInfo();
AdminPayment.enterCardNumber('101653707146662');
AdminPayment.checkIssuerSupplierName('United Airlines');
AdminPayment.clickBottomButton('Next');
AdminPayment.selectOtherPaymentAsAddCard();
AdminPayment.enterNickname(UAcard);
AdminPayment.enterCardInfo();
AdminPayment.enterBillingAddressInfo();
AdminPayment.enterCardNumber('107521458132120');
AdminPayment.enterCardCVC('248');
AdminPayment.selectUseThisCard();
AdminPayment.errorMessage(Errormessage);
}
);
});