-
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
63dd2a0
commit 0423fad
Showing
1 changed file
with
22 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,22 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
|
||
test.describe('API Tests for Login Page', () => { | ||
const baseURL = 'https://www.saucedemo.com/v1/'; | ||
|
||
test('Validate Login Page Response', async ({ request }) => { | ||
const response = await request.get(baseURL); | ||
|
||
// Validate status code | ||
expect(response.status()).toBe(200); | ||
|
||
// Validate Content-Type header | ||
expect(response.headers()['content-type']).toContain('text/html'); | ||
|
||
// Validate specific content in the response | ||
const responseBody = await response.text(); | ||
expect(responseBody).toContain('<title>Swag Labs</title>'); | ||
expect(responseBody).toContain('standard_user'); | ||
expect(responseBody).toContain('secret_sauce'); | ||
expect(responseBody).toContain('id="login_button_container"'); | ||
}); | ||
}); |