Skip to content

Commit

Permalink
Merge pull request #157 from topmonks/153-extrinsic-doesnt-load
Browse files Browse the repository at this point in the history
fix #153 - extrinsic doesn't load & #80 - speedup tests
  • Loading branch information
uiii authored Aug 18, 2023
2 parents 2137c06 + c2d699b commit d44342a
Show file tree
Hide file tree
Showing 22 changed files with 137 additions and 164 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.30.0-focal
image: mcr.microsoft.com/playwright:v1.37.0-focal
strategy:
fail-fast: false
matrix:
shardIndex: [1,2,3,4,5,6,7,8,9,10]
shardTotal: [10]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -48,7 +53,7 @@ jobs:
- name: Start app
run: npm run start:test &
- name: Run Playwright Tests
run: npx playwright test
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: Upload test screenshots artifact
uses: actions/upload-artifact@v3
if: always()
Expand All @@ -60,7 +65,7 @@ jobs:
uses: actions/upload-artifact@v3
if: always()
with:
name: test-report
name: test-blob-reports
path: test/report/
retention-days: 14
test-report:
Expand All @@ -84,8 +89,10 @@ jobs:
- name: Download test report artifact
uses: actions/download-artifact@master
with:
name: test-report
path: test/report
name: test-blob-reports
path: test/blob-reports
- name: Merge blob reports into HTML report
run: npx playwright merge-reports --config playwright.merge-reports.config.ts ./test/blob-reports
- name: Upload Argos screenshots
continue-on-error: true
env:
Expand Down
40 changes: 22 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"devDependencies": {
"@argos-ci/cli": "^0.4.4",
"@emotion/eslint-plugin": "^11.10.0",
"@playwright/test": "^1.30.0",
"@playwright/test": "^1.37.0",
"@polkadot/api": "^10.1.4",
"@polkadot/apps-config": "^0.124.1",
"@subsquid/archive-registry": "^2.1.9",
Expand Down
10 changes: 7 additions & 3 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ const config: Config = {
workers: 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
["html", {
outputFolder: "./test/report",
process.env.CI ? ["blob", {
outputDir: "./test/report",
open: "never"
}]
}] :
["html", {
outputFolder: "./test/report",
open: "never"
}]
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
Expand Down
8 changes: 8 additions & 0 deletions playwright.merge-reports.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
reporter: [
["html", {
outputFolder: "./test/report",
open: "never"
}]
]
};
8 changes: 5 additions & 3 deletions scripts/update-networks/config/squids.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
export const squidTypes = ["archive", "balances", "explorer", "main", "main-identites", "stats"] as const;
export const squidTypes = ["archive", "explorer", "main", "identites", "stats"] as const;

export const squidUrlTemplates: Record<string, (network: string) => string> = {
balances: (network: string) => `https://squid.subsquid.io/${network}-balances/graphql`,
explorer: (network: string) => `https://squid.subsquid.io/gs-explorer-${network}/graphql`,
main: (network: string) => `https://squid.subsquid.io/gs-main-${network}/graphql`,
stats: (network: string) => `https://squid.subsquid.io/gs-stats-${network}/graphql`
};

export const forceSquidUrl: Record<string, Partial<Record<typeof squidTypes[number], string>>> = {
"kusama": {
"main-identites": "https://squid.subsquid.io/gs-main-kusama/graphql"
"identites": "https://squid.subsquid.io/gs-main-kusama/graphql"
},
"polkadot": {
"identites": "https://squid.subsquid.io/gs-main-polkadot/graphql"
},
};
21 changes: 11 additions & 10 deletions src/components/DataViewerValueParsed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { RuntimeSpec } from "../model/runtimeSpec";

// found in https://github.com/polkadot-js/apps/blob/59c2badf87c29fd8cb5b7dfcc045c3ce451a54bc/packages/react-params/src/Param/findComponent.ts#L51
const ADDRESS_TYPES = ["AccountId", "AccountId20", "AccountId32", "Address", "LookupSource", "MultiAddress"];
const ADDRESS_KINDS = ["Id", "AccountId"];

const valueTableStyle = css`
width: fit-content;
Expand Down Expand Up @@ -119,8 +120,8 @@ type MaybeAccountLinkValueProps = {
const AccountValue = (props: MaybeAccountLinkValueProps) => {
const {network, value, valueMetadata, runtimeSpec} = props;

if (valueMetadata.type === "MultiAddress") {
if (value.__kind === "Id") {
if (typeof value === "object") {
if (ADDRESS_KINDS.includes(value.__kind)) {
return <ValueOfKind
network={network}
value={value}
Expand All @@ -130,15 +131,15 @@ const AccountValue = (props: MaybeAccountLinkValueProps) => {
}}
runtimeSpec={runtimeSpec}
/>;
} else {
return (
<DataViewerValueParsed
network={network}
value={value}
runtimeSpec={runtimeSpec}
/>
);
}

return (
<DataViewerValueParsed
network={network}
value={value}
runtimeSpec={runtimeSpec}
/>
);
}

return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/balances/BalancesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ function BalancesTable(props: BalancesTableProps) {
<BalancesItemsTableAttribute
label="Last update"
render={(balance) =>
<Link to={`/${network}/search?query=${balance.updatedAt}`}>
{balance.updatedAt}
<Link to={`/${network}/search?query=${balance.updatedAtBlock}`}>
{balance.updatedAtBlock}
</Link>
}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/model/accountBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type Balance = {
free: Decimal;
reserved: Decimal;
total: Decimal;
updatedAt?: number;
updatedAtBlock?: number;
}

export type AccountBalance = {
Expand Down
2 changes: 1 addition & 1 deletion src/model/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export type Balance = {
free: Decimal;
reserved: Decimal;
total: Decimal;
updatedAt?: number;
updatedAtBlock?: number;
runtimeSpec: RuntimeSpec;
}
7 changes: 0 additions & 7 deletions src/model/explorer-squid/explorerSquidAccountBalance.ts

This file was deleted.

7 changes: 7 additions & 0 deletions src/model/stats-squid/statsSquidAccountBalance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type StatsSquidAccountBalance = {
id: string;
free: string;
reserved: string;
total: string;
updatedAtBlock?: number;
}
54 changes: 3 additions & 51 deletions src/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,9 @@
"symbol": "KSM",
"squids": {
"archive": "https://kusama.explorer.subsquid.io/graphql",
"balances": "https://squid.subsquid.io/kusama-balances/graphql",
"explorer": "https://squid.subsquid.io/gs-explorer-kusama/graphql",
"main": "https://squid.subsquid.io/gs-main-kusama/graphql",
"main-identites": "https://squid.subsquid.io/gs-main-kusama/graphql",
"identites": "https://squid.subsquid.io/gs-main-kusama/graphql",
"stats": "https://squid.subsquid.io/gs-stats-kusama/graphql"
},
"coinGeckoId": "kusama"
Expand Down Expand Up @@ -369,25 +368,11 @@
"symbol": "MOVR",
"squids": {
"archive": "https://moonriver.explorer.subsquid.io/graphql",
"balances": "https://squid.subsquid.io/moonriver-balances/graphql",
"explorer": "https://squid.subsquid.io/gs-explorer-moonriver/graphql",
"main": "https://squid.subsquid.io/gs-main-moonriver/graphql"
},
"coinGeckoId": "moonriver"
},
{
"name": "opal",
"displayName": "Opal",
"icon": "/assets/network-icons/opal.png",
"color": "#40bcff",
"website": "https://docs.unique.network/unique-and-quartz-wiki/build/get-started/testnet-and-mainnet#opal-testnet",
"prefix": 42,
"decimals": 18,
"symbol": "OPL",
"squids": {
"archive": "https://archive.unique.network/opal/explorer/graphql"
}
},
{
"name": "peaq",
"displayName": "peaq",
Expand Down Expand Up @@ -447,29 +432,13 @@
"symbol": "DOT",
"squids": {
"archive": "https://polkadot.explorer.subsquid.io/graphql",
"balances": "https://squid.subsquid.io/polkadot-balances/graphql",
"explorer": "https://squid.subsquid.io/gs-explorer-polkadot/graphql",
"main": "https://squid.subsquid.io/gs-main-polkadot/graphql",
"identites": "https://squid.subsquid.io/gs-main-polkadot/graphql",
"stats": "https://squid.subsquid.io/gs-stats-polkadot/graphql"
},
"coinGeckoId": "polkadot"
},
{
"name": "quartz",
"displayName": "Quartz",
"icon": "/assets/network-icons/quartz.png",
"color": "#ff4d6a",
"website": "https://unique.network/quartz/",
"parachainId": 2095,
"relayChain": "kusama",
"prefix": 255,
"decimals": 18,
"symbol": "QTZ",
"squids": {
"archive": "https://archive.unique.network/quartz/explorer/graphql"
},
"coinGeckoId": "quartz"
},
{
"name": "robonomics",
"displayName": "Robonomics",
Expand Down Expand Up @@ -554,7 +523,6 @@
"name": "statemint",
"displayName": "Statemint",
"icon": "/assets/network-icons/statemint.png",
"color": "#86e62a",
"website": "https://www.parity.io/",
"parachainId": 1000,
"relayChain": "polkadot",
Expand Down Expand Up @@ -598,22 +566,6 @@
"archive": "https://t0rn.explorer.subsquid.io/graphql"
}
},
{
"name": "unique",
"displayName": "Unique",
"icon": "/assets/network-icons/unique.png",
"color": "#40bcff",
"website": "https://unique.network/",
"parachainId": 2037,
"relayChain": "polkadot",
"prefix": 7391,
"decimals": 18,
"symbol": "UNQ",
"squids": {
"archive": "https://archive.unique.network/unique/explorer/graphql"
},
"coinGeckoId": "unique-network"
},
{
"name": "vara",
"displayName": "Vara",
Expand All @@ -640,4 +592,4 @@
},
"coinGeckoId": "xxcoin"
}
]
]
2 changes: 1 addition & 1 deletion src/screens/network.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const NetworkPage = () => {
<TransfersTable network={network.name} transfers={transfers} showTime />
</TabPane>
}
{hasSupport(network.name, "balances-squid") &&
{hasSupport(network.name, "stats-squid") &&
<TabPane
label="Top holders"
count={topHolders.pagination.totalCount}
Expand Down
Loading

0 comments on commit d44342a

Please sign in to comment.