Skip to content

Commit

Permalink
ci: reactivating tests (#412)
Browse files Browse the repository at this point in the history
* ci: reactivating tests

* ci: fix tests
  • Loading branch information
MrX-SNX authored Aug 26, 2024
1 parent 12c6785 commit 85f1c66
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 74 deletions.
106 changes: 53 additions & 53 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,56 +120,56 @@ jobs:
- run: git diff --name-only --exit-code
- run: yarn typecheck

# governance-e2e:
# working_directory: /tmp/app
# docker:
# - image: cypress/included:<< pipeline.parameters.cypress-version >>
# resource_class: large
# environment:
# NODE_ENV: test
# TESTNET: 1
# steps:
# - checkout
# - install-foundry
# - yarn-install

# - run:
# name: Run server localhost:3000
# working_directory: /tmp/app/governance/ui
# command: CI=true yarn start
# background: true

# - run:
# name: Run anvil localhost:8545
# command: 'anvil --fork-url https://testnet.snaxchain.io --fork-block-number 296528'
# background: true

# - run:
# name: Wait for server localhost:3000
# command: wget --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 http://localhost:3000

# - run:
# name: Wait for anvil localhost:8545
# command: wget -q -O - --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 --post-data='{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}' --header='Content-Type:application/json' http://localhost:8545

# - run:
# working_directory: /tmp/app/governance/cypress
# command: cypress run --e2e --browser chrome

# - store_test_results:
# path: 'governance/cypress/cypress/reports'

# - store_artifacts:
# path: 'governance/cypress/.nyc_output'
# destination: 'coverage'

# - store_artifacts:
# path: 'governance/cypress/cypress/screenshots'
# destination: 'screenshots'

# - store_artifacts:
# path: 'governance/cypress/cypress/videos'
# destination: 'videos'
governance-e2e:
working_directory: /tmp/app
docker:
- image: cypress/included:<< pipeline.parameters.cypress-version >>
resource_class: large
environment:
NODE_ENV: test
TESTNET: 1
steps:
- checkout
- install-foundry
- yarn-install

- run:
name: Run server localhost:3000
working_directory: /tmp/app/governance/ui
command: CI=true yarn start
background: true

- run:
name: Run anvil localhost:8545
command: 'anvil --fork-url https://testnet.snaxchain.io --fork-block-number 296528'
background: true

- run:
name: Wait for server localhost:3000
command: wget --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 http://localhost:3000

- run:
name: Wait for anvil localhost:8545
command: wget -q -O - --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 --post-data='{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}' --header='Content-Type:application/json' http://localhost:8545

- run:
working_directory: /tmp/app/governance/cypress
command: cypress run --e2e --browser chrome

- store_test_results:
path: 'governance/cypress/cypress/reports'

- store_artifacts:
path: 'governance/cypress/.nyc_output'
destination: 'coverage'

- store_artifacts:
path: 'governance/cypress/cypress/screenshots'
destination: 'screenshots'

- store_artifacts:
path: 'governance/cypress/cypress/videos'
destination: 'videos'

liquidity-e2e:
parameters:
Expand Down Expand Up @@ -307,8 +307,8 @@ workflows:
- typecheck
- tests
- liquidity-cy
# - governance-e2e:
# name: governance-e2e-snax-testnet
- governance-e2e:
name: governance-e2e-snax-testnet
- liquidity-e2e:
name: liquidity-e2e-base-mainnet
chainId: 8453
Expand All @@ -323,7 +323,7 @@ workflows:
requires: [
tests,
liquidity-cy,
# governance-e2e-snax-testnet,
governance-e2e-snax-testnet,
liquidity-e2e-base-mainnet,
#liquidity-e2e-sepolia,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ it('Councils - Administration', () => {
cy.get('[data-cy="user-table-view-button-0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"]').should(
'not.exist'
);
cy.get('[data-cy="user-list-item-button-nomination"]').should('not.exist');
cy.get('[data-cy="user-list-item-button-nomination"]').contains('Nominate Self');
});
2 changes: 1 addition & 1 deletion governance/cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "0.0.1",
"scripts": {
"anvil:snax": "anvil --fork-url https://testnet.snaxchain.io --fork-block-number 296528",
"e2e": "cypress open --e2e --browser firefox"
"e2e": "cypress open --e2e --browser electron"
},
"devDependencies": {
"@chakra-ui/react": "^2.8.2",
Expand Down
21 changes: 13 additions & 8 deletions governance/ui/src/mutations/useEditNomination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,22 @@ export default function useEditNomination({
exact: false,
});
await Promise.all([
await query.invalidateQueries({ queryKey: ['nominees', currentNomination] }),
await query.invalidateQueries({ queryKey: ['nominees', nextNomination] }),
await query.invalidateQueries({ queryKey: ['nomineesDetails', currentNomination] }),
await query.invalidateQueries({ queryKey: ['nomineesDetails', nextNomination] }),
await query.refetchQueries({ queryKey: ['nominees', currentNomination], exact: false }),
await query.refetchQueries({ queryKey: ['nominees', nextNomination], exact: false }),
await query.refetchQueries({
query.invalidateQueries({
queryKey: ['isNominated', address],
}),
query.invalidateQueries({ queryKey: ['nominees', currentNomination] }),
query.invalidateQueries({ queryKey: ['isNominated', currentNomination] }),
query.invalidateQueries({ queryKey: ['nominees', nextNomination] }),
query.invalidateQueries({ queryKey: ['nomineesDetails', currentNomination] }),
query.invalidateQueries({ queryKey: ['nomineesDetails', nextNomination] }),
query.refetchQueries({ queryKey: ['nominees', currentNomination], exact: false }),
query.refetchQueries({ queryKey: ['nominees', nextNomination], exact: false }),
query.refetchQueries({ queryKey: ['isNominated', address], exact: false }),
query.refetchQueries({
queryKey: ['nomineesDetails', currentNomination, address],
exact: false,
}),
await query.refetchQueries({
query.refetchQueries({
queryKey: ['nomineesDetails', nextNomination, address],
exact: false,
}),
Expand Down
26 changes: 15 additions & 11 deletions governance/ui/src/mutations/useNominateSelf.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { CouncilSlugs } from '../utils/councils';
import { getCouncilContract } from '../utils/contracts';
import { useSigner } from '../queries/useWallet';
import { useNetwork, useSigner } from '../queries/useWallet';
import { useToast } from '@chakra-ui/react';
import { utils } from 'ethers';

export default function useNominateSelf(council: CouncilSlugs, address?: string) {
const query = useQueryClient();
const signer = useSigner();
const toast = useToast();
const { network } = useNetwork();

return useMutation({
mutationFn: async () => {
Expand All @@ -24,16 +25,19 @@ export default function useNominateSelf(council: CouncilSlugs, address?: string)
},
mutationKey: ['nomination', council, address],
onSuccess: async () => {
await query.invalidateQueries({
queryKey: ['isNominated', address],
});
await query.invalidateQueries({ queryKey: ['nominees', council], exact: false });
await query.invalidateQueries({
queryKey: ['nomineesDetails', council, address],
exact: false,
});
await query.refetchQueries({ queryKey: ['nominees', council], exact: false });
await query.refetchQueries({ queryKey: ['nomineesDetails', council, address], exact: false });
await Promise.all([
query.invalidateQueries({
queryKey: ['isNominated', address, network?.id],
}),
query.invalidateQueries({ queryKey: ['nominees', council], exact: false }),
query.invalidateQueries({
queryKey: ['nomineesDetails', council, address],
exact: false,
}),
query.refetchQueries({ queryKey: ['isNominated', address, network?.id], exact: false }),
query.refetchQueries({ queryKey: ['nominees', council], exact: false }),
query.refetchQueries({ queryKey: ['nomineesDetails', council, address], exact: false }),
]);
toast({
description: 'Successfully nominated yourself.',
status: 'success',
Expand Down

0 comments on commit 85f1c66

Please sign in to comment.