qe-fe-automation
Version:
FE test automation framework using cypress
57 lines (50 loc) • 1.94 kB
text/typescript
const Promotions = {
promotionContainer: '.home-promotions',
promotionModal: '.home-promotion-modal',
closeModal: '[data-testid="modal-header-close-button"]',
carouselPromoButton: '.ta-button__content',
PromoPill: '.home-promotion-card__button-expand__span',
RewardsButton: '.rewards-button-loyalty'
};
export class Promotion {
static promotionModalShown(): void {
cy.allure().logStep('verify promotions modal shown on personal travel screen');
cy.get(Promotions.promotionModal).should('be.visible');
}
static dismissPromotionModal(): void {
cy.allure().logStep('dismiss promotions modal shown on personal travel screen');
cy.get(Promotions.closeModal).click({ force: true });
}
static promotionPillsShown(): void {
cy.allure().logStep('verify promotions shown on personal travel screen');
cy.get(Promotions.promotionContainer).should('be.visible');
}
static viewAndClosePromotionModal(): void {
Promotion.promotionModalShown();
Promotion.dismissPromotionModal();
}
static claimFlightPromotion(): void {
cy.allure().logStep('claim flight promotion');
cy.get(Promotions.PromoPill).contains('Enter giveaway').click();
cy.get(Promotions.carouselPromoButton).contains(' Enter giveaway ').click();
}
static bookFlightCta(): void {
cy.allure().logStep('verify book personal flight cta');
cy.get(Promotions.carouselPromoButton)
.contains(' Book a personal flight ')
.should('be.visible')
.click();
}
static claimRewardsPromotion(): void {
cy.allure().logStep('claim flight promotion');
cy.get(Promotions.PromoPill).contains('Claim now').click();
cy.get(Promotions.RewardsButton).click();
}
static bookHotelCta(): void {
cy.allure().logStep('verify book personal hotel cta');
cy.get(Promotions.carouselPromoButton)
.contains(' Book a personal hotel ')
.should('be.visible')
.click();
}
}