forked from microsoft/contosotraders-cloudtesting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
products.spec.ts
35 lines (28 loc) · 1.09 KB
/
products.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { test, expect } from '@playwright/test';
let _productid = 1;
test.skip(() => !process.env.REACT_APP_APIURL, 'requires REACT_APP_APIURL');
test.use({
baseURL: process.env.REACT_APP_APIURL + '/',
});
test.describe('Products API', () => {
// Text search API
test('should be able to load search by text data', async ({ request }) => {
const response = await request.get('./Products/search/laptops');
await expect(response).toBeOK();
});
// Load products list
test('should be able to load products list', async ({ request }) => {
const response = await request.get('./Products/?type=laptops');
await expect(response).toBeOK();
});
// Load product details
test('should be able to load product details', async ({ request }) => {
const response = await request.get('./Products/' + _productid);
await expect(response).toBeOK();
});
// Filter products by brands
test('should be able to filter products by brands', async ({ request }) => {
const response = await request.get('./Products/?type=laptops&brand=1');
await expect(response).toBeOK();
});
});