Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
664d40e
dashboard automation
taimuraamer Sep 7, 2022
602b327
cypress dashboard test cases
taimuraamer Sep 8, 2022
040f1ed
testcases added
taimuraamer Sep 15, 2022
32d7de7
swap/dashboard news section
taimuraamer Sep 22, 2022
238bb19
dashboard new section added to news automated
taimuraamer Sep 27, 2022
7af0908
modification of code, selectors changed
taimuraamer Oct 4, 2022
3183c89
code modification
taimuraamer Oct 5, 2022
47a2f59
connect button without wallet
taimuraamer Oct 6, 2022
412d890
swap automation without wallet
taimuraamer Oct 10, 2022
6a2dd32
`TC- 51, 52, 53, 54, 55, 56
taimuraamer Oct 11, 2022
77509e9
Swap module Automation
taimuraamer Oct 17, 2022
94c4f8c
swap module complete and code modification
taimuraamer Oct 18, 2022
6ccd2fc
pangolin_links, useful links
taimuraamer Oct 19, 2022
da630cf
test cases updated
taimuraamer Oct 20, 2022
4716d0d
new testcases in dashboard
taimuraamer Oct 24, 2022
c19ff64
Adding more testcases to swap and dashboard
taimuraamer Oct 25, 2022
546653c
Vote test cases
taimuraamer Oct 27, 2022
a2a2119
Vote and Airdrop automation
taimuraamer Oct 28, 2022
8b95450
Airdrop automation
taimuraamer Oct 31, 2022
5184234
Automated new test cases and code refactoring
taimuraamer Nov 1, 2022
f8f6741
Automated the Pool scripts and refactored the code
taimuraamer Nov 2, 2022
1a15002
Automated new test cases and code refactored
taimuraamer Nov 3, 2022
86b98d7
Automated new scripts and code refactored
taimuraamer Nov 3, 2022
3e09e9b
Automated new scripts and refactored the code
taimuraamer Nov 4, 2022
5d77b79
Code refactored
taimuraamer Nov 7, 2022
5c8c4f8
Automated new test cases and refactored the code
taimuraamer Nov 8, 2022
12b8470
Automated new scripts in dashboard
taimuraamer Nov 11, 2022
94f12ac
Automated new scripts and code refactored
taimuraamer Nov 15, 2022
826ffae
Automated new scripts and code refactored
taimuraamer Nov 15, 2022
26b9e7a
Automated scripts
taimuraamer Nov 18, 2022
3bc1f8a
Cypress dashboard
taimuraamer Nov 21, 2022
d12d4cd
code refactored
taimuraamer Nov 21, 2022
8316c7e
code refactoring, passed failing testcases and added new test cases
taimuraamer Nov 22, 2022
d380d06
Passed the failing test scripts of dashboard
taimuraamer Nov 25, 2022
4098179
Metamask wallet connect
taimuraamer May 23, 2023
3fb35e6
metamask connected
taimuraamer May 23, 2023
e1c6bc2
Without wallet connected
taimuraamer May 23, 2023
10920b0
Code modification
taimuraamer May 24, 2023
9d0bc84
code refactoring
taimuraamer May 25, 2023
8bfe2c2
Code refactory and new test scripts written
taimuraamer May 26, 2023
383cfd3
Code refactored and new scripts written
taimuraamer May 29, 2023
87d676f
Code refactored and new scripts automated
taimuraamer May 30, 2023
204d118
Code refactored for dashboard and swap
taimuraamer May 31, 2023
a798988
swap code refactored
taimuraamer Jun 1, 2023
3c75d1f
code refactored of swap test scripts
taimuraamer Jun 2, 2023
c778345
code refactored
taimuraamer Jun 5, 2023
710b711
code refactoring
taimuraamer Jun 15, 2023
b81f7f6
code refactoring
taimuraamer Jun 21, 2023
844c9f0
Code refactoring and new test scripts automated
taimuraamer Jun 27, 2023
6379d5f
changes
taimuraamer Jul 5, 2023
0875331
feed
taimuraamer Jul 5, 2023
fbfd4cd
env gitignore
taimuraamer Jul 5, 2023
83cb75f
env gitignore
taimuraamer Jul 5, 2023
7ebbb6f
env gitignore
taimuraamer Jul 5, 2023
8e1ddc8
test commit env
taimuraamer Jul 5, 2023
4d6606c
test env commit
taimuraamer Jul 5, 2023
bea1281
Dashboard and swap code refactoring
taimuraamer Jul 11, 2023
ebbcd79
Pool code refactoring
taimuraamer Jul 12, 2023
53f6516
Dashboard and Swap code refactored
taimuraamer Jul 21, 2023
8e2c617
New changes including tokens balance checking before test run
taimuraamer Aug 4, 2023
0ea2822
Updated the read me file
taimuraamer Aug 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ out
.idea
storybook-static
.yalc
yalc.lock
yalc.lock
9 changes: 9 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
5 changes: 5 additions & 0 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
videos
screenshots
env
e2e/tests/reports
49 changes: 49 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# synpress_metamask_login

This repo belongs to the written [tutorial](https://medium.com/coinmonks/test-e2e-login-to-dapp-with-metamask-with-synpress-5248dd1f17c1).

Synpress is a wrapper of Cypress (e2e-frontend-testing) and allows to test web3 dApps with metamask interaction. This code base accompanies the written tutorial. It helps to onboard people to dApp e2e testing.

## Getting Started

The scripts that are linked to the wallet require MetaMask setup, which can be configured using the env file. It's essential to ensure you have sufficient balances in the tokens utilized within the scripts, along with Gas token balances to cover transaction fees.

For the swap scripts, you'll find the tokens being used stored within variables named fromToken, toToken, and gasTokenName. The relevant transaction values, namely swapValue, sellTokenValue, and buyTokenValue, can be found in the pangolin-data.json file.
(Do not use AVAX and USDC as fromToken and toToken)

For the pool scripts, you'll find the tokens being used stored within variables named createPairToken1, createPairToken2, addliquidityToken1, addliquidityToken2, noPoolToken1, noPoolToken2, poolFoundToken1, poolFoundToken2 . The relevant transaction value namely addliquidityValuecan be also found in the pangolin-data.json file.
(For createPair tokens select tokens that does not exist)
(For noPool tokens select tokens that have no pool )
(For poolFound tokens select tokens that have a pool)
(Do not use AVAX as a token1)

### Prerequisites

- Node.js
- npm

### Installation

1. Clone the repository: `git clone https://github.com/pangolindex/components`
2. Navigate to the project directory: `cd e2e`
3. Install dependencies: `npm install`

