Skip to content

Commit

Permalink
added more cs tests (#1418)
Browse files Browse the repository at this point in the history
* add CreateNFTEvent

* add metaESDT issue collection / tokens

* Create nfts.cs-e2e.ts

* Update nfts.cs-e2e.ts

* Update nfts.cs-e2e.ts

* Update nfts.cs-e2e.ts

* Update testSequencer.js

* Update accounts.cs-e2e.ts

* Update nfts.cs-e2e.ts

* temp remove issueMetaESDT

* Update accounts.cs-e2e.ts

* add prepare data script

* Update hello.cs-e2e.ts

* Update prepare-test-data.ts

* Update nfts.cs-e2e.ts

* Update prepare-test-data.ts

* Update prepare-test-data.ts

* Merge branch 'feat/chain-simulator-e2e' of https://github.com/multiversx/mx-api-service into feat/chain-simulator-e2e

* Refactor e2e tests by removing unnecessary waitForEpoch calls

- Removed `beforeAll` hooks that called `ChainSimulatorUtils.waitForEpoch(2)` from multiple e2e test files:
- This change simplifies the test setup and improves test execution time.

* Increase wait time in prepareTestData function from 20 seconds to 23 seconds to ensure proper deployment of the PingPong smart contract.

* Add end-to-end tests for tags API endpoints

- Implement tests for GET /tags, including validation of response structure, pagination, and search functionality.
- Add tests for GET /tags/count to verify the count of tags.
- Include tests for GET /tags/:tag to ensure correct tag details are returned.
- Enhance overall test coverage for the tags feature in the chain simulator.

* Add end-to-end tests for NFT collection API endpoints

- Implement tests for GET /collections/:collection/nfts to validate NFT retrieval, pagination, and filtering by various parameters (search term, identifiers, tags, creator, etc.).
- Add tests for GET /collections/:collection/nfts/count to verify NFT count based on different criteria.

* Reorder NFT collection issuance in prepareTestData function

- Moved the issuance of NFT collections to occur after funding the address and before issuing Meta-ESDT collections.
- This change improves the logical flow of the test data preparation process.

* Update balance assertions in collections e2e tests to use string comparison

- Changed balance assertions from numeric comparison (expect(account.balance).toStrictEqual(1)) to string comparison (expect(account.balance).toStrictEqual("1")) in multiple test cases.
- This ensures consistency in data type handling for balance values across the tests.

* Update collections e2e test to fetch two identifiers for NFT count validation

* Increase wait time in prepareTestData function from 23 seconds to 25 seconds

* Update collections e2e test to use string comparison for NFT supply validation

* Refactor collections e2e test to improve NFT count retrieval

* Add comprehensive e2e tests for NFT transactions and counts

* Add extensive e2e tests for NFT transfers and counts

* revert readme changes

* Increase wait time in prepareTestData function from 25 seconds to 30 seconds to allow for additional processing time during test data preparation.

* Add comprehensive e2e tests for accounts NFTs retrieval and filtering

* Update e2e test for accounts NFTs to use strict equality check for tags validation

* Add extensive e2e tests for NFT retrieval and filtering by various parameters

* Refactor e2e tests for NFT retrieval: update size parameters, improve response validation, and enhance property checks

* fixes + fixes after review

* Update e2e tests for NFT retrieval to use NFT names instead of identifiers in API requests
  • Loading branch information
cfaur09 authored Dec 16, 2024
1 parent 642aa7f commit 51c37da
Show file tree
Hide file tree
Showing 27 changed files with 2,451 additions and 207 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/chain-simulator-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
run: |
npm run start:mainnet:e2e &
sleep 10 # Wait a little more to ensure the API is fully up
- name: Prepare Test Data
run: npm run prepare:test-data

- name: Run e2e tests
run: npm run test:cs-e2e
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"copy-e2e-mainnet-config:windows": "copy .\\config\\config.e2e.mainnet.yaml .\\config\\config.yaml",
"copy-e2e-mocked-mainnet-config:windows": "copy .\\config\\config.e2e-mocked.mainnet.yaml .\\config\\config.yaml",
"start-chain-simulator": "docker compose -f \"src/test/chain-simulator/docker/docker-compose.yml\" up -d --build",
"stop-chain-simulator": "docker compose -f \"src/test/chain-simulator/docker/docker-compose.yml\" down"
"stop-chain-simulator": "docker compose -f \"src/test/chain-simulator/docker/docker-compose.yml\" down",
"prepare:test-data": "ts-node src/test/chain-simulator/utils/prepare-test-data.ts"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.54.0",
Expand Down Expand Up @@ -216,4 +217,4 @@
"node_modules"
]
}
}
}
496 changes: 468 additions & 28 deletions src/test/chain-simulator/accounts.cs-e2e.ts

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/test/chain-simulator/applications.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import axios from "axios";
import { ChainSimulatorUtils } from "./utils/test.utils";
import { config } from "./config/env.config";

