File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1
1
export const url = 'http://zero.webappsecurity.com/index.html'
2
2
export const login_username = 'username'
3
3
export const login_password = 'password'
4
- export const pokeapi_base_url = "https://pokeapi.co/api/"
4
+ export const pokeapi_base_url = "https://pokeapi.co/api/"
5
+ export const chucknorrisapi_base_url = 'https://api.chucknorris.io/'
Original file line number Diff line number Diff line change
1
+ ///<reference types ="Cypress" />
2
+ import { chucknorrisapi_base_url } from '../../../config'
3
+
4
+ beforeEach ( ( ) => {
5
+ cy . log ( 'starting test' )
6
+ } )
7
+
8
+ describe ( 'REST API Tests for api.chuchnorris.io' , ( ) => {
9
+ it ( 'API Test - Validate Status Code' , ( ) => {
10
+ cy . request ( `${ chucknorrisapi_base_url } jokes/random` ) . as ( 'joke' )
11
+ cy . get ( '@joke' ) . its ( 'status' ) . should ( 'equal' , 200 )
12
+ } )
13
+
14
+ it ( 'API Test - Validate body does contain a joke in the value field' , ( ) => {
15
+ cy . request ( `${ chucknorrisapi_base_url } jokes/random` ) . as ( 'joke' )
16
+ cy . get ( '@joke' )
17
+ . its ( 'body' )
18
+ . should ( 'have.property' , 'value' )
19
+ . and ( 'be.a' , 'string' )
20
+ } )
21
+ } )
You can’t perform that action at this time.
0 commit comments