Last active
August 12, 2022 06:45
-
-
Save arifmasood/5a17eca4701b7d7baf77eb074e0b3777 to your computer and use it in GitHub Desktop.
Omar-Ysf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
some questions for. | |
// -------------------- usage of {force: true} || why, when? --------------------// | |
//pick first item in the list we need to do force click since cypress see it as hiding in first load for the page | |
cy.get('[data-testid="AutoCompleteResultItem0"]').click({ force: true }); | |
// -------------------- usage of .within(()=> || why, what it means ------------------// | |
// we go to the tab where it hvae the saerche | |
cy.get('.tab-content').eq('0') | |
.within(()=>{ | |
// get the spcfec div tag and check it is for the return date | |
// check the next assertions test to prove the below is valid | |
cy.get('div').eq('32') | |
.should('be.visible') | |
.and('have.attr', 'data-testid', 'FlightSearchBox__ToDateButton') | |
} | |
// ----------- usage two attributes together & dollar sign $ || why, what it means?? ---------------// | |
// get the hotel prices | |
cy.get('[data-testid^=HotelSearchResult][data-testid$=PriceLabel]') //// <<< --- **** | |
.find('.Price__Value') | |
.each(($price, index, $listofprices) => { | |
// first Hotel price | |
let currntprice = $price.text(); | |
// increment the counter | |
counterforlist++; | |
// if statument to know when the list ends | |
if (counterforlist < $listofprices.length ) { | |
// get the next hotel price in the list | |
cy.get('[data-testid^=HotelSearchResult][data-testid$=PriceLabel]') | |
.find('.Price__Value').eq(index + 1) | |
.then((cyprice) => { | |
// next hotel price | |
let cygetprice = cyprice.text() | |
// comper the list to check thit all the list is sorted by the lowest | |
expect(parseFloat(currntprice)).to.be.lte(parseFloat(cygetprice)) | |
}) | |
} | |
// ----------------- usage of have.attr || what does it mean --------------------// | |
.should('have.attr','class','sc-ecFaGM immBNO'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment