Skip to content

Commit

Permalink
Th/cypress fix (#140)
Browse files Browse the repository at this point in the history

* scripts updated
  • Loading branch information
tudorgabriel authored Oct 11, 2023
1 parent fd36030 commit 701ae4a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 20 deletions.
9 changes: 8 additions & 1 deletion cypress/constants/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ export enum RoutesEnum {
dashboard = '/dashboard'
}

export enum walletIDEnum {
export enum WalletIDEnum {
unguardedWallet1 = 'check_0',
unguardedWallet2 = 'check_1',
unguardedWallet3 = 'check_2',
unguardedWallet4 = 'check_3'
}

export const enum GlobalSelectorsEnum {
connect = 'Connect',
signAutoSend = 'sign-auto-send',
sendTransactions = 'send-transactions',
swapLock = 'swap-lock'
}
11 changes: 6 additions & 5 deletions cypress/e2e/BatchTransactions/BatchTransactions.cy.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { signTransactions } from './helpers';
import { walletIDEnum } from '../../constants/enums';
import { WalletIDEnum, GlobalSelectorsEnum } from '../../constants/enums';

describe('Batch Transaction', () => {
beforeEach(() => {
cy.login(walletIDEnum.unguardedWallet1, 'Connect');
cy.login(WalletIDEnum.unguardedWallet1, 'Connect');
cy.wait(5000);
});
it('should successfully sign 5 transactions for auto-send batch', () => {
signTransactions('sign-auto-send');
signTransactions(GlobalSelectorsEnum.signAutoSend);
});

it('should successfully sign 5 transactions for send-transactions', () => {
signTransactions('send-transactions');
signTransactions(GlobalSelectorsEnum.sendTransactions);
});

it('should successfully sign 4 transactions for swap-lock', () => {
signTransactions('swap-lock');
cy.wait(3000);
signTransactions(GlobalSelectorsEnum.swapLock);
});
});
4 changes: 2 additions & 2 deletions cypress/e2e/BatchTransactions/cancelBatchTransactions.cy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { cancelTransactions } from './helpers';
import { walletIDEnum } from '../../constants/enums';
import { WalletIDEnum } from '../../constants/enums';

describe('cancelTransactions', () => {
beforeEach(() => {
cy.login(walletIDEnum.unguardedWallet1, 'Connect');
cy.login(WalletIDEnum.unguardedWallet1, 'Connect');
cy.wait(5000);
});
it('should return transaction canceled for auto-send batch ', () => {
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/BatchTransactions/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const signTransactions = (selector) => {
};

export const cancelTransactions = (selector) => {
// cy.visit('/dasboard#batchTransactions');
cy.getSelector(selector).click();
cy.getSelector(scSelectors.accesPass).type(userData.passsword);
cy.getSelector(scSelectors.submitButton).click();
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/SCTransactions/SCTransaction.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
import { pingPongHandler } from './SCActions';
import { scSelectors } from './SCTransactionData';
import { userData } from '../../assets/globalData';
import { RoutesEnum, walletIDEnum } from '../../constants/enums';
import { RoutesEnum, WalletIDEnum } from '../../constants/enums';

describe('Smart Contract Transactions', () => {
afterEach(() => {
cy.clearCookies();
});

it('should successfully execute the Ping & Pong ABI', () => {
cy.login(walletIDEnum.unguardedWallet1, 'Connect');
cy.login(WalletIDEnum.unguardedWallet1, 'Connect');
cy.wait(5000);
pingPongHandler('Abi');
});

it('should successfully execute the Ping & Pong RAW ', () => {
cy.login(walletIDEnum.unguardedWallet2, 'Connect');
cy.login(WalletIDEnum.unguardedWallet2, 'Connect');
cy.wait(5000);
pingPongHandler('Raw');
});

it('should successfully execute the Ping & Pong Service', () => {
cy.login(walletIDEnum.unguardedWallet3, 'Connect');
cy.login(WalletIDEnum.unguardedWallet3, 'Connect');
cy.wait(5000);
pingPongHandler('Raw');
});

it('should not execute ping&pong aciton', () => {
cy.login(walletIDEnum.unguardedWallet4, 'Connect');
cy.login(WalletIDEnum.unguardedWallet4, 'Connect');
cy.wait(5000);
cy.getSelector('btnPongAbi').click();
cy.getSelector(scSelectors.accesPass).type(userData.passsword);
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/Send/Send.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { userData } from '../../assets/globalData';
import { AssertionEnum, RoutesEnum, walletIDEnum } from '../../constants/enums';
import { AssertionEnum, RoutesEnum, WalletIDEnum } from '../../constants/enums';
describe('Send', () => {
beforeEach(() => {
cy.login(walletIDEnum.unguardedWallet1, 'Send transaction');
cy.login(WalletIDEnum.unguardedWallet1, 'Send transaction');
});
it('should successfully send a demo transaction', () => {
cy.checkUrl(RoutesEnum.send);
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/SignMessage/SignMessage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Routes } from 'react-router-dom';
import { userData } from '../../assets/globalData';
import { AssertionEnum, RoutesEnum, walletIDEnum } from '../../constants/enums';
import { AssertionEnum, RoutesEnum, WalletIDEnum } from '../../constants/enums';
import { scSelectors } from '../SCTransactions/SCTransactionData';

describe('Sign Message', () => {
beforeEach(() => {
cy.login(walletIDEnum.unguardedWallet1, 'Connect');
cy.login(WalletIDEnum.unguardedWallet1, 'Connect');
cy.wait(5000);
});
it('should sign', () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="cypress" />
import { userData } from '../assets/globalData';
import { AssertionEnum } from '../constants/enums';
import { AssertionEnum, GlobalSelectorsEnum } from '../constants/enums';
import { DEVNET_API } from '../constants/globalLinks';

// Check the url global function
Expand All @@ -13,7 +13,7 @@ Cypress.Commands.add('login', (walletID, selector) => {
cy.session(walletID, () => {
cy.visit('/');
cy.contains(selector).click();
if (selector === 'Connect') {
if (selector === GlobalSelectorsEnum.connect) {
cy.getSelector('webWalletLoginBtn').click();
}
cy.getSelector('keystoreBtn').click();
Expand Down

0 comments on commit 701ae4a

Please sign in to comment.