Skip to content

Commit

Permalink
Merge pull request #327 from Filipv95/automation/create-proposal-mint…
Browse files Browse the repository at this point in the history
…-rep-test

Create Proposal mint rep test
  • Loading branch information
Filipv95 authored Mar 26, 2023
2 parents 3c8faa2 + 50eaa8f commit b5096ea
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 4 deletions.
109 changes: 109 additions & 0 deletions apps/davi/cypress/integration/regression/CreateMintRepProposal.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
//
// Filename: CreateMintRepProposal.spec.ts
//

/// <reference types="cypress" />

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)
});

});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Filename: CreateDiscussionTest.spec.ts
// Filename: CreateTransferProposal.spec.ts
//

/// <reference types="cypress" />
Expand Down
16 changes: 15 additions & 1 deletion apps/davi/cypress/support/pageObjects/CreateProposalPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') }
Expand All @@ -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() {
Expand All @@ -52,6 +54,10 @@ class CreateProposalPage {
this.transferAction_Button().click()
}

clickMintRepActionButton() {
this.mintREPAction_Button().click()
}

enterTransferEthereumAddress(address) {
this.transferEthereumAddress_Field().type(address)
}
Expand All @@ -60,6 +66,10 @@ class CreateProposalPage {
this.transferAmount_Field().type(amount)
}

enterMintReputationInPercentage(percentage) {
this.mintREPInPercentage_Field().type(percentage)
}

clickTokenDropdown() {
this.transferToken_Dropdown().click()
}
Expand All @@ -72,6 +82,10 @@ class CreateProposalPage {
this.saveTransferAction_Button().click()
}

clickSaveMintRepAction() {
this.saveMintRepAction_Button().click()
}

clickOnCreateProposal() {
this.createProposalAction_Button().click()
}
Expand Down
3 changes: 2 additions & 1 deletion apps/davi/cypress/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const Mint: React.FC<ActionEditorProps> = ({
</ControlLabel>
<ControlRow>
<RepMintInput
data-testid="reputation-in-percentage-field"
{...field}
onChange={value => {
field.onChange(value);
Expand Down Expand Up @@ -161,7 +162,12 @@ export const Mint: React.FC<ActionEditorProps> = ({
</ControlRow>
</Control>
</ControlRow>
<Button m="1rem 0 0" fullWidth type="submit">
<Button
m="1rem 0 0"
fullWidth
type="submit"
data-testid="save-action-button"
>
{t('actionBuilder.action.saveAction')}
</Button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -394,6 +395,7 @@ exports[`RepMintEditor Should match snapshot 1`] = `
</div>
<button
class="c12"
data-testid="save-action-button"
type="submit"
>
actionBuilder.action.saveAction
Expand Down

1 comment on commit b5096ea

@vercel
Copy link

@vercel vercel bot commented on b5096ea Mar 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.