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

chore: split e2e based on envs #233

Merged
merged 4 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
42 changes: 42 additions & 0 deletions .github/workflows/playwright-playground.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Playwright Tests (Playground)
on:
push:
branches: [ playground ]
pull_request:
branches: [ playground ]

jobs:
e2e:
environment: Playground
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./apps/idos-sdk-e2e
env:
BASE_URL: ${{secrets.IDOS_E2E_BASE_URL}}
WALLET_SEED_PHRASE: ${{ secrets.IDOS_E2E_WALLET_SEED_PHRASE }}
WALLET_PASSWORD: ${{ secrets.IDOS_E2E_WALLET_PASSWORD }}
GRANTS_TEST_BASE_URL: ${{ secrets.IDOS_E2E_GRANTS_BASE_URL }}
CREDENTIAL_CONTENT: ${{ secrets.IDOS_E2E_CREDENTIAL_CONTENT }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
with:
node-version-file: './.node_version'
working-directory: ./apps/idos-sdk-e2e
- name: Install dependencies
run: pnpm i
- name: Install Playwright
run: pnpm playwright install --with-deps chromium
- name: Build Synpress cache
run: xvfb-run npx synpress tests/wallet-setup
- name: Run Playwright tests
run: xvfb-run npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Playwright Tests
name: Playwright Tests (Production)
on:
push:
branches: [ main ]
Expand All @@ -7,6 +7,7 @@ on:

jobs:
e2e:
environment: Production
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
Expand All @@ -16,6 +17,8 @@ jobs:
BASE_URL: ${{secrets.IDOS_E2E_BASE_URL}}
WALLET_SEED_PHRASE: ${{ secrets.IDOS_E2E_WALLET_SEED_PHRASE }}
WALLET_PASSWORD: ${{ secrets.IDOS_E2E_WALLET_PASSWORD }}
GRANTS_TEST_BASE_URL: ${{ secrets.IDOS_E2E_GRANTS_BASE_URL }}
CREDENTIAL_CONTENT: ${{ secrets.IDOS_E2E_CREDENTIAL_CONTENT }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
Expand Down
43 changes: 1 addition & 42 deletions apps/idos-sdk-e2e/tests/03-enclave.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,7 @@ import { MetaMask, metaMaskFixtures, testWithSynpress } from "@synthetixio/synpr
import basicSetup from "./wallet-setup/basic.setup";

// @todo: This should be created from the sdk instead of relying on hardcoded values.
const credentialContent = `{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://raw.githubusercontent.com/trustfractal/claim-schemas/686bd9c0b44f8af03831f7dc31f7d6a9b6b5ff5b/verifiable_credential/fractal_id.json-ld",
"https://w3id.org/security/suites/ed25519-2020/v1"
],
"id": "uuid:201149e1-668a-413f-9931-29b2a6828f83",
"type": [
"VerifiableCredential"
],
"issuer": "https://vc-issuers.next.fractal.id/idos",
"level": "human",
"credentialSubject": {
"id": "uuid:0b764d0c-457e-483b-9dab-79cd034f3ac5",
"wallets": [
{
"currency": "eth",
"verified": true,
"address": "0xdbf901f529a85f0fc309ee4d3ede01c6e648cf54"
}
],
"emails": [
{
"verified": false,
"address": "[email protected]"
}
]
},
"status": "approved",
"issuanceDate": "2024-05-31T18:47:33Z",
"approved_at": "2024-05-31T18:47:33Z",
"proof": {
"type": "Ed25519Signature2020",
"created": "2024-05-31T18:47:37Z",
"verificationMethod": "https://vc-issuers.next.fractal.id/idos#z6Mkqm5JuLvBcHkbQogDXz5p5ppTY4DF5FLhoRd2VM9NaKp5",
"proofPurpose": "assertionMethod",
"@context": [
"https://www.w3.org/ns/credentials/v2"
],
"proofValue": "z3UD9q9Y8TSxC8fY7RSj1YRhAkScgQgHVwn6EKguLEX69GxV3rz9JNJwik3v3W8LtWTnU8gZYBV6EgpqnEB9g4vA"
}
}`;
const credentialContent = process.env.CREDENTIAL_CONTENT as string;

const test = testWithSynpress(metaMaskFixtures(basicSetup));
const { expect } = test;
Expand Down
6 changes: 3 additions & 3 deletions apps/idos-sdk-e2e/tests/04-grants.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const test = testWithSynpress(metaMaskFixtures(basicSetup));
const { expect } = test;

test.beforeEach(async ({ context, page }) => {
test.setTimeout(120000);
test.setTimeout(500000);

await context.clearCookies();
await page.evaluate(() => window.localStorage.clear());
Expand All @@ -25,7 +25,7 @@ test("should create a grant successfully", async ({ context, page, metamaskPage,
// Get the credential ID that is going to be shared.
const credentialId = (await list.getByRole("listitem").first().getAttribute("id")) as string;

await page.goto("https://idos-example-dapp-playground.vercel.app/");
await page.goto(process.env.GRANTS_TEST_BASE_URL as string);
await context.clearCookies();
await page.evaluate(() => window.localStorage.clear());

Expand All @@ -35,8 +35,8 @@ test("should create a grant successfully", async ({ context, page, metamaskPage,
await metamask.approveSwitchNetwork();
await metamask.switchAccount("Account 1");
await metamask.connectToDapp(["Account 1"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();

await page.waitForTimeout(2000);

await page.getByText(credentialId).click();
Expand Down
Loading