-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cypress test case for cypress-docs API
Signed-off-by: veerendra thakur <[email protected]>
- Loading branch information
1 parent
0a212dc
commit 8fed1bb
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {validateApiResponse,validate_200_Status,getTokenKey} from '../support/commands' | ||
|
||
describe("To Validate & get api-docs via API call", function () { | ||
|
||
|
||
//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/docs | ||
const claEndpoint = `${Cypress.env("APP_URL")}cla-service/v4`; | ||
|
||
let bearerToken: string = null; | ||
before(() => { | ||
if(bearerToken==null){ | ||
getTokenKey(bearerToken); | ||
cy.window().then((win) => { | ||
bearerToken = win.localStorage.getItem('bearerToken'); | ||
}); | ||
} | ||
}); | ||
|
||
it("Endpoint to render the API documentation- Record should Returns 200 Response", function () { | ||
cy.request({ | ||
method: 'GET', | ||
url: `${claEndpoint}/api-docs`, | ||
auth: { | ||
'bearer': bearerToken, | ||
} | ||
}).then((response) => { | ||
validate_200_Status(response); | ||
}); | ||
}); | ||
|
||
it("Returns the Swagger specification as a JSON document- Record should Returns 200 Response", function () { | ||
cy.request({ | ||
method: 'GET', | ||
url: `${claEndpoint}/swagger.json`, | ||
auth: { | ||
'bearer': bearerToken, | ||
} | ||
}).then((response) => { | ||
validate_200_Status(response); | ||
}); | ||
}); | ||
|
||
}) |