Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ config.tsx
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# cypress
cypress.env.json
/cypress/screenshots
10 changes: 10 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
return config;
},
},

});
27 changes: 27 additions & 0 deletions cypress.env.sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"URL": "https://craft-cw-testnet.firmachain.dev",
"CW20_CONTRACT_ADDRESS": "",
"CW20_CONTRACT_ADDRESS_2": "",
"BLOCK_HEIGHT": "",

"ADDRESS_5": "",
"MNEMONIC_5": "",
"PASSWORD": "",

"ADDRESS_6": "",
"MNEMONIC_6": "",

"ADDRESS_20": "",
"MNEMONIC_20": "",

"ADDRESS_7": "",
"MNEMONIC_7": "",

"CW721_CONTRACT_ADDRESS": "",
"CW721_CONTRACT_ADDRESS_2": "",
"CW721_CONTRACT_ADDRESS_3": "",

"IMAGE_URL" : "https://picsum.photos/600/400 "


}
119 changes: 119 additions & 0 deletions cypress/e2e/QR version/QR_cw20_allowance_block.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
describe('cw20 allowance_block', () => {

it('cw20 allowance_block', () => {
cy.visit(Cypress.env('URL') + '/execute')
cy.walletConnectViaQR()
cy.visit(Cypress.env('URL') + '/execute')
//search on execute page
cy.searchAndSelectToken(Cypress.env('CW20_CONTRACT_ADDRESS'))

cy.get('span[class="typo"]').contains('Select').click()
cy.wait(1000)

// select Increase Allowance from React Select options
cy.get('[role="option"]').contains('Increase Allowance').click()

cy.get('input[type="string"][placeholder="Input Wallet Address"]').eq(0)
.clear()
.type(Cypress.env('ADDRESS_20'))

cy.get('input[type="text"][placeholder="0"] ')
.clear()
.type('2000').blur()
cy.get('input[type="text"][placeholder="ex) 7216240"]')
.clear()
.type(Cypress.env('BLOCK_HEIGHT'))

cy.wait(1000)
cy.get('button').contains('Increase Allowance').parent()
.should('not.be.disabled')
.click()

cy.wait(1000)

//QR authentication
cy.QR_authentication()

// wait for 10 seconds and capture screen
cy.wait(10000)
cy.screenshot('increase allowance-block')
})

//transfer from
it('cw20 increase transfer from', () => {
cy.walletConnectViaQR()//login with the wallet address that has the allowance-block
cy.visit(Cypress.env('URL') + '/execute')
//search on execute page
cy.searchAndSelectToken(Cypress.env('CW20_CONTRACT_ADDRESS'))

cy.get('span[class="typo"]').contains('Select').click()
cy.get('[role="option"]').contains('Transfer From').click()
cy.wait(1000)

//input owner address
cy.get('input[type="string"][placeholder="Input address"]').eq(0)
.clear()
.type(Cypress.env('ADDRESS_30'))

cy.get('input[type="string"][placeholder="Input address"]').eq(1)
.clear()
.type(Cypress.env('ADDRESS_20'))

cy.get('input[type="text"][placeholder="0"]')
.clear()
.type('40')

cy.get('div[class="button-text"]').contains('Transfer').parent()
.should('not.be.disabled')
.click()

cy.wait(1000)

//QR authentication
cy.QR_authentication()

// wait for 10 seconds and capture screen
cy.wait(10000)
cy.screenshot('transfer from-transaction-completed')
})

it('cw20 decrease allowance_block', () => {
cy.walletConnectViaQR()
cy.visit(Cypress.env('URL') + '/execute')
//search on execute page
cy.searchAndSelectToken(Cypress.env('CW20_CONTRACT_ADDRESS'))

cy.get('span[class="typo"]').contains('Select').click()
cy.wait(1000)

// select Decrease Allowance from React Select options
cy.get('[role="option"]').contains('Decrease Allowance').click()

cy.get('input[type="string"][placeholder="Input Wallet Address"]').eq(0)
.clear()
.type(Cypress.env('ADDRESS_20'))

cy.get('input[type="text"][placeholder="0"]')
.clear()
.type('200')

cy.get('input[type="text"][placeholder="ex) 7216240"]')
.clear()
.type(Cypress.env('BLOCK_HEIGHT'))

cy.wait(1000)
cy.get('button').contains('Decrease Allowance').parent()
.should('not.be.disabled')
.click()

cy.wait(1000)

//QR authentication
cy.QR_authentication()

// wait for 10 seconds and capture screen
cy.wait(10000)
cy.screenshot('decrease allowance_block')

})
})
112 changes: 112 additions & 0 deletions cypress/e2e/QR version/QR_cw20_allowance_forever.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
describe('cw20 allowance_forever', () => {

it('cw20 decrease allowance_forever', () => {
cy.walletConnectViaQR()
cy.visit(Cypress.env('URL') + '/execute')

// search on execute page
cy.searchAndSelectToken(Cypress.env('CW20_CONTRACT_ADDRESS'));

cy.get('span.typo').contains('Select').click();
cy.wait(1000);

// select Increase Allowance from React Select options
cy.get('[role="option"]').contains('Increase Allowance').click();

cy.get('input[type="string"][placeholder="Input Wallet Address"]')
.eq(0)
.clear()
.type(Cypress.env('ADDRESS_20'));

cy.get('input[type="text"][placeholder="0"]')
.clear()
.type('200');

// click Forever button
cy.get('button').contains('Forever').click();

cy.wait(1000);
cy.get('button').contains('Increase Allowance').parent()
.should('not.be.disabled')
.click();

//QR authentication
cy.QR_authentication()

// wait for 10 seconds and capture screen
cy.wait(10000);
cy.screenshot('increase allowance-forever-transaction-completed');
});

it('cw20 burn from', () => {
cy.walletConnectViaQR()
cy.visit(Cypress.env('URL') + '/execute')

// search on execute page
cy.searchAndSelectToken(Cypress.env('CW20_CONTRACT_ADDRESS'));

cy.get('span.typo').contains('Select').click();
cy.wait(1000);

// select Burn From from React Select options
cy.get('[role="option"]').contains('Burn From').click();

cy.get('input[type="string"][placeholder="Input Wallet Address"]')
.eq(0)
.clear()
.type(Cypress.env('ADDRESS_30'));

cy.get('input[type="text"][placeholder="0"]')
.clear()
.type('50'); // amount to burn

cy.get('div.button-text').contains('Burn').parent()
.should('not.be.disabled')
.click();

//QR authentication
cy.QR_authentication()

// wait for 10 seconds and capture screen
cy.wait(10000);
cy.screenshot('burn from-transaction-completed');
});

it('cw20 decrease allowance_forever', () => {
cy.walletConnectViaQR()
cy.visit(Cypress.env('URL') + '/execute')

// search on execute page
cy.searchAndSelectToken(Cypress.env('CW20_CONTRACT_ADDRESS'));

cy.get('span.typo').contains('Select').click();
cy.wait(1000);

// select Decrease Allowance from React Select options
cy.get('[role="option"]').contains('Decrease Allowance').click();

cy.get('input[type="string"][placeholder="Input Wallet Address"]')
.eq(0)
.clear()
.type(Cypress.env('ADDRESS_20'));

cy.get('input[type="text"][placeholder="0"]')
.clear()
.type('50');

cy.get('button').contains('Forever').click();

cy.wait(1000);
cy.get('button').contains('Decrease Allowance').parent()
.should('not.be.disabled')
.click();

//QR authentication
cy.QR_authentication()

// wait for 10 seconds and capture screen
cy.wait(10000);
cy.screenshot('decrease allowance_forever-transaction-completed');
});

});
Loading