qe-fe-automation
Version:
FE test automation framework using cypress
86 lines (76 loc) • 2.58 kB
text/typescript
import { LoginPage } from '@admin-lib/index';
import { Utility } from '@utility-lib/index';
import { PaymentMethods } from '@profile-lib/index';
import { Provider_Type, User_Type } from '@support-onboard/index';
import { paymentMethodData } from '@fixtures/payment-method/payment-method-data';
import { stagingUsers } from '@fixtures/staging-users';
const authUserPassword = Cypress.env('newUser').NEW_USER_PASSWORD;
describe('Commerce: Profile:Payment methods', () => {
beforeEach(() => {
LoginPage.createNewCompanyAndLoginWithUserByType({
providers: [Provider_Type.EXPEDIA_FLIGHT, Provider_Type.ALL_CAR],
users: [User_Type.TRAVELER]
});
Utility.visitSearchPage();
PaymentMethods.visitPage();
});
it(
'C422825 C422824 C127186 C127252: Should be able to add, edit, and delete a personal card',
{ tags: ['@tier1'] },
() => {
// Add a Personal card
PaymentMethods.addCard('addpersonalCardButton');
PaymentMethods.checkIfCardShould('be.visible', 0, paymentMethodData.nickname);
// Edit a Personal card
PaymentMethods.editCard(1);
PaymentMethods.checkIfCardShould(
'be.visible',
0,
paymentMethodData.creditCard._fullName
);
// Delete a Personal card
PaymentMethods.deletePaymentMethod(1);
PaymentMethods.checkIfCardShould(
'not.exist',
0,
paymentMethodData.creditCard._fullName
);
}
);
it(
'C422823: As a traveler. I can add a company provided card to profile',
{ tags: ['@tier1'] },
() => {
// Add a Corporate card
PaymentMethods.addCard('addCorporateCardButton');
PaymentMethods.checkIfCardShould('be.visible', 1, paymentMethodData.nickname);
// Edit a Corporate card
PaymentMethods.editCard(1);
PaymentMethods.checkIfCardShould(
'be.visible',
1,
paymentMethodData.creditCard._fullName
);
// Delete a Corporate card
PaymentMethods.deletePaymentMethod(1);
PaymentMethods.checkIfCardShould(
'not.exist',
1,
paymentMethodData.creditCard._fullName
);
}
);
});
describe('Profile:Payment methods', () => {
it(
'C127187 C127253: Verify company corporate cards are displayed',
{ tags: ['@tier2'] },
() => {
LoginPage.visitTALoginPage();
LoginPage.loginWithCredentials(stagingUsers.auth0Login.email, authUserPassword);
PaymentMethods.waitForAnnouncement();
PaymentMethods.visitPage();
PaymentMethods.verifyCompanyCard();
}
);
});