Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roadmap for E2E Cypress Tests #704

Open
tuliomir opened this issue Dec 10, 2024 · 0 comments
Open

Roadmap for E2E Cypress Tests #704

tuliomir opened this issue Dec 10, 2024 · 0 comments
Assignees
Labels
design Issue that describes a project in details tests

Comments

@tuliomir
Copy link
Collaborator

tuliomir commented Dec 10, 2024

Motivation

After the E2E tests were restored in #698 , we can increase the coverage of those tests. This issue aims to create a roadmap for making all QA tests automated and able to be run from both the developer machine and the CI environment.

Future Possibilities

We aim to have visual regression tests and a simulated Ledger device, as tracked by #696 . Those, however, will require further investigation and designs. Just with the tools offered by the current state, all the tests below can be readily implemented.

Test Roadmap

The steps mentioned below are the ones in our current QA document. We use them as a reference to ensure all our current QA is being mapped to the automated tests. Some of the steps were merged to take advantage of the context.

The following symbols will be used to indicate existing ambiguity:

  • 🧪 Research needed on the implementation details
  • ⏳ A decision yet to be made
  • 🔜 A test that will fail at the moment, but is a desired outcome and should be implemented/commented for future activation

Steps already implemented on the repository by 698

  • Welcome screen and initialization
  • Creating a new software wallet
  • Skipping the words backup
  • Backing up the words
  • Handling a server error when first loading a wallet

New tests that may be executed on an empty wallet

It's important to have a set of tests running on a sort of read-only state, not writing to the blockchain. By implementing those first we increase the coverage while implementing the interaction with a live network.

Step 5: Lock/Unlock
🧪 During the implementation we will find out if we need to emulate internal state to make those logged wallet assertions

  • Click on the lock in the bottom left part of the screen, the app must go to the locked screen asking for the PIN.
  • Try to unlock with a wrong PIN.
  • Unlock it and check that you transactions were loaded correctly.
  • Lock again and select "Reset Wallet". Cancel the reset and unlock the wallet.
  • Check that the transactions were loaded correctly.
  • Lock again, select "Reset Wallet" and actually reset the wallet. Close the app the validate that the app opens in the "Welcome" screen.

Step 25: Late Backup
Use the existing steps on the welcome test file to generate a wallet without backup

  • Click "Backup now" and type the wrong password.
  • Type the correct password and execute the same steps as the welcome test file to ensure handling of incorrect word selection and success navigation
  • Ensure the screen header reminder is not shown after a successful backup validation

Step 26: Reset menu

  • Navigate to settings
  • Click "Reset all data"
  • Try to reset while all inputs are empty
  • Click "No"
  • Input an invalid password
  • Input invalid confirm message
  • Click "Forgot my password" and invalid confirm message
  • Reset with correct password
  • Start a wallet and Reset again, now with "forgot my password" checked
  • Validate that all correct fields were wiped from the local storage
  • Validate that the app navigates to the correct screen after the reset
  • Import another wallet that has a history and confirm its correct addresses are loaded and shown

Step 4: Wallet Screen
We're actually only going to test the addresses part of this existing step.
🧪 Research will be needed on how to read the QR code both from the screen and from the downloaded image file

  • Check that an address is shown on the main screen
  • Click "Generate new address" and confirm it changes. Store this value
  • Click "QR Code" and check the same address text is shown
  • Read the QR Code somehow and confirm it points to the correct address
  • Click "Download" and confirm the file name has the correct address
  • Read the downloaded file and confirm it points to the correct address
  • Click "Generate new address" and execute all those validations again
  • Navigate to the "All Addresses" screen and search for one of those addresses: only one row should be exhibited
  • Search for an address that is not present: no results should be exhibited

Steps that require making transactions

Since this section will receive tokens, it's worth saving the seed words used for each test group as an artifact or even on the test log. That way, if any errors happen, a dev may keep the network running and study its state.

All transactions will be executed in a private network added in #710 . 🧪 It will soon be added to the CI, but for the initial tests implementation this private network can be run locally by the test developer.

