1.0.0 • Published 4 years ago

pac-qa-tools v1.0.0

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
4 years ago

pac-qa-tools

Common tools to help with testing

To install

npm install @paciolan/pac-qa-tools

To run tests

npm run test 

APIs

Create Pac Authz token

  • Environment: String
  • Patron Id: Long
const pqt = require('pac-qa-tools');

pqt.createPacAuthzToken('qfnq', 3634136);
  • Returns Pac Authz Token: String

Create Random Patron

Will randomly create names, emails, passwords, etc

  • Environment: String
const pqt = require('pac-qa-tools');

var randomPatron = pqt.createRandomPatron('qfnq');

or

Create Patron

  • Environment: String
  • First Name: String
  • Last Name: String
  • Email: String
  • Password: String
  • Address: String
var myPatron = pqt.createPatron('qfnq', 'Pac', 'User', 'Pac.User@gmail.com', 'qwerty123', '123 Test St');
  • Both Return JSON Object
{
   "patronId":"1110000",
   "firstName":"Pac",
   "lastName":"User",
   "email":"Pac.User@gmail.com",
   "password":"qwerty123"
}

Purchase Ticket

  • Limitations:
    • Uses Best Available
    • Price level hardcoded to R
    • Seats have to be next to each other
    • May fail when templates change
  • Environment: String
  • Ticket Code: String
  • Season: String
  • Quantity: Int
  • Delivery Mode: String
  • User Name: String
  • Password: String
const pqt = require('pac-qa-tools');

var ticketInfo = pqt.purchaseTicket('qfnq', 'GS:AMTX:SOCAL:GPASS:', 'SOCAL', 2, 'DPCEB', 'Levi.Abshire@gmail.com', '3pdM9HASt4om')
  • Return JSON Object
{
   "ticketConfirmationCode":"3640015-SOCAL:21693-203313",
   "section":"2",
   "row":"7",
   "seat":"11-12"
}

Error

All errors will be returned in the following format:

{
  "error" : {
    "message" : "description"
  }
}

Debugging

If you want to see what the requests and responses look like for debugging purposes I suggest you use Burp and add the following to the rest_request:

const tunnel = require('tunnel'); //Add

    const agent = tunnel.httpsOverHttp({
        proxy: {
            host: '127.0.0.1',
            port: 8888,
        },
        rejectUnauthorized: false
    }); //Add

    const options = {
        ...
        ...
        ...
        httpsAgent: agent, //Add
    }