File tree 1 file changed +20
-1
lines changed
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
/// <reference types="Cypress" />
2
- import { pokeapi_base_url } from '../../../config'
2
+ import { pokeapi_base_url , url } from '../../../config'
3
3
4
4
describe ( 'Rest API Test with Cypress' , ( ) => {
5
5
it ( 'API Test - Validate Header' , ( ) => {
@@ -18,4 +18,23 @@ describe('Rest API Test with Cypress', () => {
18
18
. its ( 'status' )
19
19
. should ( 'equal' , 200 )
20
20
} )
21
+
22
+ it ( 'API Test - Validate Name Value' , ( ) => {
23
+ cy . request ( `${ pokeapi_base_url } v2/pokemon/25` ) . as ( 'pokemon' )
24
+ cy . get ( '@pokemon' )
25
+ . its ( 'body' )
26
+ . should ( 'include' , { name : 'pikachu' } )
27
+ } )
28
+
29
+ it ( 'API Test - Validate Negative Status Code' , ( ) => {
30
+ cy . request ( {
31
+ method : 'GET' ,
32
+ url : `${ pokeapi_base_url } v2/pokemon/10000` ,
33
+ failOnStatusCode : false
34
+ } ) . as ( 'pokemon' )
35
+ cy . get ( '@pokemon' )
36
+ . its ( 'status' )
37
+ . should ( 'equal' , 404 )
38
+
39
+ } )
21
40
} )
You can’t perform that action at this time.
0 commit comments