Skip to content

Commit

Permalink
Merge pull request #46 from wso2/aw/2
Browse files Browse the repository at this point in the history
Change Command descriptions
  • Loading branch information
asekawa authored Feb 13, 2024
2 parents 72092cd + a7dbca5 commit 3e49296
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
16 changes: 8 additions & 8 deletions src/api/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/api/commands/user-managment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

/// <reference types="cypress" />

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
Expand Down
2 changes: 0 additions & 2 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@
/// <reference types="cypress" />
/// <reference path="../../types/api/commands.d.ts" />


import "./commands";

export * from "./models";
29 changes: 17 additions & 12 deletions types/api/commands.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,25 @@ declare namespace Cypress {
createUserViaAPI(host: string, authzHeader: string, reqBody: Cypress.ObjectLike,
failOnStatusCode?: boolean): Cypress.Chainable<any>;

/**
* This command use to get the Authentication method with the prefered token and grant type
* @example cy.scimCreateUser("https://<hostname>/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<any>;
/**
* 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<any>;

getBearerAuthentication(token: string): Cypress.Chainable<any>;
/**
* 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<any>;

/**
* 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<any>;

}
}

0 comments on commit 3e49296

Please sign in to comment.