Skip to content

Instantly share code, notes, and snippets.

@skarbala
Created September 29, 2022 05:59
Show Gist options
  • Save skarbala/774ac0de85f864d7108a748680311895 to your computer and use it in GitHub Desktop.
Save skarbala/774ac0de85f864d7108a748680311895 to your computer and use it in GitHub Desktop.
sanae_workshop_start
/// <reference types="cypress" />
it('👶 Infant cannot add baggage (UI)', () => {
cy.visit('https://www.kiwi.com/en')
cy.log('**accept cookies modal**')
cy.contains('button', 'Accept').click()
cy.log('**disable booking extension button**')
cy.get('[type="checkbox"]')
.as('checkbox')
.invoke('is', ':checked') // use jQuery $.is(...)
.then((initial) => {
cy.log(`Initial checkbox: **${initial}**`)
if (initial) {
cy.get('@checkbox').uncheck({ force: true })
}
})
cy.log('**enter destination**')
cy.get('[data-test="SearchPlaceField-destination"]')
.find('[data-test="SearchField-input"]')
.type('Tokyo')
cy.get('[data-test="PlacepickerModalOpened-destination"]')
.should('be.visible')
.contains('Tokyo')
.click()
cy.log('**destination chosen**')
cy.get('[data-test="LandingSearchButton"]')
.should('have.text', 'Search')
.click()
cy.log('**select flight**')
cy.get('[data-test="ResultCardWrapper"]', { timeout: 10000 })
.should('be.visible')
.first()
.find('[data-test="BookingButton"]')
.click()
cy.contains('Continue as a guest').click()
cy.log('**check behavior**')
cy.get('[data-test="ReservationPassenger"]', { timeout: 10000 }).should('be.visible').within(() => {
cy.get('[data-test="passenger-category-select"]').select('infant')
cy.get('[data-test=BaggagePickerNewDesign-handBag] > [data-test=BaggagePickerNewDesign-EmptyOption]')
.should('have.text', 'Personal items and cabin baggage are not available for infant passengers.')
cy.get('[data-test="BaggagePickerNewDesign-holdBag"] > [data-test="BaggagePickerNewDesign-EmptyOption"]')
.should('have.text', 'Checked baggage is not available for infant passengers.')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment