From 2a7ed76e755857e730e70c7f969c39deba3f6b29 Mon Sep 17 00:00:00 2001 From: ShellyDCMS Date: Fri, 14 Jun 2024 08:32:26 +0300 Subject: [PATCH 1/2] add getNumberOfRequests --- src/cypress-helper.cy.ts | 4 ++++ src/cypress-helper.ts | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/cypress-helper.cy.ts b/src/cypress-helper.cy.ts index 6ff139a..063c324 100644 --- a/src/cypress-helper.cy.ts +++ b/src/cypress-helper.cy.ts @@ -135,6 +135,10 @@ describe("cypress helper tests", () => { shelly: "3" }); }); + + it("should assert number of calls", () => { + then(get.numberOfRequests("shellygo")).shouldEqual(3); + }); }); describe("interception negative tests", () => { diff --git a/src/cypress-helper.ts b/src/cypress-helper.ts index ab164bd..126343b 100644 --- a/src/cypress-helper.ts +++ b/src/cypress-helper.ts @@ -890,6 +890,19 @@ export class CypressHelper { */ numberOfElements: (dataTestID: string): Cypress.Chainable => this.get.bySelector(dataTestID).its("length"), + + /** + * Get number of outgoing request with a specific alias + * @example + * ```ts + * then(helper.get.numberOfCalls("fetch-pokemon")).shouldEqual(2); + * ``` + * @param alias + * @returns {Cypress.Chainable} + */ + numberOfRequests: (alias: string): Cypress.Chainable => + cy.get(`@${alias}.all`).its("length"), + /** * @example * ```ts From d1d518268500c150d49141189381c7008b7d0f45 Mon Sep 17 00:00:00 2001 From: Automated Version Bump Date: Fri, 14 Jun 2024 06:05:13 +0000 Subject: [PATCH 2/2] ci: version bump to 2.1.13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b3bd770..77b3a42 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@shellygo/cypress-test-utils", "description": "Cypress Test Automation Utilities", - "version": "2.1.12", + "version": "2.1.13", "author": "Shelly Goldblit", "private": false, "license": "MIT",