How to use the codeceptjs.output.print function in codeceptjs

To help you get started, we’ve selected a few codeceptjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-core / qa / support / lisk_util.js View on Github external
async waitUntilBlock(expectedHeight, counter) {
		const {
			data: { height },
		} = await this.call().getNodeStatus();
		const pendingTrxCnt = await this.getPendingTransactionCount();

		counter = counter ? (counter += 1) : 1;

		output.print(
			`Counter: ${counter}, Timestamp: ${new Date().toISOString()}, current height: ${height}, expected height: ${expectedHeight}, pending trxs: ${pendingTrxCnt}`
		);

		if (counter >= 20) {
			return true;
		}

		if (height >= expectedHeight) {
			// Remove the buffer time when network is stable
			if (pendingTrxCnt >= 0) {
				await this.wait(BLOCK_TIME);
			}
			return height;
		}

		await this.wait(BLOCK_TIME);
github LiskHQ / lisk-core / test / tools / network.js View on Github external
const splitDelegatesByPeers = (delegates, peers) => {
	if (peers.length === 0) {
		output.print(
			'\n',
			'***********Please run npm run tools:peers:config to generate peer list*************',
			'\n'
		);
		process.exit(1);
	}

	if (peers.length > 101) {
		peers.splice(101);
	}

	const chunkSize = Math.ceil(delegates.length / peers.length);
	const delegateList = chunkArray(delegates, chunkSize);
	return delegateList;
};
github LiskHQ / lisk-core / test / tools / network.js View on Github external
Scenario('List peers', async () => {
	try {
		const allPeers = await I.getAllPeers(100, 0);
		output.print('Peers config list: ', JSON.stringify(allPeers, null, '\t'));
	} catch (error) {
		output.print('Failed to get peers list: ');
		output.error(error);
		process.exit(1);
	}
})
	.tag('@peers_list');
github LiskHQ / lisk-core / qa / support / api.js View on Github external
async getTransactionsByState(state, params, ipAddress) {
		try {
			const client = this.getClientByAddress(ipAddress);
			return client.node.getTransactions(state, params);
		} catch (error) {
			output.print(
				'API.getTransactionsByState: Error while processing request'
			);
			output.error(error);
			await this.getTransactionsByState(state, params, ipAddress);
		}
		return true;
	}
github LiskHQ / lisk-core / qa / support / api.js View on Github external
async getPeers(params, ipAddress) {
		try {
			const client = this.getClientByAddress(ipAddress);
			return client.peers.get(params);
		} catch (error) {
			output.print('API.getPeers: Error while processing request');
			output.error(error);
			await this.getPeers(params, ipAddress);
		}
		return true;
	}
github LiskHQ / lisk-core / qa / support / api.js View on Github external
async getMultisignatureMemberships(address, params, ipAddress) {
		try {
			const client = this.getClientByAddress(ipAddress);
			return client.accounts.getMultisignatureMemberships(address, params);
		} catch (error) {
			output.print(
				'API.getMultisignatureMemberships: Error while processing request'
			);
			output.error(error);
			await this.getMultisignatureMemberships(address, params, ipAddress);
		}
		return true;
	}
github LiskHQ / lisk-core / qa / support / api.js View on Github external
async broadcastSignatures(params, ipAddress) {
		try {
			const client = this.getClientByAddress(ipAddress);
			return client.signatures.broadcast(params);
		} catch (error) {
			output.print('API.broadcastSignatures: Error while processing request');
			output.error(error);
			await this.broadcastSignatures(params, ipAddress);
		}
		return true;
	}
github LiskHQ / lisk-core / qa / support / lisk_util.js View on Github external
async broadcastAndValidateTransaction(transaction) {
		const { result, error } = await from(
			this.call().broadcastTransactions(transaction)
		);

		if (error) {
			output.print(`Failed to broadcast transaction: ${transaction.id}`);
			output.error(error);
			return;
		}
		expect(error).to.be.null;
		this.helpers.ValidateHelper.expectResponseToBeValid(
			result,
			'GeneralStatusResponse'
		);
		expect(result.data.message).to.deep.equal('Transaction(s) accepted');
	}
github LiskHQ / lisk-core / qa / support / api.js View on Github external
async getNodeStatus(ipAddress) {
		try {
			const client = this.getClientByAddress(ipAddress);
			return client.node.getStatus();
		} catch (error) {
			output.print('API.getNodeStatus: Error while processing request');
			output.error(error);
			await this.getNodeStatus(ipAddress);
		}
		return true;
	}
github LiskHQ / lisk-core / qa / support / api.js View on Github external
async getNodeConstants(ipAddress) {
		try {
			const client = this.getClientByAddress(ipAddress);
			return client.node.getConstants();
		} catch (error) {
			output.print('API.getNodeConstants: Error while processing request');
			output.error(error);
			await this.getNodeConstants(ipAddress);
		}
		return true;
	}

codeceptjs

Supercharged End 2 End Testing Framework for NodeJS

MIT
Latest version published 4 days ago

Package Health Score

92 / 100
Full package analysis