Skip to content

Commit

Permalink
Auto Upgradation and Premium Tatkal
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamguys committed Apr 17, 2024
1 parent 60d4b2f commit 07a4204
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
24 changes: 22 additions & 2 deletions cypress/e2e/irctc.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

let username = Cypress.env('USERNAME')
let password = Cypress.env('PASSWORD')
import { PASSENGER_DETAILS, SOURCE_STATION, DESTINATION_STATION, TRAIN_NO, TRAIN_COACH, TRAVEL_DATE, TATKAL, BOARDING_STATION, UPI_ID_CONFIG } from '../fixtures/passenger_data.json'
import { PASSENGER_DETAILS, SOURCE_STATION, DESTINATION_STATION, TRAIN_NO, TRAIN_COACH, TRAVEL_DATE, TATKAL, PREMIUM_TATKAL, BOARDING_STATION, UPI_ID_CONFIG } from '../fixtures/passenger_data.json'

Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
Expand All @@ -13,6 +13,11 @@ Cypress.on('uncaught:exception', (err, runnable) => {
describe('IRCTC TATKAL BOOKING', () => {
it('Tatkal Booking Begins......', () => {
// Catching Load Event Exception..
if (TATKAL && PREMIUM_TATKAL) {
expect(false, 'Make Sure Either TATKAL or PREMIUM TATKAL is True. Not BOTH').to.be.true; // Ensure at least one variable is true (or both are false)

}

cy.clearCookies()
cy.clearLocalStorage()
cy.viewport(1478, 1056)
Expand Down Expand Up @@ -55,13 +60,20 @@ describe('IRCTC TATKAL BOOKING', () => {
cy.get('.ui-calendar').type(TRAVEL_DATE)



// TATKAL or NORMAL BOOKING
if (TATKAL) {
cy.get('#journeyQuota > .ui-dropdown').click()
cy.get(':nth-child(6) > .ui-dropdown-item').click()

}

if (PREMIUM_TATKAL) {
cy.get('#journeyQuota > .ui-dropdown').click()
cy.get(':nth-child(7) > .ui-dropdown-item').click()

}


// search button
cy.get('.col-md-3 > .search_btn').click()
Expand Down Expand Up @@ -185,17 +197,25 @@ describe('IRCTC TATKAL BOOKING', () => {



// For Selecting "Book only if confirm berths are allotted.""

// For Selecting "Book only if confirm berths are allotted."" as well as Auto Upgradation
cy.get('body').then((el) => {

if (el[0].innerText.includes('Book only if confirm berths are allotted')) {
cy.get(':nth-child(2) > .css-label_c').click()

}
if (el[0].innerText.includes('Consider for Auto Upgradation.')) {
cy.contains('Consider for Auto Upgradation.').click()

}
})






// Choosing UPI As Payment Option while filling passenger details
cy.get('#\\32 > .ui-radiobutton > .ui-radiobutton-box').click()

Expand Down
11 changes: 6 additions & 5 deletions cypress/fixtures/passenger_data.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"TRAIN_NO": "18464",
"TRAIN_COACH": "2A",
"TRAVEL_DATE": "07/05/2024",
"SOURCE_STATION": "DHNE",
"TRAIN_NO": "12559",
"TRAIN_COACH": "SL",
"TRAVEL_DATE": "18/04/2024",
"SOURCE_STATION": "BSBS",
"BOARDING_STATION": null,
"DESTINATION_STATION": "BBS",
"DESTINATION_STATION": "NDLS",
"TATKAL": false,
"PREMIUM_TATKAL": true,
"UPI_ID_CONFIG": "",
"PASSENGER_DETAILS": [
{
Expand Down

0 comments on commit 07a4204

Please sign in to comment.