Last active
August 3, 2021 11:14
-
-
Save desaijay315/a0afb42fc53581100bff975bff9b9cce to your computer and use it in GitHub Desktop.
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
it.only('Cowin State Chooser', function () { | |
cy.intercept('GET', '**/location/districts/2').as('Location'); | |
cy.visit('https://www.cowin.gov.in/home'); | |
cy.xpath("//div[text()='Search by District']") | |
.scrollIntoView({ offset: { top: -200, left: 0 }, easing: 'linear', duration: 1000, }) | |
.should('be.visible').click(); | |
cy.xpath("//mat-select[@formcontrolname='state_id']//div[contains(@class,'mat-select-arrow-wrapper')]") | |
.should('be.visible').click(); | |
cy.get("mat-option[id='mat-option-1']").should('be.visible').click(); | |
cy.wait("@Location"); | |
cy.get("@Location").then(xhr => { | |
expect(xhr.response.statusCode).to.equal(200); | |
this.name = xhr.response.body.districts[0].district_name; | |
cy.xpath("//mat-select[@formcontrolname='district_id']//div[contains(@class,'mat-select-arrow-wrapper')]") | |
.should('be.visible').click(); | |
cy.xpath(`//span[normalize-space()='${this.name}']/..`).should('be.visible').click(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment