-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18a1be1
commit 312efa2
Showing
3 changed files
with
28 additions
and
1 deletion.
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
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,26 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
const fetch = require('node-fetch'); | ||
|
||
test.describe('PokeAPI Tests', () => { | ||
test('Get Pokemon List', async () => { | ||
const response = await fetch('https://pokeapi.co/api/v2/pokemon'); | ||
const pokemonList = await response.json(); | ||
expect(response.ok).toBe(true); | ||
expect(pokemonList.results).toBeDefined(); | ||
expect(pokemonList.results.length).toBeGreaterThan(0); | ||
}); | ||
|
||
test('Get Pokemon by ID', async () => { | ||
const response = await fetch('https://pokeapi.co/api/v2/pokemon/1'); | ||
const pokemon = await response.json(); | ||
expect(response.ok).toBe(true); | ||
expect(pokemon.name).toBe('bulbasaur'); | ||
}); | ||
|
||
test('Get Pokemon by Name', async () => { | ||
const response = await fetch('https://pokeapi.co/api/v2/pokemon/bulbasaur'); | ||
const pokemon = await response.json(); | ||
expect(response.ok).toBe(true); | ||
expect(pokemon.id).toBe(1); | ||
}); | ||
}); |
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