### Running Tests

To run scrips having wallet connected:

npm test run

To run scripts without wallet connect:

npx cypress run

## Useful Links

- https://docs.cypress.io/guides/getting-started/installing-cypress
- https://github.com/Synthetixio/synpress
- https://github.com/yvesbou/synpress_metamask_login/new/main?readme=1

Overview over possible synpress functions:

- https://github.com/synthetixio/synpress/blob/master/support/index.d.ts
17 changes: 17 additions & 0 deletions e2e/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { defineConfig } = require('cypress');

module.exports = defineConfig({
// setupNodeEvents can be defined in either
// the e2e or component configuration
reporter: 'cypress-mochawesome-reporter',
e2e: {
setupNodeEvents(on, config) {
require('cypress-mochawesome-reporter/plugin')(on);
// on('before:browser:launch', (browser = {}, launchOptions) => {
// /* ... */
// })
},
baseUrl: 'https://dev.pangolin.exchange/#',
supportFile: false,
},
});
92 changes: 92 additions & 0 deletions e2e/cypress/e2e/Airdrop.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/// <reference types = "cypress"/>
import selectors from "../fixtures/selectors.json"
import data from '../fixtures/pangolin-data.json'
const {airdropSideMenu, airdropSideMenuSelect, pangolinTitle, songbirdLogo, cards, metamaskMenuTitle, metamaskMenuCrossBtn, haveQuestions, plusIcon, faqExp, minusIcon } = selectors.airdrop
const {cardsNames, title, eligibleMsg, comingSoonMsg, haveQs} = data.airdrop
const {connectWalletTxt} = data.swap
const {connectToWallet} = data.dashboard
describe(`Airdrop`, () => {
beforeEach('',() => {
cy.visit('/')
// Cypress.on('uncaught:exception', (err, runnable) => {
// // returning false here prevents Cypress from
// // failing the test
// return false
// })
Cypress.on('uncaught:exception', (err, runnable, promise) => {

// if (err.message.includes("TypeError")) {
// return false
// }

if (err.name === 'TypeError') {
return false
}
})

cy.get('#airdrop').click()
})

/******************* Selecting Airdrop from side menu **************************/
it(`TC-01, Verify that the airdrop page can be accessed from the side menu`, () => {
cy.get(airdropSideMenu)
.should("have.css", "background-color", "rgb(255, 200, 0)")
cy.get(airdropSideMenuSelect)
.should("have.class","ACTIVE")
})

/******************* Assertion on the cards **************************/
it(`TC-03,04,05,15,16,17,18,19,20,21, Verify that the user can see the card "Claim PNR" on the airdrop page`, () => {
cy.get(pangolinTitle).contains(title).should('be.visible')
cy.get(songbirdLogo).should('have.attr', 'src', './static/media/PSB.7fd03da2.svg').should('be.visible')
for(let i = 0; i < cardsNames.length; i++){
cy.get(cards).contains(`${cardsNames[i]}`).should('be.visible')
if(cardsNames[i] === "Old PSB Reimbursement" || cardsNames[i] === "Claim PSB") {
cy.contains(eligibleMsg).should('be.visible')
cy.get('button').should('contain', connectWalletTxt).eq(1).click()
cy.get(metamaskMenuTitle).should('contain', connectToWallet)
cy.get(metamaskMenuCrossBtn).click()
}
if(cardsNames[i] === "Claim PNR" || cardsNames[i] === "Claim PFL") {
cy.contains(comingSoonMsg).should('be.visible')
}
}

})

/********************* FAQS Assertions **********************************/
it(`TC-08,09,10,11,12,13,14 Verify that the user can see the FAQ's on the airdrop page`, () => {
cy.get(haveQuestions).contains(haveQs).should('be.visible')
for(let i = 0; i < 6; i++){
//......... Clicking on the same + icon
cy.get(plusIcon).eq(i).click()
cy.get(minusIcon).should("be.visible")
cy.get(faqExp).should("be.visible")
cy.get(minusIcon).click()
cy.get(minusIcon).should("not.exist")
cy.get(faqExp).should("not.exist")
//......... Clicking on the next + icon
cy.get(plusIcon).eq(i).click()
cy.get(minusIcon).should("be.visible")
cy.get(faqExp).should("be.visible")
cy.get(plusIcon).eq(i+1)
if(i === 6){
cy.get(plusIcon).eq(i).click()
}
cy.get(plusIcon).eq(i).should("be.visible")
cy.get(minusIcon).click()
}
})
})












Loading