Skip to content

Commit dbb5a4d

Browse files
Merge pull request #397 from multiversx/development
Development
2 parents 93be7ec + 52d52a2 commit dbb5a4d

34 files changed

+469
-409
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"copy-mainnet-config": "cp ./src/config/config.mainnet.ts ./src/config/index.ts",
4141
"test": "jest",
4242
"run-playwright-test": "playwright test",
43-
"run-playwright-test-ui": "playwright test --ui"
43+
"run-playwright-test-ui": "playwright test --ui",
44+
"run-playwright-test-grep": "playwright test --grep \"$npm_config_grep\""
4445
},
4546
"browserslist": [
4647
">0.2%",

playwright.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { defineConfig, devices } from '@playwright/test';
2-
32
import { TEST_CONFIG } from './tests/config';
43

54
/**

src/hooks/transactions/useSendPingPongTransaction.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { ProxyNetworkProvider } from '@multiversx/sdk-core/out';
12
import axios from 'axios';
2-
33
import { contractAddress } from 'config';
44
import { signAndSendTransactions } from 'helpers';
55
import {
@@ -51,9 +51,17 @@ export const useSendPingPongTransaction = () => {
5151
gasPrice: BigInt(GAS_PRICE),
5252
chainID: network.chainId,
5353
sender: new Address(address),
54-
version: 1
54+
version: 2
5555
});
5656

57+
const networkProvider = new ProxyNetworkProvider(network.apiAddress);
58+
const account = await networkProvider.getAccount(new Address(address));
59+
pingTransaction.nonce = account.nonce;
60+
61+
const transactionCost =
62+
await networkProvider.estimateTransactionCost(pingTransaction);
63+
pingTransaction.gasLimit = BigInt(transactionCost.gasLimit); // overwrite default gas limit with estimation
64+
5765
const sessionId = await signAndSendTransactions({
5866
transactions: [pingTransaction],
5967
transactionsDisplayInfo: PING_TRANSACTION_INFO
@@ -102,9 +110,17 @@ export const useSendPingPongTransaction = () => {
102110
gasPrice: BigInt(GAS_PRICE),
103111
chainID: network.chainId,
104112
sender: new Address(address),
105-
version: 1
113+
version: 2
106114
});
107115

116+
const networkProvider = new ProxyNetworkProvider(network.apiAddress);
117+
const account = await networkProvider.getAccount(new Address(address));
118+
pongTransaction.nonce = account.nonce;
119+
120+
const transactionCost =
121+
await networkProvider.estimateTransactionCost(pongTransaction);
122+
pongTransaction.gasLimit = BigInt(transactionCost.gasLimit); // overwrite default gas limit with estimation
123+
108124
const sessionId = await signAndSendTransactions({
109125
transactions: [pongTransaction],
110126
transactionsDisplayInfo: PONG_TRANSACTION_INFO

src/initConfig.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import './styles/tailwind.css';
22
import './styles/style.css';
33

44
import { walletConnectV2ProjectId } from 'config';
5-
6-
// Enable this block to showcase a custom provider implementation
7-
85
import { EnvironmentsEnum, ICustomProvider, InitAppType } from './lib';
96
import { InMemoryProvider } from './provider/inMemoryProvider';
107

tests/ConnectWallet/webWallet.spec.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
import { test, expect } from '@playwright/test';
2-
1+
import { expect, test } from '@playwright/test';
32
import * as TestActions from '../support';
4-
import { TestDataEnums, SelectorsEnum } from '../support/testdata';
3+
import { SelectorsEnum, TestDataEnums } from '../support/testdata';
54

65
const keystoreConfig = {
7-
keystore: TestDataEnums.keystoreFilePath,
8-
password: TestDataEnums.keystoreFilePassword
6+
keystore: TestDataEnums.keystoreFilePath1,
7+
password: TestDataEnums.keystorePassword
98
};
109

1110
const pemConfig = {
12-
pem: TestDataEnums.pemFilePath
11+
pem: TestDataEnums.pemFilePath1
1312
};
1413

1514
test.describe('Connect a wallet', () => {
1615
// Connect wallet tests verify wallet connection functionality
17-
// Each test focuses on a specific aspect of the wallet connection process
1816

1917
test.beforeEach(async ({ page }) => {
2018
await TestActions.navigateToConnectWallet(page);
@@ -26,7 +24,7 @@ test.describe('Connect a wallet', () => {
2624

2725
await TestActions.checkConnectionToWallet(
2826
page,
29-
TestDataEnums.keystoreWalletAddress
27+
TestDataEnums.keystoreWalletAddress1
3028
);
3129
});
3230
});
@@ -37,7 +35,7 @@ test.describe('Connect a wallet', () => {
3735

3836
await TestActions.checkConnectionToWallet(
3937
page,
40-
TestDataEnums.pemWalletAddress
38+
TestDataEnums.pemWalletAddress1
4139
);
4240
});
4341
});
@@ -46,7 +44,7 @@ test.describe('Connect a wallet', () => {
4644
test('should handle missing password for keystore', async ({ page }) => {
4745
// Test with keystore but no password
4846
const invalidKeystoreConfig = {
49-
keystore: TestDataEnums.keystoreFilePath,
47+
keystore: TestDataEnums.keystoreFilePath1,
5048
password: undefined
5149
};
5250

@@ -66,7 +64,10 @@ test.describe('Connect a wallet', () => {
6664
}) => {
6765
// Connect with keystore
6866
await TestActions.navigateToConnectWallet(page);
69-
await TestActions.connectWebWallet({ page, loginMethod: keystoreConfig });
67+
await TestActions.connectWebWallet({
68+
page,
69+
loginMethod: keystoreConfig
70+
});
7071

7172
// Verify the topInfo container is visible
7273
const topInfoContainer = page.getByTestId(SelectorsEnum.topInfoContainer);
@@ -78,7 +79,7 @@ test.describe('Connect a wallet', () => {
7879
);
7980
await expect(addressElement).toBeVisible();
8081
await expect(addressElement).toContainText(
81-
TestDataEnums.keystoreWalletAddress
82+
TestDataEnums.keystoreWalletAddress1
8283
);
8384

8485
// Verify herotag section is present and should be N/A

tests/TemplateActions/nativeAuth.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { test, expect } from '@playwright/test';
2-
1+
import { expect, test } from '@playwright/test';
32
import * as TestActions from '../support';
4-
import { TestDataEnums, SelectorsEnum } from '../support/testdata';
53
import { extractBalanceFromContainer } from '../support';
4+
import { SelectorsEnum, TestDataEnums } from '../support/testdata';
65

76
const keystoreConfig = {
8-
keystore: TestDataEnums.keystoreFilePath,
9-
password: TestDataEnums.keystoreFilePassword
7+
keystore: TestDataEnums.keystoreFilePath1,
8+
password: TestDataEnums.keystorePassword
109
};
1110

1211
test.describe('Native auth', () => {
@@ -15,7 +14,7 @@ test.describe('Native auth', () => {
1514
await TestActions.connectWebWallet({ page, loginMethod: keystoreConfig });
1615
await TestActions.checkConnectionToWallet(
1716
page,
18-
TestDataEnums.keystoreWalletAddress
17+
TestDataEnums.keystoreWalletAddress1
1918
);
2019
});
2120

@@ -63,7 +62,7 @@ test.describe('Native auth', () => {
6362
.getByTestId(SelectorsEnum.trimFullAddress);
6463

6564
await expect(nativeAuthAddress).toHaveText(
66-
TestDataEnums.keystoreWalletAddress
65+
TestDataEnums.keystoreWalletAddress1
6766
);
6867

6968
// Check that the balance is displayed and matches the account balance

tests/TemplateActions/pingAndPongAbi.spec.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1-
import { test, expect } from '@playwright/test';
2-
1+
import { expect, test } from '@playwright/test';
32
import * as TestActions from '../support';
3+
import { TEST_CONSTANTS } from '../support/constants';
44
import {
5-
TestDataEnums,
6-
PingPongEnum,
75
OriginPageEnum,
8-
SelectorsEnum
6+
PingPongEnum,
7+
SelectorsEnum,
8+
TestDataEnums
99
} from '../support/testdata';
10-
import { TEST_CONSTANTS } from '../support/constants';
1110

12-
const keystoreConfig = {
13-
keystore: TestDataEnums.keystoreFilePath,
14-
password: TestDataEnums.keystoreFilePassword
11+
const pemConfig = {
12+
pem: TestDataEnums.pemFilePath1
1513
};
1614

1715
test.describe('Ping & Pong (ABI)', () => {
1816
// Note: Ping/Pong buttons have a 3-minute cooldown period after being clicked
1917

2018
test.beforeEach(async ({ page }) => {
2119
await TestActions.navigateToConnectWallet(page);
22-
await TestActions.connectWebWallet({ page, loginMethod: keystoreConfig });
20+
await TestActions.connectWebWallet({ page, loginMethod: pemConfig });
2321
await TestActions.checkConnectionToWallet(
2422
page,
25-
TestDataEnums.keystoreWalletAddress
23+
TestDataEnums.pemWalletAddress1
2624
);
2725
});
2826

@@ -106,8 +104,8 @@ test.describe('Ping & Pong (ABI)', () => {
106104
// Verify wallet page opened
107105
await expect(walletPage).toHaveURL(/devnet-wallet\.multiversx\.com/);
108106

109-
// Sign transaction by confirming with keystore or pem
110-
await TestActions.confirmWalletTransaction(walletPage, keystoreConfig);
107+
// Sign transaction by confirming with pem
108+
await TestActions.confirmWalletTransaction(walletPage, pemConfig);
111109

112110
// Click on Sign button to confirm the transaction in the web wallet
113111
await walletPage.getByTestId(SelectorsEnum.signButton).click();
@@ -121,9 +119,6 @@ test.describe('Ping & Pong (ABI)', () => {
121119
// Wait for transaction toast to be displayed
122120
await TestActions.waitForToastToBeDisplayed(templatePage);
123121

124-
// Wait for the transaction toast to be closed (indicates transaction completed)
125-
await TestActions.waitForToastToBeClosed(templatePage);
126-
127122
// Check balance change based on the clicked button
128123
await TestActions.checkPingPongBalanceUpdate({
129124
page: templatePage,

tests/TemplateActions/signAndSendBatch.spec.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import { test, expect } from '@playwright/test';
2-
1+
import { expect, test } from '@playwright/test';
32
import * as TestActions from '../support';
3+
import { TEST_CONSTANTS } from '../support/constants';
44
import {
5-
TestDataEnums,
5+
OriginPageEnum,
66
SelectorsEnum,
7-
OriginPageEnum
7+
TestDataEnums
88
} from '../support/testdata';
9-
import { TEST_CONSTANTS } from '../support/constants';
109

1110
const keystoreConfig = {
12-
keystore: TestDataEnums.keystoreFilePath,
13-
password: TestDataEnums.keystoreFilePassword
11+
keystore: TestDataEnums.keystoreFilePath2,
12+
password: TestDataEnums.keystorePassword
1413
};
1514

1615
test.describe('Sign & send batch', () => {
@@ -19,7 +18,7 @@ test.describe('Sign & send batch', () => {
1918
await TestActions.connectWebWallet({ page, loginMethod: keystoreConfig });
2019
await TestActions.checkConnectionToWallet(
2120
page,
22-
TestDataEnums.keystoreWalletAddress
21+
TestDataEnums.keystoreWalletAddress2
2322
);
2423
});
2524

@@ -96,7 +95,7 @@ test.describe('Sign & send batch', () => {
9695
// Check that the transaction toast shows that all transactions are signed
9796
await TestActions.waitForTransactionToastToContain({
9897
page: templatePage,
99-
toastContent: '5 / 5 transactions processed'
98+
toastStatus: '5 / 5 transactions processed'
10099
});
101100

102101
// Wait for the transaction toast to be closed

tests/TemplateActions/signMessage.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { test, expect } from '@playwright/test';
2-
1+
import { expect, test } from '@playwright/test';
32
import * as TestActions from '../support';
43
import {
5-
TestDataEnums,
4+
OriginPageEnum,
65
SelectorsEnum,
7-
OriginPageEnum
6+
TestDataEnums
87
} from '../support/testdata';
98

109
const keystoreConfig = {
11-
keystore: TestDataEnums.keystoreFilePath,
12-
password: TestDataEnums.keystoreFilePassword
10+
keystore: TestDataEnums.keystoreFilePath1,
11+
password: TestDataEnums.keystorePassword
1312
};
1413

1514
test.describe('Sign Message', () => {
@@ -18,7 +17,7 @@ test.describe('Sign Message', () => {
1817
await TestActions.connectWebWallet({ page, loginMethod: keystoreConfig });
1918
await TestActions.checkConnectionToWallet(
2019
page,
21-
TestDataEnums.keystoreWalletAddress
20+
TestDataEnums.keystoreWalletAddress1
2221
);
2322
});
2423

tests/TemplateActions/swapAndLock.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import { test, expect } from '@playwright/test';
2-
1+
import { expect, test } from '@playwright/test';
32
import * as TestActions from '../support';
3+
import { TEST_CONSTANTS } from '../support/constants';
44
import {
5-
TestDataEnums,
5+
OriginPageEnum,
66
SelectorsEnum,
7-
OriginPageEnum
7+
TestDataEnums
88
} from '../support/testdata';
9-
import { TEST_CONSTANTS } from '../support/constants';
109

1110
const keystoreConfig = {
12-
keystore: TestDataEnums.keystoreFilePath,
13-
password: TestDataEnums.keystoreFilePassword
11+
keystore: TestDataEnums.keystoreFilePath3,
12+
password: TestDataEnums.keystorePassword
1413
};
1514

1615
test.describe('Swap & Lock', () => {
@@ -19,7 +18,7 @@ test.describe('Swap & Lock', () => {
1918
await TestActions.connectWebWallet({ page, loginMethod: keystoreConfig });
2019
await TestActions.checkConnectionToWallet(
2120
page,
22-
TestDataEnums.keystoreWalletAddress
21+
TestDataEnums.keystoreWalletAddress3
2322
);
2423
});
2524

@@ -100,7 +99,10 @@ test.describe('Swap & Lock', () => {
10099
// Check that the transaction toast shows that all transactions were signed
101100
await TestActions.waitForTransactionToastToContain({
102101
page: templatePage,
103-
toastContent: '0 / 4 transactions processed'
102+
toastStatus: '4 / 4 transactions processed'
104103
});
104+
105+
// Wait for the transaction toast to be closed
106+
await TestActions.waitForToastToBeClosed(templatePage);
105107
});
106108
});

0 commit comments

Comments
 (0)