Skip to content

Commit

Permalink
Last Transaction Detail Screen Closed and Indexing Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamguys committed Jul 11, 2024
1 parent e80d3d4 commit 9b8ad66
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 12 deletions.
6 changes: 6 additions & 0 deletions cypress/e2e/irctc.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ describe('IRCTC TATKAL BOOKING', () => {
// Submitting captcha block starts........
cy.submitCaptcha().then(() => {

// closing the last transaction details
cy.get('body').then((el) => {
if (el[0].innerText.includes('Your Last Transaction')) {
cy.get('.ui-dialog-footer > .ng-tns-c19-3 > .text-center > .btn').click()
}
})

// from station
cy.get('.ui-autocomplete > .ng-tns-c57-8').should('be.visible').type(SOURCE_STATION, { delay: 600 })
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/passenger_data.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"TRAIN_NO": "12559",
"TRAIN_COACH": "SL",
"TRAVEL_DATE": "18/05/2024",
"TRAVEL_DATE": "18/07/2024",
"SOURCE_STATION": "BSBS",
"BOARDING_STATION": null,
"DESTINATION_STATION": "NDLS",
Expand Down
10 changes: 5 additions & 5 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function performLogin(LOGGED_IN) {
cy.get('.captcha-img').invoke('attr', 'src').then((value) => {
// api call to retrieve captcha value

cy.exec(`python irctc-captcha-solver/app.py "${value}"`).then((result) => {
cy.exec(`python3 irctc-captcha-solver/app.py "${value}"`).then((result) => {
cy.get('#captcha').clear().type(result.stdout).type('{enter}');
// cy.contains('SIGN IN').click()

Expand Down Expand Up @@ -251,8 +251,8 @@ function BOOK_UNTIL_TATKAL_OPENS(div, TRAIN_COACH, TRAVEL_DATE, TRAIN_NO, TATKAL
if (div[0].innerText.includes(TRAIN_NO) && div[0].innerText.includes(TRAIN_COACH)) {

cy.wrap(div).contains(TRAIN_COACH).click()
cy.get(`:nth-child(${index + 1}) > .bull-back > app-train-avl-enq > :nth-child(1) > :nth-child(7) > :nth-child(1)`).contains(formatDate(TRAVEL_DATE)).click()
cy.get(`:nth-child(${index + 1}) > .bull-back > app-train-avl-enq > [style="padding-top: 10px; padding-bottom: 20px;"]`).contains('Book Now').click()
cy.get(`:nth-child(${index + 2}) > .bull-back > app-train-avl-enq > :nth-child(1) > :nth-child(7) > :nth-child(1)`).contains(formatDate(TRAVEL_DATE)).click()
cy.get(`:nth-child(${index + 2}) > .bull-back > app-train-avl-enq > [style="padding-top: 10px; padding-bottom: 20px;"]`).contains('Book Now').click()
BOOK_UNTIL_TATKAL_OPENS(div, TRAIN_COACH, TRAVEL_DATE, TRAIN_NO, TATKAL)

}
Expand Down Expand Up @@ -286,8 +286,8 @@ function BOOK_UNTIL_TATKAL_OPENS(div, TRAIN_COACH, TRAVEL_DATE, TRAIN_NO, TATKAL
if (div[0].innerText.includes(TRAIN_NO) && div[0].innerText.includes(TRAIN_COACH)) {

cy.wrap(div).contains(TRAIN_COACH).click()
cy.get(`:nth-child(${index + 1}) > .bull-back > app-train-avl-enq > :nth-child(1) > :nth-child(7) > :nth-child(1)`).contains(formatDate(TRAVEL_DATE)).click()
cy.get(`:nth-child(${index + 1}) > .bull-back > app-train-avl-enq > [style="padding-top: 10px; padding-bottom: 20px;"]`).contains('Book Now').click()
cy.get(`:nth-child(${index + 2}) > .bull-back > app-train-avl-enq > :nth-child(1) > :nth-child(7) > :nth-child(1)`).contains(formatDate(TRAVEL_DATE)).click()
cy.get(`:nth-child(${index + 2}) > .bull-back > app-train-avl-enq > [style="padding-top: 10px; padding-bottom: 20px;"]`).contains('Book Now').click()
BOOK_UNTIL_TATKAL_OPENS(div, TRAIN_COACH, TRAVEL_DATE, TRAIN_NO, TATKAL)

}
Expand Down
15 changes: 12 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "irctc-cypress-automation",
"version": "3.0.3",
"version": "3.0.4",
"description": "IRCTC Ticket Booking",
"scripts": {
"test": "cypress run"
Expand All @@ -9,6 +9,7 @@
"license": "ISC",
"dependencies": {
"cypress": "13.7.1",
"dayjs": "^1.11.10"
"dayjs": "^1.11.10",
"fs.promises": "^0.1.2"
}
}
}

0 comments on commit 9b8ad66

Please sign in to comment.