Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sancho-v1.0.4-alpha #1274

Merged
merged 65 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
8b157a8
fix: proposal sorting logic in test
NabinKawan Jun 6, 2024
430ff15
fix: proposal filtering validation in test
NabinKawan Jun 6, 2024
9871eaa
chore: Address interference from wallet connected toast notification …
NabinKawan Jun 6, 2024
9e5ebcb
chore: Remove retries for 2E, and 2S
NabinKawan Jun 6, 2024
5184431
fix: Resolve balance issue in test case 2W
NabinKawan Jun 6, 2024
aa1ec04
chore: Update temporary wallets count
NabinKawan Jun 6, 2024
cb173e3
fix: Resolve wallet popup timeout issue in voting
NabinKawan Jun 6, 2024
c1e3118
chore: Replace hardcoded dRep registration amount with protocol params
NabinKawan Jun 6, 2024
903cc51
chore: Refactor test title numbering
kneerose Jun 5, 2024
1eed031
chore: Add proposal setup to generate temporary proposal wallets
kneerose Jun 6, 2024
b12e03d
fix: Proposal submission wallet issue
kneerose Jun 6, 2024
3519400
fix: Theme provider issue in storybook
NabinKawan Jun 10, 2024
fc350fe
fix: ActionsBar interactions test
NabinKawan Jun 10, 2024
7cc82db
fix: test interaction loading button
NabinKawan Jun 10, 2024
a5da0ac
Add interaction tests for card
NabinKawan Jun 10, 2024
6033b44
Add interaction tests for checkbox
NabinKawan Jun 10, 2024
91fde96
chore: Update DashboardTopNav interaction test
NabinKawan Jun 10, 2024
67d95c9
chore: Update DelegationActionRadio interaction test
NabinKawan Jun 10, 2024
fa48c61
chore: Update footer interaction test
NabinKawan Jun 10, 2024
d8feb98
chore: Add interaction tests for (data-missing, format incorrect, not…
NabinKawan Jun 10, 2024
889e817
test: Invalid GovernanceAction details
NabinKawan Jun 11, 2024
8b22deb
chore: refactor tests for Input story and add interaction for 'helpfu…
NabinKawan Jun 11, 2024
31c1d48
test: story LinkWithIcon
NabinKawan Jun 11, 2024
365d7b5
chore: test Slider component overflow
NabinKawan Jun 11, 2024
9dd228b
test: story StatusPill
NabinKawan Jun 11, 2024
3508c5c
test: story Step
NabinKawan Jun 11, 2024
a828db2
test: story TextArea
NabinKawan Jun 11, 2024
b07a830
chore: Remove home-link in TopNav story
NabinKawan Jun 11, 2024
be10f7e
test: story loading modal
NabinKawan Jun 11, 2024
917e503
test: story Voting Power Model
NabinKawan Jun 11, 2024
789ac3b
test: story dashboard card
NabinKawan Jun 11, 2024
5ff75a3
chore: Increase interaction test timeout to 30 sec
NabinKawan Jun 11, 2024
39af694
fix: story Footer interaction (feedback-footer-button)
NabinKawan Jun 11, 2024
b1badcc
chore: Remove helps-link test from Drawer story
NabinKawan Jun 11, 2024
1923281
chore: Add auth token config for pdf-ui
NabinKawan Jun 11, 2024
91c2a65
chore: Update test-storybook script in workflow
NabinKawan Jun 11, 2024
362b598
reward address CSL validation
Sworzen1 Jun 11, 2024
b619457
add tests
Sworzen1 Jun 11, 2024
d359595
Merge pull request #1241 from IntersectMBO/fix/storybook-workflow-aut…
NabinKawan Jun 12, 2024
4c9f2b9
Merge pull request #1217 from IntersectMBO/fix/proposal-submission-wa…
NabinKawan Jun 12, 2024
41e307d
Merge pull request #1179 from IntersectMBO/fix/tests-proposal-filter
NabinKawan Jun 12, 2024
3fee2c4
Merge pull request #1182 from IntersectMBO/fix/flaky-tests
NabinKawan Jun 12, 2024
42a2be9
Merge pull request #1240 from IntersectMBO/feat/storybook-tests
NabinKawan Jun 12, 2024
0e350ea
chore: Update protocol params type to 'ProtocolParams'
NabinKawan Jun 12, 2024
53ed99e
Merge pull request #1251 from IntersectMBO/fix/1231-ga-treasury-unabl…
Sworzen1 Jun 12, 2024
5c5bb60
Merge pull request #1184 from IntersectMBO/enhancement/transaction-am…
NabinKawan Jun 12, 2024
e129035
change about to abstract
Sworzen1 Jun 12, 2024
d7b34d1
#1253 add ellipsize text for drep name
Sworzen1 Jun 12, 2024
6a53925
fix: fix governance action provider metadata creation
MSzalowski Jun 12, 2024
2cd8eba
Update docs/GOVERNANCE_ACTION_SUBMISSION.md
MSzalowski Jun 12, 2024
ac93f5f
fix: replace link with uri in all metadatas
MSzalowski Jun 12, 2024
047fb22
Merge pull request #1261 from IntersectMBO/fix/fix-references-in-json…
MSzalowski Jun 12, 2024
b66ed5d
#1257 hide delegation for delegation on myself
Sworzen1 Jun 12, 2024
2d9680b
#1257 improvememnt for abstain and no
Sworzen1 Jun 12, 2024
51b956b
#1253 improvement
Sworzen1 Jun 12, 2024
002734a
feat(#1246): update link to docs
MSzalowski Jun 12, 2024
42a9010
Merge pull request #1263 from IntersectMBO/feat/1246-update-link-to-docs
MSzalowski Jun 12, 2024
bb489f2
Merge pull request #1262 from IntersectMBO/fix/1257-dashboard-shows-d…
Sworzen1 Jun 12, 2024
983b1e0
Merge pull request #1258 from IntersectMBO/fix/1243-bug-incorrect-lab…
Sworzen1 Jun 12, 2024
09c0ade
chore: get rid of unused packages
MSzalowski Jun 12, 2024
636cf98
Merge pull request #1259 from IntersectMBO/fix/1253-dashboard-drep-ex…
Sworzen1 Jun 12, 2024
aacd543
Merge pull request #1264 from IntersectMBO/chore/get-rid-of-unused-pa…
MSzalowski Jun 12, 2024
1f569ca
fix(#1252): fix link to the GA details once in in progress
MSzalowski Jun 12, 2024
faf4605
Merge pull request #1265 from IntersectMBO/fix/1252-view-details-take…
MSzalowski Jun 12, 2024
7bdcf43
Merge pull request #1266 from IntersectMBO/develop
MSzalowski Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/test_storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ jobs:
storybook:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --max_old_space_size=4096
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm install
run: |
npm config set @intersect.mbo:registry "https://registry.npmjs.org/" --location=global
npm config set //registry.npmjs.org/:_authToken ${NPMRC_TOKEN} --location=global
npm install
- name: Install Playwright
run: npx playwright install --with-deps
- name: Build Storybook
Expand All @@ -31,4 +32,8 @@ jobs:
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && npm run test-storybook"
"npx wait-on tcp:6006 && npm run test:storybook"

env:
NODE_OPTIONS: --max_old_space_size=4096
NPMRC_TOKEN: ${{ secrets.NPMRC_TOKEN }}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ changes.
- Fix endless spinner on a dashboard [Issue 539](https://github.com/IntersectMBO/govtool/issues/539)
- Remove wrongly appended `Yourself` filter on DRep Directory [Issue 1028](https://github.com/IntersectMBO/govtool/issues/1028)
- Fix validation of uris in metadata [Issue 1011](https://github.com/IntersectMBO/govtool/issues/1011)
- Fix wrong link to the GA Details once it is in progress [Issue 1252](https://github.com/IntersectMBO/govtool/issues/1252)

### Changed

Expand Down Expand Up @@ -124,6 +125,7 @@ changes.
- Change input selection strategy to 3 (random) [Issue 575](https://github.com/IntersectMBO/govtool/issues/575)
- Changed documents to prepare for open source [Issue 737](https://github.com/IntersectMBO/govtool/issues/737)
- Changed copy on maintenance page [Issue 753](https://github.com/IntersectMBO/govtool/issues/753)
- Update link to docs [Issue 1246](https://github.com/IntersectMBO/govtool/issues/1246)

### Removed

Expand Down
45 changes: 45 additions & 0 deletions docs/GOVERNANCE_ACTION_SUBMISSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,51 @@

For creating the Governance Action, you need to consume 2 utility methods provided by `GovernanceActionProvided` (documented later within this document), and 3 exported from `CardanoProvider` wallet actions (2 for the 2 types of supported by GovTool Governance Actions and 1 for Signing and Submitting the transaction)

### Types

```typescript
import { VotingProposalBuilder } from "@emurgo/cardano-serialization-lib-nodejs";

interface GovernanceAction {
title: string;
abstract: string;
motivation: string;
rationale: string;
references: [{ label: string; uri: string }];
}

interface InfoProps {
hash: string;
url: string;
}

interface TreasuryProps {
amount: string;
hash: string;
receivingAddress: string;
url: string;
}

const createGovernanceActionJsonLD: (
governanceAction: GovernanceAction
) => NodeObject;

const createHash: (jsonLd: NodeObject) => string;

const buildNewInfoGovernanceAction: (
infoProps: InfoProps
) => Promise<VotingProposalBuilder | undefined>;

const buildTreasuryGovernanceAction: (
treasuryProps: TreasuryProps
) => Promise<VotingProposalBuilder | undefined>;

const buildSignSubmitConwayCertTx: (params: {
govActionBuilder: VotingProposalBuilder;
type: "createGovAction";
}) => Promise<void>;
```

### Step 1: Create the Governance Action metadata object

Create the Governance Action object with the fields specified by [CIP-108](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0108), which are:
Expand Down
24 changes: 12 additions & 12 deletions govtool/frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import type { Preview } from "@storybook/react";
import { ThemeProvider } from "@emotion/react";
import { theme } from "../src/theme";
import { MemoryRouter, Routes, Route } from "react-router-dom";
import { QueryClient, QueryClientProvider } from "react-query";
import type { Preview } from "@storybook/react";
import React from "react";
import { I18nextProvider } from "react-i18next";
import i18n from "../src/i18n";
import { QueryClient, QueryClientProvider } from "react-query";
import { MemoryRouter, Route, Routes } from "react-router-dom";
import { ModalProvider } from "../src/context/modal";
import i18n from "../src/i18n";
import { theme } from "../src/theme";

const queryClient = new QueryClient();

Expand All @@ -23,9 +23,9 @@ const preview: Preview = {
decorators: [
(Story) => (
<QueryClientProvider client={queryClient}>
<ModalProvider>
<I18nextProvider i18n={i18n}>
<ThemeProvider theme={theme}>
<ThemeProvider theme={theme}>
<ModalProvider>
<I18nextProvider i18n={i18n}>
<MemoryRouter>
<Routes>
<Route
Expand All @@ -44,9 +44,9 @@ const preview: Preview = {
/>
</Routes>
</MemoryRouter>
</ThemeProvider>
</I18nextProvider>
</ModalProvider>
</I18nextProvider>
</ModalProvider>
</ThemeProvider>
</QueryClientProvider>
),
],
Expand Down
13 changes: 13 additions & 0 deletions govtool/frontend/.storybook/test-runner-jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { getJestConfig } = require("@storybook/test-runner");

/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
// The default configuration comes from @storybook/test-runner
...getJestConfig(),
/** Add your own overrides below
* @see https://jestjs.io/docs/configuration
*/
testTimeout: 30000,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from "@mui/material";
import { Box, SxProps } from "@mui/material";

import { Typography } from "@atoms";
import { Share } from "@molecules";
Expand All @@ -9,12 +9,14 @@ type DataMissingHeaderProps = {
isDataMissing: MetadataValidationStatus | null;
shareLink?: string;
title?: string;
titleStyle?: SxProps;
};

export const DataMissingHeader = ({
title,
isDataMissing,
shareLink,
titleStyle,
}: DataMissingHeaderProps) => (
<Box
sx={{
Expand All @@ -39,6 +41,7 @@ export const DataMissingHeader = ({
whiteSpace: "nowrap",
fontWeight: 600,
...(isDataMissing && { color: "errorRed" }),
...titleStyle,
}}
variant="title2"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";

import { Typography } from "@atoms";
import { gray } from "@consts";
import { ellipsizeText } from "@utils";

import { Card } from "./Card";
import { DirectVoterActionProps } from "./types";
Expand Down Expand Up @@ -31,7 +32,7 @@ export const DelegationAction = ({
>
<Box sx={{ width: "90%" }}>
<Typography fontWeight={600} variant="body2">
{drepName}
{ellipsizeText(drepName, 30)}
</Typography>
<Typography
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({ ...props }) => {
}}
data-testid={`govaction-${govActionId}-view-detail`}
>
{t("govActions.viewDetails")}
{t(
inProgress
? "govActions.viewDetails"
: "govActions.viewDetailsAndVote",
)}
</Button>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ export const AutomatedVotingOptions = ({

const { networkMetrics } = useGetNetworkMetrics();

// TODO: Change to certain automated voted option if available
const onClickInfo = () => openInNewTab("https://docs.sanchogov.tools/");

const isDelegatedToAbstain =
currentDelegation ===
AutomatedVotingOptionCurrentDelegation.drep_always_abstain;
Expand Down Expand Up @@ -117,7 +114,11 @@ export const AutomatedVotingOptions = ({
onClickDelegate={() =>
delegate(AutomatedVotingOptionDelegationId.abstain)
}
onClickInfo={onClickInfo}
onClickInfo={() =>
openInNewTab(
"https://docs.sanchogov.tools/how-to-use-the-govtool/using-govtool/delegating-overview/abstain-from-every-vote",
)
}
title={
isDelegatedToAbstain
? t("dRepDirectory.delegatedToAbstainTitle", {
Expand Down Expand Up @@ -156,7 +157,11 @@ export const AutomatedVotingOptions = ({
onClickDelegate={() =>
delegate(AutomatedVotingOptionDelegationId.no_confidence)
}
onClickInfo={onClickInfo}
onClickInfo={() =>
openInNewTab(
"https://docs.sanchogov.tools/how-to-use-the-govtool/using-govtool/delegating-overview/signal-no-confidence-on-every-vote",
)
}
title={
isDelegatedToNoConfidence
? t("dRepDirectory.delegatedToNoConfidenceTitle", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export const CreateGovernanceActionForm = ({
const type = getValues("governance_action_type");
const {
append,
fields: links,
fields: references,
remove,
} = useFieldArray({
control,
name: "links",
name: "references",
});

const isContinueButtonDisabled =
Expand Down Expand Up @@ -83,18 +83,18 @@ export const CreateGovernanceActionForm = ({
}
});

const addLink = useCallback(() => append({ link: "" }), [append]);
const addLink = useCallback(() => append({ uri: "" }), [append]);

const removeLink = useCallback((index: number) => remove(index), [remove]);

const renderLinks = useCallback(
() =>
links.map((field, index) => (
references.map((field, index) => (
<ControlledField.Input
{...register(`links.${index}.link`)}
{...register(`references.${index}.uri`)}
errors={errors}
endAdornment={
links.length > 1 ? (
references.length > 1 ? (
<DeleteOutlineIcon
color="primary"
data-testid={`delete-link-${index + 1}-button`}
Expand All @@ -107,7 +107,7 @@ export const CreateGovernanceActionForm = ({
label={`${t("forms.link")} ${index + 1}`}
layoutStyles={{ mb: 3 }}
placeholder={Placeholders.LINK}
name={`links.${index}.link`}
name={`references.${index}.uri`}
rules={{
pattern: {
value: URL_REGEX,
Expand All @@ -116,7 +116,7 @@ export const CreateGovernanceActionForm = ({
}}
/>
)),
[links],
[references],
);

return (
Expand Down Expand Up @@ -145,7 +145,7 @@ export const CreateGovernanceActionForm = ({
</Typography>
<Spacer y={4.25} />
{renderLinks()}
{links?.length < MAX_NUMBER_OF_LINKS ? (
{references?.length < MAX_NUMBER_OF_LINKS ? (
<Button
data-testid="add-link-button"
onClick={addLink}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ export const ReviewCreatedGovernanceAction = ({
});

const renderLinks = () => {
const links = values.links?.map((item) => item.link) ?? [];
const areLinks = links.some((item) => item);
const references = values.references?.map((item) => item.uri) ?? [];
const areReferences = references.some((item) => item);

return areLinks ? (
return areReferences ? (
<>
<Typography
color="neutralGray"
Expand All @@ -84,14 +84,14 @@ export const ReviewCreatedGovernanceAction = ({
>
{t("createGovernanceAction.supportingLinks")}
</Typography>
{links.map(
(link: string, index: number) =>
link && (
{references.map(
(uri: string, index: number) =>
uri && (
<LinkWithIcon
dataTestId={`governance-action-link-${index + 1}-content`}
icon={<img alt="link" src={ICONS.link} />}
label={link}
onClick={() => onClickLink(link)}
label={uri}
onClick={() => onClickLink(uri)}
sx={{ mb: 1.75 }}
/>
),
Expand Down
3 changes: 2 additions & 1 deletion govtool/frontend/src/components/organisms/DRepCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { DRepData, DRepStatus } from "@models";
import { Card } from "@molecules";
import {
correctDRepDirectoryFormat,
ellipsizeText,
getMetadataDataMissingStatusTranslation,
} from "@utils";

Expand Down Expand Up @@ -103,7 +104,7 @@ export const DRepCard = ({
>
{metadataStatus
? getMetadataDataMissingStatusTranslation(metadataStatus)
: dRepName}
: ellipsizeText(dRepName ?? "", 25)}
</Typography>
<ButtonBase
data-testid={`${view}-copy-id-button`}
Expand Down
Loading
Loading