From a7dbca546818260bb3d06786578b5e6be41b8561 Mon Sep 17 00:00:00 2001 From: asekawa Date: Tue, 13 Feb 2024 12:44:51 +0530 Subject: [PATCH] Change Command descriptions --- src/api/commands/auth.ts | 16 ++++++++-------- src/api/commands/user-managment.ts | 2 +- src/api/index.ts | 2 -- types/api/commands.d.ts | 29 +++++++++++++++++------------ 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/api/commands/auth.ts b/src/api/commands/auth.ts index 317e919..6e68ff4 100644 --- a/src/api/commands/auth.ts +++ b/src/api/commands/auth.ts @@ -10,11 +10,11 @@ import { RequestContentTypes } from "../models/api-requests"; /** - * This command use to get the Basic Authorization token - * @param {string} username - API authetication username - * @param {string} password - API authetication user password + * This command use to get the Basic Authorization header + * @param {string} username - Username of the user. + * @param {string} password - Password of the user. */ -Cypress.Commands.add("getBasicAuthentication", (username: string, password: string) => { +Cypress.Commands.add("getBasicAuthorization", (username: string, password: string) => { const encodedCredentials = btoa(username + ":" + password); @@ -23,17 +23,17 @@ Cypress.Commands.add("getBasicAuthentication", (username: string, password: stri }); /** - * This command use to get the Bearer Authorization token - * @param {string} token - Authentication token via a specific grant type ex:Client Credential + * This command use to get the Bearer Authorization header, + * @param {string} token - A valid token retreived by any grant type. */ -Cypress.Commands.add("getBearerAuthentication", (token: string) => { +Cypress.Commands.add("getBearerAuthorization", (token: string) => { return cy.wrap(`Bearer ${token}`); }); /** - * This command use to get the Authentication token via a specific grant type + * This command use to get the Authentication token via a Client Credential grant type * @param {string} serverHost - Server host endopoint * @param {string} clientID - API authetication application client ID * @param {string} clientSecret - API authetication application client Secret diff --git a/src/api/commands/user-managment.ts b/src/api/commands/user-managment.ts index 7690bcb..b60c3bb 100644 --- a/src/api/commands/user-managment.ts +++ b/src/api/commands/user-managment.ts @@ -18,8 +18,8 @@ /// -import { UserManagmentConstants } from "../models/user-management"; import { RequestContentTypes, RequestType } from "../models/api-requests"; +import { UserManagmentConstants } from "../models/user-management"; /** * This command use to create users from scim2.0 POST method diff --git a/src/api/index.ts b/src/api/index.ts index ecd6752..38e2afe 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -11,7 +11,5 @@ /// /// - import "./commands"; - export * from "./models"; diff --git a/types/api/commands.d.ts b/types/api/commands.d.ts index d69bc46..27956bd 100644 --- a/types/api/commands.d.ts +++ b/types/api/commands.d.ts @@ -28,20 +28,25 @@ declare namespace Cypress { createUserViaAPI(host: string, authzHeader: string, reqBody: Cypress.ObjectLike, failOnStatusCode?: boolean): Cypress.Chainable; - /** - * This command use to get the Authentication method with the prefered token and grant type - * @example cy.scimCreateUser("https:///domain/", "admin", "admin123", reqBody, true) - * @param {string} serverHost - Host name - * @param {string} username - API authetication username/client-ID - * @param {string} password - API authetication credentials password/client-secret - * @param {jsonbody} grantType - Prefeered grant type - * @param {boolean} authType - Prefeered authentication type - * */ - getBasicAuthentication(username: string, password: string): Cypress.Chainable; + /** + * This command use to get the Basic Authorization header + * @param {string} username - Username of the user. + * @param {string} password - Password of the user. + */ + getBasicAuthorization(username: string, password: string): Cypress.Chainable; - getBearerAuthentication(token: string): Cypress.Chainable; + /** + * This command use to get the Bearer Authorization header, + * @param {string} token - A valid token retreived by any grant type. + */ + getBearerAuthorization(token: string): Cypress.Chainable; + /** + * This command use to get the Authentication token via a Client Credential grant type + * @param {string} serverHost - Server host endopoint + * @param {string} clientID - API authetication application client ID + * @param {string} clientSecret - API authetication application client Secret + */ getTokenViaClientCredential(serverHost: string, clientID: string, clientSecret: string): Cypress.Chainable; - } }