#{proposal.content.kind}
{proposal.approved === true ? (
Approved
diff --git a/cypress/e2e/proposals.cy.ts b/cypress/e2e/proposals.cy.ts
index e0494aa..9eab73c 100644
--- a/cypress/e2e/proposals.cy.ts
+++ b/cypress/e2e/proposals.cy.ts
@@ -1,8 +1,67 @@
describe('Proposals', () => {
+ it('Should load /proposals list', () => {
+ cy.visit('/proposals')
+ cy.get('body').find('#proposalsPage')
+ })
+
+ it('Should open a random proposal page', () => {
+ cy.visit('/proposals')
+ cy.get('body')
+ .find('.proposalCard')
+ .then(proposalCards => {
+ const proposalCardCount: number = Cypress.$(proposalCards).length
+ cy.log('proposalCardCount:', proposalCardCount)
+ const randomProposalCardIndex: number = Math.round((Math.random() * proposalCardCount))
+ cy.log('randomProposalCardIndex:', randomProposalCardIndex)
+ cy.get(`.proposalCard:nth-child(${randomProposalCardIndex + 1})`).click()
+ cy.get('body').find('#proposalPage')
+ })
+ })
+
+ it('Should filter by outcome and open a random proposal page', () => {
+ cy.visit('/proposals')
+ cy.get('#outcomeSelector')
+ .find('option')
+ .then(options => {
+ // Select a random outome option
+ const optionsCount: number = Cypress.$(options).length
+ cy.log('optionsCount:', optionsCount)
+ const randomOptionIndex: number = 1 + Math.floor((Math.random() * (optionsCount - 1)))
+ cy.log('randomOptionIndex:', randomOptionIndex)
+ const randomOptionValue: string = options[randomOptionIndex].value
+ cy.log('randomOptionValue:', randomOptionValue)
+ const randomOptionText: string = options[randomOptionIndex].text
+ cy.log('randomOptionText:', randomOptionText)
+ cy.get('#outcomeSelector').select(randomOptionValue)
+
+ // Open a random proposal page
+ cy.get('body')
+ .find('.proposalCard')
+ .then(proposalCards => {
+ const proposalCardCount: number = Cypress.$(proposalCards).length
+ cy.log('proposalCardCount:', proposalCardCount)
+ const randomProposalCardIndex: number = Math.floor((Math.random() * proposalCardCount))
+ cy.log('randomProposalCardIndex:', randomProposalCardIndex)
+ cy.get(`.proposalCard:nth-child(${randomProposalCardIndex + 1})`).click()
+ cy.get('body').find('#proposalPage')
+ cy.get('.proposalBadges').contains(randomOptionText)
+ })
+ })
+ })
+})
+
+describe('Create Proposal', () => {
+ it('Should load /proposals/create', () => {
+ cy.visit('/proposals')
+ cy.get('#createButton').click()
+ cy.get('body').find('#createPage')
+ })
- it('Should load /proposals page', () => {
+ it('Should load /proposals/process', () => {
cy.visit('/proposals')
- cy.get('h1').contains('Proposals')
+ cy.get('#createButton').click()
+ cy.get('#governanceProcessLink').click()
+ cy.get('body').find('#processPage')
})
})
diff --git a/package.json b/package.json
index 504211d..34a155b 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,7 @@
"@types/react-dom": "18.0.6",
"@types/react-syntax-highlighter": "^15.5.3",
"autoprefixer": "^10.4.7",
- "cypress": "^10.8.0",
+ "cypress": "^10.10.0",
"eslint": "8.20.0",
"eslint-config-next": "12.2.2",
"postcss": "^8.4.14",
diff --git a/pages/proposals/[id].tsx b/pages/proposals/[id].tsx
index a19fbeb..482dfc3 100644
--- a/pages/proposals/[id].tsx
+++ b/pages/proposals/[id].tsx
@@ -120,7 +120,7 @@ const proposalComponents = (proposal: any) => {
const Proposal: NextPage = ({ proposal }: any) => {
return (
-