Step 2: New Token Error

  • Navigate to "Custom Tokens" -> "Create Token"
  • Click the "Read more about it here" link and confirm it's not broken ( 🧪 Research how to implement this validation, as an external browser would be out of the scope of the tests )
  • Try to create a token without filling any of the fields
  • Try filling each field with invalid content
    • Name with less than 4 characters or more than 30 ( see tokens rfc )
    • Symbol with less than 2 characters or more than 5
    • Letters and emojis in the "amount" field
  • Test the "select address automatically" field, also trying to provide invalid values:
    • A random string
    • An address from another wallet
    • An address from another network
  • Test invalid PIN on confirmation
  • Confirm there are no funds

Step 4: Wallet Screen

  • Take note of the current address
  • Send 0.10 HTR to this address from the test faucet
  • The current address should change
  • Navigate to "All Addresses" and check there is 01 transaction for this address

Step 6: Transaction Detail

  • Check that the first transaction on the list is exactly the one received above
  • Click the first transaction on the list
  • Validate the amount of tokens
  • Validate the addresses: which ones are marked as "This wallet" and which are not

Step 7: Create New Token
These tests will replace step 7 with a full suite for the create token screen, instead of only partial steps

  • Try to create 100k tokens, for which there are not enough funds
  • Create 1.00 custom tokens with a name that minimally unique ( like "Test Token 23Nov" / "TT23N" ) ( 🧪 How to generate unique names? [^1] )
  • Click on the transaction that has the token deposit
  • Validate all values from inputs and outputs
  • Validate that all addresses have the "Your Address" tag
  • Check there is a Token Uid with a link
  • Click on it and validate the navigated screen is correct
    Here we borrow some validations from step 14, to take advantage of the context
  • Navigate to the "About" tab for this created token and confirm the amount, symbol, name, uid of the token, mint and melt indications
  • Click the "Copy" button for the configuration string. Validate it's the same as the one from the recent modal.
  • Read the QR Code and validate it's the correct configuration string ( 🧪 Pending research on how to read/validate QR Codes )
  • Download and confirm the filename is correct for this config
  • Read the QR Code of the downloaded file and confirm it's also correct

Step 9: Send Tokens
This section will be expanded from the original

  • Try to send a transaction with all fields empty
  • Validate there are two tokens on the tokens SelectBox: HTR and the new custom one
  • Try to add invalid addresses on the "Outputs" field
  • Try to add invalid values on the amount field
  • Select one specific address from this wallet to execute the next tests
  • Send 0.01 HTR to this address
  • Click the transaction details and confirm the tx has the correct output
  • Send 0.03 HTR to this address in two outputs: one of 0.01 and other of 0.02
  • Click the transaction details and confirm the tx has the correct outputs
  • Send 0.03 HTR to this address in two outputs, but the 0.01 HTR one with a timelock of one minute
  • Return to the dashboard and confirm the balance has a locked amount of 0.01
  • Click the transaction details and confirm the tx has the correct outputs with the timelock
    Integrating here the step 23 from the existing QA suite:
  • Select the "Choose inputs automatically" and try to use the same input that was used for the last tx.
  • Validate the error message
  • Now select a valid utxo from the last tx and make the transaction. Confirm it sends properly.
  • Send a transaction with both HTR and Custom token
  • Go to the transaction details and confirm there is a link to the custom token there, right after the "Inputs" and "Outputs" section.

Steps 10, 11, 12, 13: Token registering/unregistering

  • Take note of the created custom token configuration string
  • Unregister the custom token
  • Click on the last tx, navigate to the custom token through the link
  • Try to register without marking the checkbox, confirm it shows a warning and fails
  • Register the token
  • Unregister it again
  • Navigate to "Custom Token" -> "Register Token" and register it again
  • Unregister it again
  • Navigate to the main wallet screen and click the purple circle on the token bar with a number 1
  • Click "Show history", select one of the txs, register the token there
  • Unregister it again
  • Create a second custom token and take note of its configuration string, then unregister it.
  • Navigate to the purple circle again
  • Click "Register Tokens" and input both custom tokens to ensure both will be registered together.
    • Try inserting them in the same line with no spacing
    • Try inserting them in the same line with a single space between them
    • Try inserting them in the same line with multiple spaces between them
    • Try inserting them with multiple lines between each token
  • Try to register an invalid token string like "abc"
    The next section will handle duplicate names for the tokens
  • Unregister all custom tokens
  • Create a new custom token with the same name as one of the others
  • Try to register the custom token that has the same name through all the methods below. All should fail ( 🔜 this validation may not be in place for some cases. Implement them and leave commented for the time being )
    • the "Custom Token"
    • the transaction history
    • the "Register multiple tokens" via purple icon on the token bar
  • For QA step 22, unregister all tokens and then try to register both tokens with the same name together. It should fail ( 🔜 This implementation is pending, implement and leave it commented for future activation )

