Skip to content

Commit

Permalink
Upstream merge (#4)
Browse files Browse the repository at this point in the history
* Updating e2e tests readme (paritytech#375)

* Fixing e2e readme link

* Adding runtimeRestarter (paritytech#376)

Fixes paritytech#223

+ Adding prom-client dependency, because it was removed from
@eng-automation/js (rightfully so)

* Updating zombinenet verion in e2e docs (paritytech#378)

@josepot has reported an error with `@zombienet/cli@1.3.43`, while the
latest version worked

* Using PAPI for e2e tests (paritytech#379)

* Currently, e2e types are generated on postinstall and prebuild steps,
which requires metadata to be available in Docker image, even though
it's not technically used in the application code. I think separating
things would make things more complicated, but it's possible.
* Couldn't undestand the reason for having two different COPY
instructions
in Dockerfile, but that doesn't live well with generating types in
postinstall, so merging those two
* .scale metadata files from Zombienet hosts saved in the codebase,
in order to be able to compile the code separately from running
Zombienet

* Bump the npm_and_yarn group across 2 directories with 2 updates (paritytech#381)

* removed base url (paritytech#382)

This removes the base url, making the website work on the root of the
domain.

Also, by doing this change, and having set up the dns, this resolves
paritytech#348

* Added markup code generation (paritytech#383)

It generates a JSON object inside the header following the instructions
from:
https://developers.google.com/search/docs/appearance/structured-data/faqpage

It parses the information of the markdown text to generate this json
object.

This resolves paritytech#277

* Updated actions to latest and added retention period (paritytech#384)

We currently don't have an artifact retention period, so it defaults to
90 days.

While the artifact for the site is not too big, having one build per
push and PR can quickly accumulate the amount and make us hit our hard
limit.

By adding a limit to the retention day of 5 days we ensure that we get
rid of the old artifacts faster than waiting for two whole months.

I also updated all the actions version to latest release

* Bump the npm_and_yarn group across 1 directory with 1 update (paritytech#385)

* Bump the npm_and_yarn group across 1 directory with 1 update (paritytech#387)

* Update Frequency Faucet URL (paritytech#393)

As the Frequency Faucet now also supports Frequency Paseo testnet in
addition to the Rococo one, the url is being set to a generic one
instead of specific for the network.

https://faucet.testnet.frequency.xyz/

* moved tag-client to work in pull_request_target (paritytech#394)

It fails when an external contributors make a PR.

This will fix that issue.

* Merge latest upstream and use a transaction queue to send txs to nodes

* Add MIT LICENSE (paritytech#395)

* bump to polkadot 10.13.1

* lockfile

* yarn.lock

* yarn.lock

* yarn.lock

* yarn.lock

* yarn.lock client

* Fix test mock

* Add @polkadot/util to dev dependencies

* Address comments from @mutantcornholio

---------

Co-authored-by: Yuri Volkov <0@mcornholio.ru>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Javier Bullrich <javier@bullrich.dev>
Co-authored-by: Wil Wade <wil@wilwade.com>
Co-authored-by: Maksym H <1177472+mordamax@users.noreply.github.com>
  • Loading branch information
6 people authored Apr 29, 2024
1 parent b397ef5 commit 722c604
Show file tree
Hide file tree
Showing 20 changed files with 1,433 additions and 4,309 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
working-directory: client
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
- name: Install node
uses: actions/setup-node@v2
uses: actions/setup-node@v4.0.2
with:
node-version: 18
node-version: 20
- run: yarn install --frozen-lockfile
- run: yarn run check
- name: Install Playwright
Expand All @@ -33,11 +33,12 @@ jobs:
PUBLIC_CAPTCHA_KEY: 6LcgFI4nAAAAAATrEMoJ6zBacsx5udc1UhGFXemH
GITHUB_PAGES: "/${{ github.event.repository.name }}"
STATIC: true
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4.3.1
with:
name: faucet
path: ./client/build
if-no-files-found: error
retention-days: 5
deploy-to-github-pages:
environment:
name: github-pages
Expand All @@ -47,18 +48,18 @@ jobs:
needs: [build-faucet]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
- name: Download page
uses: actions/download-artifact@master
uses: actions/download-artifact@v4.1.4
with:
name: faucet
path: ./dist
- name: Setup Pages
uses: actions/configure-pages@v2
uses: actions/configure-pages@v4.0.0
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3.0.1
with:
path: ./dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4.0.5
2 changes: 1 addition & 1 deletion .github/workflows/tag-client-pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Label Client PRs

on:
pull_request:
pull_request_target:
paths:
- 'client/**'

Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Parity Technologies

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"devDependencies": {
"@playwright/test": "^1.40.0",
"@polkadot/util": "^12.6.2",
"@sveltejs/adapter-auto": "^2.1.1",
"@sveltejs/adapter-node": "^1.3.1",
"@sveltejs/adapter-static": "^2.0.3",
Expand All @@ -30,7 +31,7 @@
"tailwindcss": "^3.3.5",
"tslib": "^2.6.2",
"typescript": "^5.3.2",
"vite": "^5.0.12"
"vite": "^5.0.13"
},
"type": "module"
}
2 changes: 2 additions & 0 deletions client/src/lib/components/Faucet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { operation, testnet } from "$lib/utils/stores";
import { onMount } from "svelte";
import { fly } from "svelte/transition";
import MarkUp from "./MarkUp.svelte";
export let faq: string;
export let network: NetworkData;
Expand All @@ -25,6 +26,7 @@

<main>
<SocialTags />
<MarkUp {faq} />
<div class="flex items-center justify-center mt-16 mb-4 md:my-16">
<Card>
{#if !$operation}
Expand Down
56 changes: 56 additions & 0 deletions client/src/lib/components/MarkUp.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<script lang="ts">
import { serializeLd } from "$lib/utils";
import { onMount } from "svelte";
export let faq: string;
type QuestionAndAnswer = {
"@type": "Question";
name: string;
acceptedAnswer: {
"@type": "Answer";
text: string;
};
};
let faqHeader: string;
onMount(() => {
const lines = faq.split("\n").filter((line) => line.trim().length > 0);
let index = -1;
const questions: [string, string[]][] = [];
for (const line of lines) {
if (line.startsWith("#")) {
questions[++index] = [line, []];
} else {
questions[index][1].push(line);
}
}
const questionWithAnswers: QuestionAndAnswer[] = questions.map(
([question, answer]) =>
({
"@type": "Question",
name: question,
acceptedAnswer: {
"@type": "Answer",
text: `<p>${answer.join("<br/>")}</p>`,
},
}) as QuestionAndAnswer,
);
const faqSchema = {
"@context": "https://schema.org",
"@type": "FAQPage",
mainEntity: questionWithAnswers,
};
faqHeader = JSON.stringify(faqSchema);
});
</script>

<!-- eslint-disable svelte/no-at-html-tags -->
<svelte:head>
{@html serializeLd(faqHeader)}
</svelte:head>
2 changes: 1 addition & 1 deletion client/src/lib/components/NetworkDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</li>
{/each}
<li>
<a href="https://faucet.rococo.frequency.xyz">Frequency</a>
<a href="https://faucet.testnet.frequency.xyz">Frequency</a>
</li>
</ul>
</div>
Expand Down
2 changes: 2 additions & 0 deletions client/src/lib/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from "./faucetRequest";

export const serializeLd = (faqHeader: string): string => `<script type="application/ld+json">${faqHeader}</script>`;
8 changes: 6 additions & 2 deletions client/tests/faucet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type Frame, type FullConfig, type Locator, type Page, expect, test } from "@playwright/test";
import {stringToHex} from "@polkadot/util";

type FormSubmit = {
address: string;
Expand Down Expand Up @@ -40,11 +41,14 @@ const getFormElements = async (page: Page, captchaProvider: "recaptcha" | "proca
const testProvider = "https://mockprovider.prosopo.io"; // Mock provider

// Tell the page that a captcha provider has previously been used and inject the mock provider
await page.evaluate((provider) => localStorage.setItem("@prosopo/provider", provider), testProvider);
const testStorage = stringToHex(JSON.stringify({account: testAccount, providerUrl: testProvider, blockNumber: 1}));
await page.evaluate((storage) => {
localStorage.setItem("@prosopo/procaptcha", storage)
}, testStorage);

// Mock the verify api call and inject Alice's address before clicking the captcha
await page.route("*/**/v1/prosopo/provider/verify", async (route) => {
const json = { user: testAccount, dapp: testSiteKey };
const json = { user: testAccount, dapp: testSiteKey, blockNumber: 1 };
await route.continue({ postData: json });
});
captcha = page.locator("#captcha_element input[type='checkbox']");
Expand Down
Loading

0 comments on commit 722c604

Please sign in to comment.