-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from palladians/chore/rise-up-fallen-web-conn…
…ector Chore/rise up fallen web connector
- Loading branch information
Showing
109 changed files
with
2,349 additions
and
3,649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { expect, test } from './extension' | ||
import { OnboardingPom } from './pom/onboarding' | ||
|
||
const VALIDATOR = 'B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb' | ||
|
||
// Note: These tests are manual | ||
test('enable window.mina and handle pop-up on a specific webpage', async ({ | ||
page, | ||
extensionId | ||
}) => { | ||
// Restore the wallet or perform any setup required by your extension before interacting with the webpage. | ||
const onboardingPom = new OnboardingPom({ page, extensionId }) | ||
await onboardingPom.restoreTestWallet() | ||
|
||
// Navigate to the webpage where the injected script should be interacted with. | ||
await page.goto('https://google.com') | ||
|
||
// Verify that window.mina is available | ||
const minaExists = await page.evaluate(() => window.mina !== undefined) | ||
expect(minaExists).toBe(true) | ||
|
||
// Trigger window.mina.enable() which should open the pop-up | ||
const enableResponse = await page.evaluate(() => window.mina.enable()) | ||
/** | ||
Click "Yes" manually | ||
*/ | ||
expect(enableResponse.result.length).toBe(1) | ||
expect(enableResponse.result[0]).toBe(VALIDATOR) | ||
|
||
const account = await page.evaluate(() => | ||
window.mina.request({ method: 'mina_accounts' }) | ||
) | ||
expect(account.result.length).toBe(1) | ||
expect(account.result[0]).toBe(VALIDATOR) | ||
|
||
const responseChainId = await page.evaluate(() => | ||
window.mina.request({ method: 'mina_chainId' }) | ||
) | ||
expect(responseChainId.result).not.toBe('...') | ||
|
||
const responseBalance = await page.evaluate(() => | ||
window.mina.request({ method: 'mina_getBalance' }) | ||
) | ||
expect(responseBalance.result).not.toBe(undefined) | ||
|
||
await page.evaluate(() => | ||
window.mina.request({ | ||
method: 'mina_setState', | ||
params: { | ||
objectName: 'New Example Credential', | ||
object: { | ||
'@context': ['https://www.w3.org/2018/credentials/v1'], | ||
id: 'http://example.edu/credentials/3732', | ||
type: ['VerifiableCredential', 'UniversityDegreeCredential'], | ||
issuer: 'University of Example', | ||
issuanceDate: '2010-01-01T00:00:00Z', | ||
credentialSubject: { | ||
id: 'did:mina:B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb', | ||
degree: { | ||
type: 'BachelorDegree', | ||
name: 'Bachelor of Science and Arts' | ||
} | ||
}, | ||
proof: { | ||
type: 'Kimchi', | ||
created: '2023-09-19T12:40:16Z', | ||
proof: { | ||
publicInput: ['0'], | ||
publicOutput: ['1'], | ||
maxProofsVerified: 0, | ||
proof: 'KChzdGF0ZW1...SkpKSkp' | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
) | ||
/** | ||
Enter password manually | ||
*/ | ||
|
||
const responseGetState = await page.evaluate(() => | ||
window.mina.request({ | ||
method: 'mina_getState', | ||
params: { query: { issuer: 'University of Example' }, props: [] } | ||
}) | ||
) | ||
/** | ||
Enter password manually | ||
*/ | ||
|
||
expect(responseGetState.result.length).toBe(2) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Pallad</title> | ||
<link rel="stylesheet" href="/src/assets/fonts.css" /> | ||
<style> | ||
:root { | ||
--popup: 1; | ||
} | ||
|
||
#root { | ||
min-height: 100vh; | ||
display: flex; | ||
} | ||
</style> | ||
<script type="module"> | ||
import { Buffer } from 'buffer' | ||
window.Buffer = Buffer | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/prompt.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.