Skip to content

Commit

Permalink
Merge pull request #54 from etherspot/PRO-2349
Browse files Browse the repository at this point in the history
Added condition for submit transaction test cases and reduce waiting time
  • Loading branch information
Jineshdarjee authored May 21, 2024
2 parents 16fd319 + ae6845d commit eedb152
Show file tree
Hide file tree
Showing 31 changed files with 736 additions and 302 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
etherspot-prime-sdk
.eslintrc.json
.prettierrc
.prettierrc
mochawesome-report
1 change: 1 addition & 0 deletions test/data/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"fail_data_service": "The Data service is not initialled successfully.",
"fail_arka_initialize": "An error is displayed while initializating ArkaPaymaster.",
"fail_wallet_balance": "Validation of the balance of the wallet is not performed.",
"skip_transaction_error": "An error is displayed due to multiple transactions in short period, So skipping the test case.",
"_comment2": "Get Address",
"vali_zero_dev": "The Zero Dev Address is not calculated correctly.",
"fail_zero_dev": "The Zero Dev Address is not displayed successfully.",
Expand Down
20 changes: 13 additions & 7 deletions test/specs/mainnet/connext/arbitrum.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('The PrimeSDK, Validate the connext endpoints with arbitrum network on

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('The PrimeSDK, Validate the connext endpoints with arbitrum network on
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
allSupportedAssets =
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('The PrimeSDK, Validate the connext endpoints with arbitrum network on
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
supportedAssets =
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('The PrimeSDK, Validate the connext endpoints with arbitrum network on
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
quotes = await arbitrumDataService.getQuotes({
Expand Down Expand Up @@ -355,7 +355,7 @@ describe('The PrimeSDK, Validate the connext endpoints with arbitrum network on
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// clear the transaction batch
try {
Expand Down Expand Up @@ -408,8 +408,14 @@ describe('The PrimeSDK, Validate the connext endpoints with arbitrum network on
} catch (e) {
console.error(e);
const eString = e.toString();
addContext(test, eString);
assert.fail(message.fail_submitTransaction_1);
if (eString === "Error") {
console.warn(message.skip_transaction_error)
addContext(test, message.skip_transaction_error)
test.skip();
} else {
addContext(test, eString);
assert.fail(message.fail_submitTransaction_1);
}
}

// get transaction hash
Expand Down
20 changes: 13 additions & 7 deletions test/specs/mainnet/connext/matic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('The PrimeSDK, Validate the connext endpoints with matic network on the

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('The PrimeSDK, Validate the connext endpoints with matic network on the
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
allSupportedAssets =
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('The PrimeSDK, Validate the connext endpoints with matic network on the
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
supportedAssets =
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('The PrimeSDK, Validate the connext endpoints with matic network on the
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
quotes = await maticDataService.getQuotes({
Expand Down Expand Up @@ -355,7 +355,7 @@ describe('The PrimeSDK, Validate the connext endpoints with matic network on the
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// clear the transaction batch
try {
Expand Down Expand Up @@ -408,8 +408,14 @@ describe('The PrimeSDK, Validate the connext endpoints with matic network on the
} catch (e) {
console.error(e);
const eString = e.toString();
addContext(test, eString);
assert.fail(message.fail_submitTransaction_1);
if (eString === "Error") {
console.warn(message.skip_transaction_error)
addContext(test, message.skip_transaction_error)
test.skip();
} else {
addContext(test, eString);
assert.fail(message.fail_submitTransaction_1);
}
}

// get transaction hash
Expand Down
20 changes: 13 additions & 7 deletions test/specs/mainnet/connext/optimism.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('The PrimeSDK, Validate the connext endpoints with optimism network on

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('The PrimeSDK, Validate the connext endpoints with optimism network on
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
allSupportedAssets =
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('The PrimeSDK, Validate the connext endpoints with optimism network on
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
supportedAssets =
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('The PrimeSDK, Validate the connext endpoints with optimism network on
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
quotes = await optimismDataService.getQuotes({
Expand Down Expand Up @@ -355,7 +355,7 @@ describe('The PrimeSDK, Validate the connext endpoints with optimism network on
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// clear the transaction batch
try {
Expand Down Expand Up @@ -408,8 +408,14 @@ describe('The PrimeSDK, Validate the connext endpoints with optimism network on
} catch (e) {
console.error(e);
const eString = e.toString();
addContext(test, eString);
assert.fail(message.fail_submitTransaction_1);
if (eString === "Error") {
console.warn(message.skip_transaction_error)
addContext(test, message.skip_transaction_error)
test.skip();
} else {
addContext(test, eString);
assert.fail(message.fail_submitTransaction_1);
}
}

// get transaction hash
Expand Down
28 changes: 17 additions & 11 deletions test/specs/mainnet/connext/xdai.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('The PrimeSDK, Validate the connext endpoints with xdai network on the

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('The PrimeSDK, Validate the connext endpoints with xdai network on the
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
allSupportedAssets =
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('The PrimeSDK, Validate the connext endpoints with xdai network on the
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
supportedAssets =
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('The PrimeSDK, Validate the connext endpoints with xdai network on the
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

try {
quotes = await xdaiDataService.getQuotes({
Expand Down Expand Up @@ -355,7 +355,7 @@ describe('The PrimeSDK, Validate the connext endpoints with xdai network on the
if (runTest) {
await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// clear the transaction batch
try {
Expand Down Expand Up @@ -408,8 +408,14 @@ describe('The PrimeSDK, Validate the connext endpoints with xdai network on the
} catch (e) {
console.error(e);
const eString = e.toString();
addContext(test, eString);
assert.fail(message.fail_submitTransaction_1);
if (eString === "Error") {
console.warn(message.skip_transaction_error)
addContext(test, message.skip_transaction_error)
test.skip();
} else {
addContext(test, eString);
assert.fail(message.fail_submitTransaction_1);
}
}

// get transaction hash
Expand Down Expand Up @@ -1225,10 +1231,10 @@ describe('The PrimeSDK, Validate the connext endpoints with xdai network on the
assert.fail(message.fail_connext_25);
}
} catch (e) {
console.error(e);
const eString = e.toString();
addContext(test, eString);
assert.fail(message.fail_connext_25);
console.error(e);
const eString = e.toString();
addContext(test, eString);
assert.fail(message.fail_connext_25);
}
}, data.retry); // Retry this async test up to 5 times
} else {
Expand Down
6 changes: 3 additions & 3 deletions test/specs/mainnet/getAddresses/arbitrum.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -140,7 +140,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down
6 changes: 3 additions & 3 deletions test/specs/mainnet/getAddresses/matic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -140,7 +140,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down
6 changes: 3 additions & 3 deletions test/specs/mainnet/getAddresses/optimism.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -140,7 +140,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down
6 changes: 3 additions & 3 deletions test/specs/mainnet/getAddresses/xdai.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down Expand Up @@ -140,7 +140,7 @@ describe('The PrimeSDK, when get the ZeroDev address and SimpleAccount address d

await customRetryAsync(async function () {

helper.wait(data.longTimeout);
helper.wait(data.mediumTimeout);

// initializating sdk
try {
Expand Down
Loading

0 comments on commit eedb152

Please sign in to comment.