describe('Applications e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

describe('GET /applications', () => {
it('should return status code 200 and a list of applications', async () => {
const response = await axios.get(`${config.apiServiceUrl}/applications`);
Expand Down
9 changes: 0 additions & 9 deletions src/test/chain-simulator/blocks.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import axios from 'axios';
import { config } from './config/env.config';
import { ChainSimulatorUtils } from './utils/test.utils';

describe('Blocks e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

beforeEach(() => {
jest.clearAllMocks();
});

describe('GET /blocks', () => {
it('should return status code 200', async () => {
const response = await axios.get(`${config.apiServiceUrl}/blocks`);
Expand Down
1,202 changes: 1,182 additions & 20 deletions src/test/chain-simulator/collections.cs-e2e.ts

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/test/chain-simulator/dapp.config.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import axios from "axios";
import { config } from "./config/env.config";
import { ChainSimulatorUtils } from "./utils/test.utils";

describe('Dapp config e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

describe('GET /dapp/config', () => {
it('should return status code 200 and dapp config', async () => {
const response = await axios.get(`${config.apiServiceUrl}/dapp/config`);
Expand Down
9 changes: 0 additions & 9 deletions src/test/chain-simulator/delegation-legacy.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import axios from 'axios';
import { config } from "./config/env.config";
import { ChainSimulatorUtils } from "./utils/test.utils";

// TODO: Uncomment this test once the legacy delegation legacy contract is deployed
describe.skip('Delegation legacy e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

beforeEach(() => {
jest.clearAllMocks();
});

describe('GET /delegations-legacy', () => {
it('should return status code 200 and a delegation legacy object details', async () => {
const response = await axios.get(`${config.apiServiceUrl}/delegation-legacy`);
Expand Down
9 changes: 0 additions & 9 deletions src/test/chain-simulator/delegation.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import axios from 'axios';
import { config } from "./config/env.config";
import { ChainSimulatorUtils } from "./utils/test.utils";

describe('Delegation e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

beforeEach(() => {
jest.clearAllMocks();
});

describe('GET /delegations', () => {
it('should return status code 200 and a delegation object details', async () => {
const response = await axios.get(`${config.apiServiceUrl}/delegation`);
Expand Down
5 changes: 0 additions & 5 deletions src/test/chain-simulator/events.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { config } from "./config/env.config";
import { ChainSimulatorUtils } from "./utils/test.utils";
import axios from "axios";

describe('Events e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

describe('GET /events', () => {
it('should return status code 200 and a list of events', async () => {
const response = await axios.get(`${config.apiServiceUrl}/events`);
Expand Down
5 changes: 0 additions & 5 deletions src/test/chain-simulator/hello.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import axios from "axios";
import { ChainSimulatorUtils } from "./utils/test.utils";
import { config } from "./config/env.config";

describe('Hello endpoint e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

describe('GET /hello', () => {
it('should return status code 200 and a hello message', async () => {
const response = await axios.get(`${config.apiServiceUrl}/hello`);
Expand Down
5 changes: 0 additions & 5 deletions src/test/chain-simulator/identities.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import axios from "axios";
import { config } from "./config/env.config";
import { ChainSimulatorUtils } from "./utils/test.utils";

describe('Identities e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

describe('GET /identities', () => {
it('should return status code 200 and a list of identities', async () => {
const response = await axios.get(`${config.apiServiceUrl}/identities`);
Expand Down
9 changes: 0 additions & 9 deletions src/test/chain-simulator/miniblocks.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import axios from 'axios';
import { config } from './config/env.config';
import { ChainSimulatorUtils } from './utils/test.utils';

describe('Miniblocks e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

beforeEach(() => {
jest.clearAllMocks();
});

describe('GET /miniblocks', () => {
it('should return status code 200', async () => {
const response = await axios.get(`${config.apiServiceUrl}/miniblocks`);
Expand Down
10 changes: 1 addition & 9 deletions src/test/chain-simulator/network.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import axios from 'axios';
import { config } from './config/env.config';
import { ChainSimulatorUtils } from './utils/test.utils';
describe('Network e2e tests with chain simulator', () => {
beforeAll(async () => {
await ChainSimulatorUtils.waitForEpoch(2);
});

beforeEach(() => {
jest.clearAllMocks();
});

describe('Network e2e tests with chain simulator', () => {
describe('GET /constants', () => {
it('should return status code 200 constants details', async () => {
const response = await axios.get(`${config.apiServiceUrl}/constants`);
Expand Down
Loading

0 comments on commit 51c37da

Please sign in to comment.