Step 15: Hide zero-balance tokens

  • Create a custom token "Hide Token Test" / "HIDET" and melt all its tokens so that its balance is 0.
  • Confirm it is being shown on the left token bar
  • Navigate to Settings, select "Hide Zero Balance Tokens"
  • Click "No", navigate to the main screen and confirm no tokens were hidden
  • Back to Settings, Select "Hide Zero Balance Tokens" and click "Yes"
  • Back to the tokens screen, the HIDET is hidden from the left Token bar
  • Navigate away to "HTR" and confirm it stays hidden
  • Navigate to "Settings" and disable hide zero balance tokens
  • Back to the tokens screen, HIDET is shown again

Step 16: Always show tokens

  • Navigate to the HIDET token, "About" tab
  • Click "Always show this token"
  • Navigate to settings, hide zero balance tokens and back to tokens screen
  • Confirm HIDET still shows on the left bar
  • Click "Always show this token" and navigate to the HTR token
  • See that it no longer shows on the left tokens bar
  • Deactivate "Hide zero balance tokens" and see that HIDET is shown again
  • Unregister HIDET and activate "Hide zero balance tokens"
  • Navigate to "Custom Token" -> Register and try to register HIDET again
  • Do not check the checkbox and register the token
  • Navigate to the "Wallet" screen and confirm it does not show on the left bar
  • Unregister HIDET
  • Navigate to "Custom Token" -> Register and try to register HIDET again
  • Check the checkbox and register the token
  • Navigate to the "Wallet" screen and confirm it does on the left bar now
    Additionally, since we already have two tokens, execute step 17 too:
  • Register one or more additional tokens
  • Reduce the viewport vertically and confirm the left token bar has a vertical scroll to allow access to all tokens

Step 18: Change Server

  • Navigate to "Settings" -> "Change network"
  • Don't choose any network and click "Connect". There should be a warning message ( 🔜 Pending warning implementation, comment the tests )
  • Select "Mainnet" and click "Connect" without entering a PIN, check the error message ( 🔜 Pending message )
  • Enter the wrong PIN and validate the error message
  • Enter the correct PIN and confirm the transaction history loads correctly
  • Navigate back to the server screen and copy every field from the current network settings, except for the "Wallet Service" ones. Insert PIN and confirm. The wallet should load correctly
  • Navigate back to the server screen and enter the local testing network again.
    • Enter a random string in the testnet confirmation modal, validate the error message
    • Cancel the modal and confirm the network was not changed
    • Type "testnet" in the modal and confirm the network change
    • The server should be changed
    • The transactions from this test suite should be loaded correctly.
    • The right side of the header should indicate this is a testnet
  • Insert an invalid fullnode address and validate the app handles an incorrect response ( 🔜 Pending adequate error handling, possibly mock the response via cypress interceptor )

Step 19: Add passphrase

  • Navigate to "Settings" -> "Passphrase"
  • Try clicking "Continue" without clicking the checkbox before
  • Try confirming with all fields empty
  • Add an incorrect password, confirm
  • Add an incorrect pin, confirm
  • Add correct pin and password. Confirm.
  • The screen should fail because the "I want to set a blank passphrase" was not checked
  • Add a passphrase and fail the confirmation
  • Add a correct confirmation, but fail the password
  • Fix the password but fail the PIN
  • Confirm and generate a new wallet with the passphrase
  • On the "Tokens" screen there should be no transactions
  • Navigate back to "Settings" -> "Passphrase"
  • Click "I want to set a blank passphrase", but fail the password
  • Fix the password but fail the PIN
  • Confirm and check that all transactions are shown again

