Skip to content

End‐to‐End testing

AlexandreG-tech edited this page Feb 2, 2024 · 6 revisions

BeforeAll Populating Data

Hygraph

To create the Hygraph data in order to test web and back-office, Hygraph needs to be populate with the desired data ( schema ). Note that an EventPassDelayedReveal is not mandatory as the default state of an EventPass is to be a classic pass for an event. DelayedReveal is a possibility that Thirdweb offers in order to have a placeholder NFTs metadata hidden behind an encrypted passphrase specified upon creation. Do not forget to upload dates for the start and the end of the event, otherwise, the deployment on the blockchain will fail since the event need to have dates so we can create the EventParameters for it. Once all the Hygraph forms are created, we can go to the next step.

Hasura

Sale Parameters

Once the data created on asura, each eventPass requires to have the following row created in the database :

  • A passPricing with the following arguments; an eventPassId from Hygraph, a currency in which the price will be based and an amount which will be the price in the selected currency. Note that the amount is specified in pennies for development reasons, so 15 euros should be entered as 1500.
  • A passAmount with the following arguments; an eventPassId from Hygraph, a maxAmount representing the amount of pass/nfts to be made and a timeBeforeDelete representing the amount in milliseconds which a pending order can exists without getting finalized before getting deleted. Note maxAmountPerUser is an optional argument that can specify how many pass a user can buy on Offline.

Those data models are crucial and are needed in order to deploy any NFT contract on the blockchain and in order to display the pass accordingly on the platform, they together represent the Sale Parameters of an EventPass.

Role Assignment

Back-office use RBAC in order to show and allow a user to read or modify any data. In order to give a certain user the permission to edit an eventPass and to deploy it, for test purpose, you should follow those steps :

  • Make sure that you have an account that you want to use. If you need to create one, simply connect on staging using either email, phone, metamask or even a social login. Once you're connected on the platform you can access your accountId by finding the account in the eponym category on Hasura.
  • Once the accountId obtained, go to the roleAssignement category and insert a row giving the following arguments :
  • accountId
  • invitedById, since we are populating data for tests, we set this to the accountId that we have. Normally this would be set to another accountId that invited this account.
  • organizerId from Hygraph of the organizer that possess the event we want to interact with
  • eventId of the event we want to manage
  • role, select a role from the list according to the permissions you want. For simple purpose, the role superadmin can be used if you want to have every permission

Once the role assignement is done, you should be able to connect on back-office with the account. Then by clicking on the account in the top right corner, you should have the new roleAssignement in the category Switch to Role. By clicking on it, a new tab 'Events Management' should appear, giving you the possibility to act as a superadmin on the event specified in the roleAssignement row.

Testing an Organizer Flow

QR codes

Once the passAmount and passPricing models are populated, back-office will allow you to add QR codes files for the NFTs. You can click on upload to have a popup giving you the possibility to upload files. The popup should display to you the amount of files that you need to upload and it should also stop you from uploading more. Note : The files should all be PNG files. It is recommended to upload real QR codes for accuracy purpose but any picture can be used as you will later have the possibility to reveal & download the QR code and then check that you have downloaded the right picture.

Deploy

Once all the steps above are done, you will simply need to press the deploy button to deploy the contract, NFTs and populate the database with their data in the correct tables. At the end of the process after about a minute and half, you should have a popup notification on the bottom right of your screen. The deploy button should also change for a display of the contract address that can be clicked to copy the contract address.

EventParameters

Once the event is deployed on the blockchain, you should be able to find an EventParameters in Hasura for the event that you just deployed. Do not forget to set a dateSaleStart and dateSaleEnd so it can be displayed on the front to the user.

User flow

  • Back-office

  • Create event with multiple pass, one should be delayed reveal with a max per user of 1, one should be normal pass with no max per user

  • Web

  • Order one delayed reveal, 2 pass

  • connect

  • Stripe finish order and pay

  • Verify /pass for delayed reveal placeholder infos and normal pass

  • disconnect

  • create new account with new currency and language

  • buy one delayed reveal and all pass possible for the normal

  • valid cart but cancel in stripe

  • make the same cart again and this time pay in stripe

  • Verify /pass for delayed reveal placeholder and reveal one normal pass

  • Send the reveal nft to the first user and a delayed reveal

  • Connect back with the first user and check that it has two new nfts one delayed and one normal reveal

  • Back-office

  • reveal the delayed reveal pass

  • Web

  • check that user 1 has now delayed reveal with revealed informations in /pass

  • reveal delayed reveal ticket

  • send the delayed reveal that wasn't reveal and a normal unreveal to a metamask account that has no account on the platform

  • connect with the metamask account to check that the nfts are in /pass and correct