@cardano-sdk/e2e 0.6.0 → 0.6.1-patch.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/test/tsconfig.tsbuildinfo +1 -0
- package/test/web-extension/extension/ui.html +2 -1
- package/test/web-extension/extension/ui.ts +7 -4
- package/test/web-extension/specs/wallet.spec.ts +25 -1
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
<button id="clearAllowList">Clear allow list</button>
|
|
25
25
|
<div>Name: <span id="observableWalletName">-</span></div>
|
|
26
26
|
<div>Address: <span id="address">-</span></div>
|
|
27
|
+
<div>Stake Address: <span id="stakeAddress">-</span></div>
|
|
27
28
|
<div>Balance: <span id="balance">-</span></div>
|
|
28
29
|
<div>Network-wide staked: <span id="supplyDistribution">-</span></div>
|
|
29
30
|
<button id="buildAndSignTx">Build & Sign TX</button>
|
|
@@ -31,4 +32,4 @@
|
|
|
31
32
|
<script src="ui.js"></script>
|
|
32
33
|
</body>
|
|
33
34
|
|
|
34
|
-
</html>
|
|
35
|
+
</html>
|
|
@@ -67,8 +67,9 @@ combineLatest([supplyDistribution.lovelaceSupply$, supplyDistribution.stake$]).s
|
|
|
67
67
|
(document.querySelector('#supplyDistribution')!.textContent = `${stake.live} out of ${lovelaceSupply.total}`)
|
|
68
68
|
);
|
|
69
69
|
|
|
70
|
-
const
|
|
71
|
-
document.querySelector('#address')!.textContent =
|
|
70
|
+
const setAddresses = ({ address, stakeAddress }: { address: string; stakeAddress: string }): void => {
|
|
71
|
+
document.querySelector('#address')!.textContent = address;
|
|
72
|
+
document.querySelector('#stakeAddress')!.textContent = stakeAddress;
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
const setBalance = (text: string): void => {
|
|
@@ -85,7 +86,7 @@ const setName = (text: string): void => {
|
|
|
85
86
|
|
|
86
87
|
const clearWalletValues = (): void => {
|
|
87
88
|
setName('-');
|
|
88
|
-
|
|
89
|
+
setAddresses({ address: '-', stakeAddress: '-' });
|
|
89
90
|
setBalance('-');
|
|
90
91
|
setSignature('-');
|
|
91
92
|
};
|
|
@@ -106,7 +107,9 @@ const walletManager = new WalletManagerUi({ walletName }, { logger, runtime });
|
|
|
106
107
|
const wallet = walletManager.wallet;
|
|
107
108
|
|
|
108
109
|
// Wallet can be subscribed can be used even before it is actually created.
|
|
109
|
-
wallet.addresses$.subscribe(([{ address }]) =>
|
|
110
|
+
wallet.addresses$.subscribe(([{ address, rewardAccount }]) =>
|
|
111
|
+
setAddresses({ address: address.toString(), stakeAddress: rewardAccount.valueOf() })
|
|
112
|
+
);
|
|
110
113
|
wallet.balance.utxo.available$.subscribe(({ coins }) => setBalance(coins.toString()));
|
|
111
114
|
|
|
112
115
|
const createWallet = async (accountIndex: number) => {
|
|
@@ -22,6 +22,8 @@ describe('wallet', () => {
|
|
|
22
22
|
const deactivateWallet = '#deactivateWallet';
|
|
23
23
|
const destroyWallet = '#destroyWallet';
|
|
24
24
|
const spanAddress = '#address';
|
|
25
|
+
const spanStakeAddress = '#stakeAddress';
|
|
26
|
+
|
|
25
27
|
const spanBalance = '#balance';
|
|
26
28
|
const spanSupplyDistribution = '#supplyDistribution';
|
|
27
29
|
const divAdaPrice = '#adaPrice';
|
|
@@ -29,8 +31,15 @@ describe('wallet', () => {
|
|
|
29
31
|
const divSignature = '#signature';
|
|
30
32
|
const activeWalletName = '#observableWalletName';
|
|
31
33
|
|
|
34
|
+
const dappBtnRun = '#bp3-tab-panel_TabsExample_1 > div > button';
|
|
35
|
+
const dappSubmittedTxConfirmation = '#root > div > p:last-child';
|
|
36
|
+
const dappChangeAddress = '#root > div > p:nth-child(11)';
|
|
37
|
+
const dappStakingAddress = '#root > div > p:nth-child(12)';
|
|
38
|
+
const dappUsedAddress = '#root > div > p:nth-child(13)';
|
|
39
|
+
|
|
32
40
|
// The address is filled in by the tests, which are order dependent
|
|
33
41
|
let walletAddr1 = '';
|
|
42
|
+
let walletStakeAddr1 = '';
|
|
34
43
|
|
|
35
44
|
const buildAndSign = async () => {
|
|
36
45
|
await $(btnSignAndBuildTx).click();
|
|
@@ -74,16 +83,31 @@ describe('wallet', () => {
|
|
|
74
83
|
}
|
|
75
84
|
});
|
|
76
85
|
walletAddr1 = await $(spanAddress).getText();
|
|
86
|
+
walletStakeAddr1 = await $(spanStakeAddress).getText();
|
|
77
87
|
expect(walletAddr1).toHaveTextContaining('addr');
|
|
88
|
+
expect(walletStakeAddr1).toHaveTextContaining('stake');
|
|
78
89
|
await expect($(activeWalletName)).toHaveText(getObservableWalletName(0));
|
|
79
90
|
});
|
|
80
91
|
it('dapp has access to cip30 WalletApi', async () => {
|
|
81
92
|
await browser.switchWindow('React App');
|
|
82
93
|
await expect($(pNetworkId)).toHaveText('Network Id (0 = testnet; 1 = mainnet): 0');
|
|
83
94
|
await browser.waitUntil($(liFirstUtxo).isExisting, { timeout: 60_000 });
|
|
84
|
-
await switchToWalletUi();
|
|
85
95
|
});
|
|
96
|
+
|
|
97
|
+
it('dapp can build and send a transaction using cip30 WalletApi', async () => {
|
|
98
|
+
await browser.switchWindow('React App');
|
|
99
|
+
await $(dappBtnRun).click();
|
|
100
|
+
await expect($(dappSubmittedTxConfirmation)).toHaveTextContaining('check your wallet');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('dapp gets correct addresses from cip30 wallet api', async () => {
|
|
104
|
+
await expect($(dappChangeAddress)).toHaveTextContaining(walletAddr1);
|
|
105
|
+
await expect($(dappStakingAddress)).toHaveTextContaining(walletStakeAddr1);
|
|
106
|
+
await expect($(dappUsedAddress)).toHaveTextContaining(walletAddr1);
|
|
107
|
+
});
|
|
108
|
+
|
|
86
109
|
it('can build and sign a transaction', async () => {
|
|
110
|
+
await switchToWalletUi();
|
|
87
111
|
await buildAndSign();
|
|
88
112
|
});
|
|
89
113
|
it('can switch to another wallet', async () => {
|