Step 20: Settings options

  • Navigate to "Settings"
  • Click "Allow notifications" and select "No", then select "Yes" and confirm local storage changes
  • Same thing with "Automatically report bugs to Hathor"
  • Click to copy the unique identifier and confirm the value on the clipboard is the same being exhibited ( 🧪 Understand how this clipboard validation can be implemented )
  • Click "Export Registered Tokens" and confirm all registered tokens are exported ( 🧪 Understand how to implement the file download and parsing )

Step 14: Minting and melting

  • Navigate to the custom token generated before, "Administrative Tools"
  • Try to mint 10.000,00 tokens and confirm the error of not enough funds
  • Mint 2,00 tokens and confirm the new balance is 3.00
  • Try to melt 3.00 tokens and confirm the error message
  • Melt 1.00 tokens and validate the balance is now 2.00
  • Delegate mint to one address from this wallet. Confirm it shows now "2" mint outputs for this wallet.
  • Delegate melt to the faucet address and deselect the option to "Create another melt output for you?". Confirm the interface no longer displays melting tools.
  • Try to destroy 3 mint outputs and confirm the error
  • Destroy the existing 2 mint outputs and see that the message indicates "You have no more authority outputs for this token"
    1. Go to the 'About TST' tab and confirm that:
    • "Can mint new tokens: No"
    • "Can melt tokens: Yes"

Step 24: Create NFT and tx with output data
Testing NFT creation

  • Navigate to "Custom tokens" -> "Create NFT"
  • Click "Create" with all empty fields
  • Add more than 150 characters on the "NFT Data" field. Confirm the contents were sliced and the last characters were discarded.
  • Fill all fields with invalid content and check their validations
  • Create a valid NFT with 1.00 tokens and a melt authority. Confirm the total deposit will be of 0.02 HTR.
  • Navigate to the transaction details and confirm the NFT Data is exhibited there correctly
    Testing Data Output
  • Take note of the current HTR balance
  • Navigate to the "Send Tokens" screen
  • Click "Add data output". Do not add anything and click "Send Tokens". There should be an error after adding the PIN.
  • Add a simple data output like "Test Data Output"
  • Send the transaction
  • Confirm the balance of HTR has dropped by 0.01
  • Check the transaction details and confirm there is a data output there.

Large Values

  • Reset the wallet and import the seed from the Large Values QA
  • Check that the total available is exactly 92,233,720,368,547,758.00 HTR.

Send a simple transaction

  • Copy an address from this wallet.
  • Go to the "Send Tokens" tab and create a transaction to that address.
  • Copy the "Balance available" value, paste it in the value input, and send the transaction.
  • The transaction should be successfully created. Return to the main screen.
  • The balance should remain 92,233,720,368,547,758.00 HTR, and a new transaction with value 0.00 should appear in the history.

Check that a custom token can be created with the maximum output value

  • Go to the "Custom tokens" tab.
  • Type any "Short name" and "Symbol".
  • Put exactly 9223372036854775808 as the "Amount". This is 2^63, which is the maximum value an output can hold. It should appear as 92,233,720,368,547,758.08 in the input.
  • The deposit should appear as exactly 922,337,203,685,477.60 HTR. It's not precisely 1% of the requested amount, this is expected. For more information, see the main QA.
  • Create the token, and the transaction should be successfully created. Return to the main screen.
  • Go to your newly created token's tab, and check that the total available is exactly 92,233,720,368,547,758.08. It should contain one transaction in the history with 92,233,720,368,547,758.08 as the value.
  • Go to the HTR tab, the total available should be exactly 91,311,383,164,862,280.40, and a new transaction with value -922,337,203,685,477.60 should appear in the history.
@tuliomir tuliomir added design Issue that describes a project in details tests labels Dec 10, 2024
@tuliomir tuliomir self-assigned this Dec 10, 2024
@tuliomir tuliomir moved this from Todo to In Progress (Done) in Hathor Network Dec 10, 2024
@tuliomir tuliomir moved this from In Progress (Done) to In Progress (WIP) in Hathor Network Dec 18, 2024
@tuliomir tuliomir moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Jan 21, 2025
@tuliomir tuliomir moved this from In Progress (Done) to Waiting to be deployed in Hathor Network Jan 23, 2025
@tuliomir tuliomir moved this from Waiting to be deployed to In Progress (Done) in Hathor Network Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Issue that describes a project in details tests
Projects
Status: In Progress (Done)
Development

No branches or pull requests

1 participant