diff --git a/.env b/.env index b760ccbbb..685b32e31 100644 --- a/.env +++ b/.env @@ -8,4 +8,5 @@ VITE_IPFS_GATEWAY=snapshot.mypinata.cloud VITE_DEFAULT_NETWORK=1 VITE_PUSHER_BEAMS_INSTANCE_ID=2e080021-d495-456d-b2cf-84f9fd718442 VITE_SHUTTER_EON_PUBKEY=0x0e6493bbb4ee8b19aa9b70367685049ff01dc9382c46aed83f8bc07d2a5ba3e6030bd83b942c1fd3dff5b79bef3b40bf6b666e51e7f0be14ed62daaffad47435265f5c9403b1a801921981f7d8659a9bd91fe92fb1cf9afdb16178a532adfaf51a237103874bb03afafe9cab2118dae1be5f08a0a28bf488c1581e9db4bc23ca -VITE_ENV=develop \ No newline at end of file +VITE_ENV=develop +VITE_MIXPANEL_TOKEN=2ec6cd1b19e790f45cc9a9bb83980c8d diff --git a/.env.test b/.env.test deleted file mode 100644 index 35422b126..000000000 --- a/.env.test +++ /dev/null @@ -1,3 +0,0 @@ -CYPRESS_REMOTE_DEBUGGING_PORT=9222 -NETWORK_NAME=mainnet -SECRET_WORDS='test test test test test test test test test test test junk' diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index 4237cc345..42c32f20b 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -118,6 +118,7 @@ "useFlaggedMessageStatus": true, "useEmailSubscription": true, "useEmailFetchClient": true, - "useStatement": true + "useStatement": true, + "useMixpanel": true } } diff --git a/.eslintrc.js b/.eslintrc.js index ecadddde5..93f7d6106 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,6 @@ module.exports = { node: true }, extends: [ - 'plugin:cypress/recommended', 'plugin:vue/vue3-recommended', 'eslint:recommended', '@vue/eslint-config-typescript/recommended', diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 554d6c882..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: - - package-ecosystem: 'npm' - directory: '/' - schedule: - interval: 'monthly' diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 60b0494d2..71c52ca55 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -10,7 +10,6 @@ jobs: cache: 'yarn' - run: yarn - run: yarn test:unit:coverage - - run: yarn test:e2e - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 with: diff --git a/cypress.config.ts b/cypress.config.ts deleted file mode 100644 index e502ef897..000000000 --- a/cypress.config.ts +++ /dev/null @@ -1,23 +0,0 @@ -const { defineConfig } = require('cypress'); -const synpressPlugins = require('@synthetixio/synpress/plugins'); - -module.exports = defineConfig({ - userAgent: 'synpress', - viewportHeight: 900, - viewportWidth: 1280, - screenshotOnRunFailure: false, - video: false, - chromeWebSecurity: true, - defaultCommandTimeout: 30000, - pageLoadTimeout: 30000, - requestTimeout: 30000, - e2e: { - testIsolation: true, - setupNodeEvents(on, config) { - synpressPlugins(on, config); - }, - baseUrl: 'http://localhost:8081/#/', - supportFile: 'cypress/support/e2e.js' - // specPattern: 'cypress/e2e/voting-proposal.spec.cy.js' - } -}); diff --git a/cypress/e2e/create-proposal.spec.cy.js b/cypress/e2e/create-proposal.spec.cy.js deleted file mode 100644 index 4952ea8cd..000000000 --- a/cypress/e2e/create-proposal.spec.cy.js +++ /dev/null @@ -1,37 +0,0 @@ -describe('create proposal', () => { - it('should create a proposal with three different spaces', () => { - ['/test1.testsnap.eth', '/test2.testsnap.eth'].forEach(space => { - // First space is a default space, with no validation settings - // Third space is a custom space, with validation settings (only authors) - cy.visit(space); - cy.get('[data-testid="create-proposal-button"]').click(); - cy.get('[data-testid="input-proposal-title"]').type('Hello, World'); - cy.get('[data-testid="input-proposal-body"]').clear(); - cy.get('[data-testid="input-proposal-body"]').type( - 'Lorem ipsum dolor sit amet consectetur adipisicing elit.' - ); - cy.get('[data-testid="input-proposal-discussion"]').type( - 'https://google.com' - ); - cy.get('[data-testid="create-proposal-continue-button"]').click(); - cy.get('[data-testid="input-proposal-choice-0"]').type('Alice'); - cy.get('[data-testid="input-proposal-choice-1"]').type('Bob'); - cy.get('[data-testid="create-proposal-publish-button"]').click(); - - cy.confirmMetamaskDataSignatureRequest(); - - cy.get('[data-testid="proposal-page-title"]').should( - 'include.text', - 'Hello, World' - ); - cy.get('[data-testid="proposal-page-content"]').should( - 'include.text', - 'Lorem ipsum dolor sit amet consectetur adipisicing elit.' - ); - cy.get('[data-testid="proposal-page-discussion-link"]').should( - 'include.text', - 'Google' - ); - }); - }); -}); diff --git a/cypress/e2e/voting-proposal.spec.cy.js b/cypress/e2e/voting-proposal.spec.cy.js deleted file mode 100644 index 306c8213b..000000000 --- a/cypress/e2e/voting-proposal.spec.cy.js +++ /dev/null @@ -1,163 +0,0 @@ -describe('voting', () => { - it('should vote on a single choice proposal', () => { - cy.visit( - 'pistachiodao.eth/proposal/0x02c3fcd64e86157d07c88e5a715ac08f57655917f8bfd5be30a99092136511ec' - ); - cy.get('[data-testid="proposal-page-title"]').should( - 'include.text', - 'Single choice voting demo' - ); - cy.get('[data-testid="sc-choice-button-1"]').click(); - cy.get('[data-testid="sc-choice-button-1"]').should( - 'have.class', - '!border-skin-link' - ); - cy.get('[data-testid="proposal-vote-button"]').click(); - cy.get('[data-testid="confirm-vote-button"]').click(); - cy.confirmMetamaskDataSignatureRequest().then(confirmed => { - expect(confirmed).to.be.true; - }); - cy.get('[data-testid="post-vote-modal-close"]').click(); - cy.get('[data-testid="proposal-votes-list-item-0"]').should( - 'include.text', - 'You' - ); - cy.get('[data-testid="proposal-votes-list-item-0"]').should( - 'include.text', - 'Bob' - ); - }); - - it('should vote on a approval proposal', () => { - cy.visit( - 'pistachiodao.eth/proposal/0x08c3bd2960700525770a1d634f8599ba967e55fcc05b6c1649d984d88253769d' - ); - cy.get('[data-testid="proposal-page-title"]').should( - 'include.text', - 'Approval voting demo' - ); - cy.get('[data-testid="proposal-votes-list-item-0"]').should('be.visible'); - cy.get('[data-testid="approval-choice-list"]>button').each($el => { - if ($el[0].className.includes('!border-skin-link')) { - cy.wrap($el).click(); - } - cy.wrap($el).should('not.have.class', '!border-skin-link'); - }); - cy.get('[data-testid="approval-choice-button-1"]').click(); - cy.get('[data-testid="approval-choice-button-1"]').should( - 'have.class', - '!border-skin-link' - ); - cy.get('[data-testid="approval-choice-button-0"]').click(); - cy.get('[data-testid="approval-choice-button-0"]').should( - 'have.class', - '!border-skin-link' - ); - cy.get('[data-testid="proposal-vote-button"]').click(); - cy.get('[data-testid="confirm-vote-button"]').click(); - cy.confirmMetamaskDataSignatureRequest().then(confirmed => { - expect(confirmed).to.be.true; - }); - cy.get('[data-testid="post-vote-modal-close"]').click(); - cy.get('[data-testid="proposal-votes-list-item-0"]').should( - 'include.text', - 'You' - ); - cy.get('[data-testid="proposal-votes-list-item-0"]').should( - 'include.text', - 'Article 1, Article 2' - ); - }); - - it('should vote on a quadratic proposal', () => { - cy.visit( - 'pistachiodao.eth/proposal/0x21f64875abbca71762a980efae43ab62b546d54f19a208d0e61a5d7cee571a35' - ); - cy.get('[data-testid="proposal-page-title"]').should( - 'include.text', - 'Quadratic voting demo' - ); - cy.get('[data-testid="proposal-votes-list-item-0"]').should('be.visible'); - cy.get('[data-testid="quadratic-choice-list"]>button').each( - ($el, index) => { - if ($el[0].className.includes('!border-skin-link')) { - cy.get(`[data-testid="quadratic-input-${index}"]`).clear(); - } - cy.wrap($el).should('not.have.class', '!border-skin-link'); - } - ); - cy.get('[data-testid="quadratic-add-button-0"]').click(); - cy.get('[data-testid="quadratic-choice-button-0"]').should( - 'have.class', - '!border-skin-link' - ); - cy.get('[data-testid="quadratic-add-button-1"]').click(); - cy.get('[data-testid="quadratic-choice-button-1"]').should( - 'have.class', - '!border-skin-link' - ); - cy.get('[data-testid="quadratic-choice-button-0"]').should( - 'include.text', - '50%' - ); - cy.get('[data-testid="quadratic-choice-button-1"]').should( - 'include.text', - '50%' - ); - cy.get('[data-testid="proposal-vote-button"]').click(); - cy.get('[data-testid="confirm-vote-button"]').click(); - cy.confirmMetamaskDataSignatureRequest().then(confirmed => { - expect(confirmed).to.be.true; - }); - cy.get('[data-testid="post-vote-modal-close"]').click(); - cy.get('[data-testid="proposal-votes-list-item-0"]').should( - 'include.text', - 'You' - ); - cy.get('[data-testid="proposal-votes-list-item-0"]').should( - 'include.text', - '50% for PistachioSwap, 50% for Pistachio UBI' - ); - }); - - it('should vote on a ranked-choice proposal', () => { - cy.visit( - 'pistachiodao.eth/proposal/0x5003da0f03e718b461e53fe10a998b60172e2e108472153282fcef781c300f23' - ); - cy.get('[data-testid="proposal-page-title"]').should( - 'include.text', - 'Ranked-choice voting demo' - ); - cy.get('[data-testid="proposal-votes-list-item-0"]').should('be.visible'); - cy.get('[data-testid="ranked-choice-selected-list"]').then($list => { - if ($list[0].children.length > 0) { - cy.get('[data-testid="ranked-choice-selected-list"]>button').each( - $el => { - if ($el[0].className.includes('!border-skin-link')) { - cy.get(`[data-testid="ranked-choice-selected-delete-0"]`).click(); - } - } - ); - } - cy.wrap($list).children().should('have.length', 0); - }); - cy.get('[data-testid="ranked-choice-select-list"]>button').each($el => { - cy.wrap($el).should('be.visible'); - cy.wrap($el).click(); - }); - cy.get('[data-testid="proposal-vote-button"]').click(); - cy.get('[data-testid="confirm-vote-button"]').click(); - cy.confirmMetamaskDataSignatureRequest().then(confirmed => { - expect(confirmed).to.be.true; - }); - cy.get('[data-testid="post-vote-modal-close"]').click(); - cy.get('[data-testid="proposal-votes-list-item-0"]').should( - 'include.text', - 'You' - ); - cy.get('[data-testid="proposal-votes-list-item-0"]').should( - 'include.text', - '(1st) Alice, (2nd) Bob, (3rd) Carol, (4th) David' - ); - }); -}); diff --git a/cypress/support/commands.js b/cypress/support/commands.js deleted file mode 100644 index 119ab03f7..000000000 --- a/cypress/support/commands.js +++ /dev/null @@ -1,25 +0,0 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js deleted file mode 100644 index fa700c83d..000000000 --- a/cypress/support/e2e.js +++ /dev/null @@ -1,14 +0,0 @@ -import './commands'; -import '@synthetixio/synpress/support'; - -beforeEach(() => { - cy.visit('/'); - cy.get('[data-testid="button-connect-wallet"]').click(); - cy.get('[data-testid="button-connnect-wallet-injected"]').click(); - cy.acceptMetamaskAccess(); -}); - -afterEach(() => { - cy.disconnectMetamaskWalletFromAllDapps(); - cy.resetMetamaskAccount(); -}); diff --git a/package.json b/package.json index f771fd494..884db5058 100644 --- a/package.json +++ b/package.json @@ -3,15 +3,9 @@ "version": "0.1.4", "scripts": { "dev": "vite --port=8080", - "cypress:test:e2e": "start-server-and-test 'yarn cypress:serve:build' http-get://localhost:8081 'yarn cypress:run'", - "cypress:dev:e2e": "start-server-and-test 'yarn cypress:serve:dev' http-get://localhost:8081 'yarn cypress:open'", - "cypress:run": "env-cmd -f .env.test cypress run --browser chrome --headed", - "cypress:open": "env-cmd -f .env.test cypress run --browser chrome --headed --no-exit", - "cypress:serve:dev": "VITE_E2E=true vite --port=8081", - "cypress:serve:build": "VITE_E2E=true vite build && npx http-server dist -p 8081", "preinstall": "yarn run init-submodules", "build": "vite build", - "lint": "eslint \"*.{ts,js,vue,json}\" src/ cypress/ --ext .ts,.js,.vue,.json", + "lint": "eslint \"*.{ts,js,vue,json}\" src/ --ext .ts,.js,.vue,.json", "lint:fix": "yarn lint --fix", "format": "prettier \"**/*.{ts,js,vue,json}\"", "format:check": "yarn format --check || exit 1", @@ -19,7 +13,6 @@ "postinstall": "patch-package && husky install", "init-submodules": "git submodule update --init", "test:unit": "vitest run", - "test:e2e": "start-server-and-test 'yarn cypress:serve:build' http-get://localhost:8081 'cypress run'", "test:unit:coverage": "vitest run --coverage" }, "dependencies": { @@ -45,7 +38,7 @@ "@shutter-network/shutter-crypto": "0.1.0-beta.3", "@snapshot-labs/lock": "^0.2.0", "@snapshot-labs/pineapple": "^1.1.0", - "@snapshot-labs/snapshot.js": "^0.7.8", + "@snapshot-labs/snapshot.js": "^0.8.0", "@snapshot-labs/tune": "^0.1.34", "@vue/apollo-composable": "4.0.0-beta.4", "@vueuse/core": "^10.4.0", @@ -59,6 +52,7 @@ "js-sha256": "^0.9.0", "jsonexport": "^3.2.0", "lodash": "^4.17.21", + "mixpanel-browser": "^2.47.0", "readable-stream": "3.6.0", "remarkable": "^2.0.1", "remove-markdown": "^0.5.0", @@ -73,7 +67,6 @@ "devDependencies": { "@iconify-json/heroicons-outline": "^1.1.7", "@rushstack/eslint-patch": "^1.3.3", - "@synthetixio/synpress": "^3.5.1", "@tailwindcss/forms": "^0.5.6", "@types/bluebird": "^3.5.38", "@types/lodash": "^4.14.198", @@ -87,10 +80,8 @@ "@vue/eslint-config-typescript": "^9.0.0", "@vue/test-utils": "^2.4.1", "autoprefixer": "^10.4.15", - "cypress": "^12.11.0", "env-cmd": "^10.1.0", "eslint": "^8.46.0", - "eslint-plugin-cypress": "^2.15.1", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-vue": "^7.15.1", "happy-dom": "^10.11.0", diff --git a/src/components/AboutSubheader.vue b/src/components/AboutSubheader.vue deleted file mode 100644 index aa6598e7a..000000000 --- a/src/components/AboutSubheader.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/src/components/BaseComboboxMultiple.vue b/src/components/BaseComboboxMultiple.vue deleted file mode 100644 index 9e42bb8e9..000000000 --- a/src/components/BaseComboboxMultiple.vue +++ /dev/null @@ -1,100 +0,0 @@ - - - diff --git a/src/components/BaseListboxMultiple.vue b/src/components/BaseListboxMultiple.vue deleted file mode 100644 index bf8d615c7..000000000 --- a/src/components/BaseListboxMultiple.vue +++ /dev/null @@ -1,134 +0,0 @@ - - - diff --git a/src/components/ButtonFollow.vue b/src/components/ButtonFollow.vue index 94559ad35..e2f5ade4e 100644 --- a/src/components/ButtonFollow.vue +++ b/src/components/ButtonFollow.vue @@ -6,15 +6,27 @@ const props = defineProps<{ primary?: boolean; }>(); +const { domain } = useApp(); const { isGnosisSafe } = useClient(); +const { web3Account } = useWeb3(); const { modalTermsOpen, termsAccepted, acceptTerms } = useTerms(props.space.id); -const { clickFollow, loadingFollow, isFollowing } = useFollowSpace( +const { clickFollow, loadingFollow, isFollowing, loadFollows } = useFollowSpace( props.space.id ); const canFollow = computed(() => props.space.terms ? termsAccepted.value || isFollowing.value : true ); + +watch( + web3Account, + () => { + // Only for custom domain, else follows are loaded on sidebar + domain && loadFollows(props.space.id); + }, + { immediate: true } +); +