diff --git a/apps/davi/cypress/integration/regression/CreateMintRepProposal.spec.ts b/apps/davi/cypress/integration/regression/CreateMintRepProposal.spec.ts new file mode 100644 index 00000000..6ca6637a --- /dev/null +++ b/apps/davi/cypress/integration/regression/CreateMintRepProposal.spec.ts @@ -0,0 +1,109 @@ +// +// Filename: CreateMintRepProposal.spec.ts +// + +/// + +import Guilds from '../../support/pageObjects/Guilds'; +import AnyGuildPage from '../../support/pageObjects/AnyGuildPage'; +import LandingPage from '../../support/pageObjects/LandingPage'; +import CreateDiscussionPage from '../../support/pageObjects/CreateDiscussionPage'; +import CreateProposalPage from '../../support/pageObjects/CreateProposalPage'; +import { ACCOUNTS } from '../../utils/constants'; +import { data } from '../../utils/constants' +const url = Cypress.config().baseUrl; + +describe('Check create mint rep proposal', () => { + before(() => { + cy.resetMetamaskAccount() + cy.visit(url); + }); + + it('Click connect wallet and choose metamask', () => { + Guilds.clickOpenWalletModalBtn(); + LandingPage.chooseMetamaskWallet() + }); + + it('Accept metamask access', () => { + cy.acceptMetamaskAccess(false).should("be.true"); + cy.closeModal() + }); + + it(`Visit first Guild on Local network`, () => { + LandingPage.goToFirstGuild() + }); + + it('Check All Discussions page', () => { + AnyGuildPage.goToAllDiscussionPage(); + AnyGuildPage.checkIfYouAreOnAllDiscussionPage(); + }); + + it('Create Discussion on Local network', () => { + AnyGuildPage.createDiscussion_Button().click() + cy.confirmMetamaskSignatureRequest() + CreateDiscussionPage.enterTitle(data.discussionTitle) + CreateDiscussionPage.enterDiscussionDescription(data.discussionDescription) + CreateDiscussionPage.clickCreateDiscussion() + }); + + it('Check All Discussions page', () => { + AnyGuildPage.goToAllDiscussionPage(); + AnyGuildPage.checkIfYouAreOnAllDiscussionPage(); + }); + + it('Check if newly created discussion is showing', () => { + CreateDiscussionPage.clickNewDiscussion(data.discussionTitle) + AnyGuildPage.checkDiscussionName(data.discussionTitle) + AnyGuildPage.checkDiscussionDescription(data.discussionDescription) + }); + + it('Click on create proposal on Discussion Page', () => { + CreateProposalPage.clickOnCreateProposalButton() + cy.confirmMetamaskSignatureRequest() + }); + + it('Check proposal title proposal', () => { + CreateProposalPage.checkProposalTitle(data.discussionTitle) + }); + + it('Edit proposal title and description', () => { + CreateProposalPage.enterProposalTitle(data.proposalTitle) + CreateProposalPage.enterProposalDescription(data.proposalDescription) + }); + + it('Click on add action', () => { + CreateProposalPage.clickAddActionButton() + }); + + it('Click on mint rep action', () => { + CreateProposalPage.clickMintRepActionButton() + }); + + it('Enter Etherum address', () => { + CreateProposalPage.enterTransferEthereumAddress(ACCOUNTS[0].address) + }); + + it('Enter Mint reputation in percentage', () => { + CreateProposalPage.enterMintReputationInPercentage(data.mintRepPercentage) + }); + + it('Click on save mint rep action', () => { + CreateProposalPage.clickSaveMintRepAction() + }); + + it('Click on create proposal on Proposal Page', () => { + CreateProposalPage.clickOnCreateProposal() + }); + + it('Go to all proposals', () => { + AnyGuildPage.goToFirstProposalPage(); + AnyGuildPage.checkIfYouAreOnProposalPage(); + }); + + it('Check if newly created propposal is showing', () => { + CreateProposalPage.clickNewProposal(data.proposalTitle) + AnyGuildPage.checkProposalName(data.proposalTitle) + AnyGuildPage.checkProposalDescription(data.proposalDescription) + }); + +}); diff --git a/apps/davi/cypress/integration/regression/CreateTranfserProposal.spec.ts b/apps/davi/cypress/integration/regression/CreateTranfserProposal.spec.ts index 0b3e3f44..72b687f0 100644 --- a/apps/davi/cypress/integration/regression/CreateTranfserProposal.spec.ts +++ b/apps/davi/cypress/integration/regression/CreateTranfserProposal.spec.ts @@ -1,5 +1,5 @@ // -// Filename: CreateDiscussionTest.spec.ts +// Filename: CreateTransferProposal.spec.ts // /// diff --git a/apps/davi/cypress/support/pageObjects/CreateProposalPage.ts b/apps/davi/cypress/support/pageObjects/CreateProposalPage.ts index 3c2ccd81..6667ca24 100644 --- a/apps/davi/cypress/support/pageObjects/CreateProposalPage.ts +++ b/apps/davi/cypress/support/pageObjects/CreateProposalPage.ts @@ -13,7 +13,8 @@ class CreateProposalPage { actionList() { return cy.findAllByTestId('actions-modal-contract-list') } transferAction_Button() { return cy.findAllByTestId('erc20transfer-action') } setPermissionActionButton() { return cy.findAllByTestId('set-permission-action') } - mintREPActionButton() { return cy.findAllByTestId('rep-mint-action') } + mintREPAction_Button() { return cy.findAllByTestId('rep-mint-action') } + mintREPInPercentage_Field() { return cy.findAllByTestId('reputation-in-percentage-field') } updateENSContentActionButton() { return cy.findAllByTestId('ens-update-content-action') } setGuildConfigActionButton() { return cy.findAllByTestId('set-guild-config-action') } externalContractActionButton() { return cy.findAllByTestId('external-contracts-action') } @@ -26,6 +27,7 @@ class CreateProposalPage { transferAmount_Field() { return cy.get('[name="amount"]') } transferToken_Dropdown() { return cy.get('[placeholder="Token"]') } saveTransferAction_Button() { return cy.findByTestId('submit-erc20transfer') } + saveMintRepAction_Button() { return cy.findByTestId('save-action-button') } //Metods clickOnCreateProposalButton() { @@ -52,6 +54,10 @@ class CreateProposalPage { this.transferAction_Button().click() } + clickMintRepActionButton() { + this.mintREPAction_Button().click() + } + enterTransferEthereumAddress(address) { this.transferEthereumAddress_Field().type(address) } @@ -60,6 +66,10 @@ class CreateProposalPage { this.transferAmount_Field().type(amount) } + enterMintReputationInPercentage(percentage) { + this.mintREPInPercentage_Field().type(percentage) + } + clickTokenDropdown() { this.transferToken_Dropdown().click() } @@ -72,6 +82,10 @@ class CreateProposalPage { this.saveTransferAction_Button().click() } + clickSaveMintRepAction() { + this.saveMintRepAction_Button().click() + } + clickOnCreateProposal() { this.createProposalAction_Button().click() } diff --git a/apps/davi/cypress/utils/constants.ts b/apps/davi/cypress/utils/constants.ts index ada1f92f..181af82f 100644 --- a/apps/davi/cypress/utils/constants.ts +++ b/apps/davi/cypress/utils/constants.ts @@ -6,7 +6,8 @@ export const data = { discussionDescription: faker.lorem.sentence(), proposalTitle: faker.lorem.word(), proposalDescription: faker.lorem.sentence(), - ethereumAmount: faker.datatype.number({ min: 0, max: 3, precision: 0.0001 }) + ethereumAmount: faker.datatype.number({ min: 0, max: 3, precision: 0.0001 }), + mintRepPercentage: faker.datatype.number({ min: 0, max: 100, precision: 0.1 }) } export const ACCOUNTS = [ diff --git a/apps/davi/src/components/ActionsBuilder/SupportedActions/RepMint/RepMintEditor.tsx b/apps/davi/src/components/ActionsBuilder/SupportedActions/RepMint/RepMintEditor.tsx index cb826c2c..5be6eb7c 100644 --- a/apps/davi/src/components/ActionsBuilder/SupportedActions/RepMint/RepMintEditor.tsx +++ b/apps/davi/src/components/ActionsBuilder/SupportedActions/RepMint/RepMintEditor.tsx @@ -134,6 +134,7 @@ export const Mint: React.FC = ({ { field.onChange(value); @@ -161,7 +162,12 @@ export const Mint: React.FC = ({ - diff --git a/apps/davi/src/components/ActionsBuilder/SupportedActions/RepMint/__snapshots__/RepMintEditor.test.tsx.snap b/apps/davi/src/components/ActionsBuilder/SupportedActions/RepMint/__snapshots__/RepMintEditor.test.tsx.snap index bead8573..91a06fdc 100644 --- a/apps/davi/src/components/ActionsBuilder/SupportedActions/RepMint/__snapshots__/RepMintEditor.test.tsx.snap +++ b/apps/davi/src/components/ActionsBuilder/SupportedActions/RepMint/__snapshots__/RepMintEditor.test.tsx.snap @@ -320,6 +320,7 @@ exports[`RepMintEditor Should match snapshot 1`] = ` autocomplete="off" autocorrect="off" class="c8 c10" + data-testid="reputation-in-percentage-field" inputmode="decimal" maxlength="79" minlength="1" @@ -394,6 +395,7 @@ exports[`RepMintEditor Should match snapshot 1`] = `