Skip to content

Commit

Permalink
Merge pull request #148 from matter-labs/QA-577-fix-unstable-tests
Browse files Browse the repository at this point in the history
test: fix api tests
  • Loading branch information
abilevych authored Jan 17, 2024
2 parents 3a546fc + 792fc08 commit 4a65808
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Redirection

Examples:
| Extra button name | url |
| Docs | https://era.zksync.io/docs/dev/ |
| Docs | https://docs.zksync.io/build/ |
| Terms | https://zksync.io/terms |
| Contact | https://zksync.io/contact |

Expand All @@ -32,7 +32,7 @@ Feature: Redirection
@id251
Scenario: Verify redirection for Documentation link
Given I click by text "Documentation"
Then New page have "https://era.zksync.io/docs/dev/" address
Then New page have "https://docs.zksync.io/build/" address

@id252
Scenario Outline: Verify redirection for "<Sub-Section>" in BE menu
Expand Down
6 changes: 3 additions & 3 deletions packages/integration-tests/tests/api/batches.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ describe("/batches", () => {
});

//@id1514
xit("Verify the response via /batches/{batchNumber}", async () => {
await setTimeout(localConfig.standardPause); //works unstable without timeout
it("Verify the response via /batches/{batchNumber}", async () => {
await setTimeout(localConfig.extendedPause); //works unstable without timeout

const batches = await request(environment.blockExplorerAPI).get("/batches");

Expand All @@ -56,6 +56,6 @@ describe("/batches", () => {
.expect((res) => expect(typeof res.body.l1GasPrice).toStrictEqual("string"))
.expect((res) => expect(typeof res.body.l2FairGasPrice).toStrictEqual("string"))
.expect((res) => expect(typeof res.body.size).toStrictEqual("number"))
.expect((res) => expect(res.body.status).toStrictEqual("string"));
.expect((res) => expect(typeof res.body.status).toStrictEqual("string"));
});
});
4 changes: 3 additions & 1 deletion packages/integration-tests/tests/api/contracts.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as request from "supertest";
import { setTimeout } from "timers/promises";

import { environment } from "../../src/config";
import { localConfig } from "../../src/config";
Expand All @@ -24,7 +25,8 @@ describe("/api?module=contract", () => {
});

//@id1696
xit("Verify /api?module=contract&action=getcontractcreation&contractaddresses={address1},{address2} response", async () => {
it("Verify /api?module=contract&action=getcontractcreation&contractaddresses={address1},{address2} response", async () => {
await setTimeout(localConfig.standardPause);
paymasterContract = await helper.getStringFromFile(bufferFile + Buffer.paymaster);
paymasterTx = await helper.getStringFromFile(bufferFile + Buffer.paymasterDeployTx);
multicallCallerContract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallCaller);
Expand Down
6 changes: 4 additions & 2 deletions packages/integration-tests/tests/api/logs.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as request from "supertest";
import { setTimeout } from "timers/promises";

import { environment } from "../../src/config";
import { localConfig } from "../../src/config";
import { Buffer } from "../../src/entities";
import { Helper } from "../../src/helper";
import { Playbook } from "../../src/playbook/playbook";

xdescribe("/api?module=logs", () => {
describe("/api?module=logs", () => {
jest.setTimeout(localConfig.standardTimeout); //works unstable without timeout
const helper = new Helper();
const bufferFile = "src/playbook/";
Expand All @@ -22,6 +23,7 @@ xdescribe("/api?module=logs", () => {

//@id1808
it("Verify /api?module=logs&action=getLogs&page={page}&offset={offset}0&toBlock={toBlock}&fromBlock={fromBlock}&address={address} response", async () => {
await setTimeout(localConfig.standardPause);
contractAddress = await helper.getStringFromFile(bufferFile + Buffer.greeterL2);
txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx);

Expand All @@ -42,7 +44,7 @@ xdescribe("/api?module=logs", () => {
.expect((res) => expect(res.body.result[0].data.length).toBe(194))
.expect((res) => expect(typeof res.body.result[0].blockNumber).toStrictEqual("string"))
.expect((res) => expect(res.body.result[0].blockNumber.startsWith("0x")).toBe(true))
.expect((res) => expect(res.body.result[0].blockNumber.length).toBe(5))
.expect((res) => expect(typeof res.body.result[0].blockNumber.length).toStrictEqual("number"))
.expect((res) => expect(typeof res.body.result[0].timeStamp).toStrictEqual("string"))
.expect((res) => expect(res.body.result[0].timeStamp.startsWith("0x")).toBe(true))
.expect((res) => expect(res.body.result[0].timeStamp.length).toBe(10))
Expand Down
Loading

0 comments on commit 4a65808

Please sign in to comment.