|
| 1 | +import { test, expect } from '@playwright/test'; |
| 2 | + |
| 3 | +/* |
| 4 | +1. Test the Find Item via Barcode page should have the correct header. |
| 5 | +2. Test the Find Item via Barcode page should have the correct main heading. |
| 6 | +3. Test the Find Item via Barcode page should load the barcode text into the input filed once scanned. |
| 7 | +4. Test the Find Item via Barcode page should have the results field. |
| 8 | +*/ |
| 9 | + |
| 10 | +const URL = '/use-case/locate-an-item-with-barcode/index.html'; |
| 11 | + |
| 12 | +test.beforeEach(async ({ page }) => { |
| 13 | + await page.goto(URL); |
| 14 | +}); |
| 15 | + |
| 16 | +test('should have correct title', async ({ page }) => { |
| 17 | + const title = await page.title(); |
| 18 | + expect(title).toBe("Dynamsoft Barcode Reader Sample - Locate an Item with Barcode"); |
| 19 | +}); |
| 20 | + |
| 21 | +test('should have main heading', async ({ page }) => { |
| 22 | + const h3 = await page.locator('#inputs-container h3'); |
| 23 | + expect(h3).not.toBeNull(); |
| 24 | + await expect(h3).toHaveText('Locate an Item with Barcode'); |
| 25 | +}); |
| 26 | + |
| 27 | +test('should load barcode text into the input field', async ({ page }) => { |
| 28 | + const inputField = await page.locator("input#item-id"); |
| 29 | + await expect(inputField).toBeEmpty(); |
| 30 | + await page.locator("button#scan-id-button").click(); |
| 31 | + await expect(inputField).not.toBeEmpty(); |
| 32 | +}); |
| 33 | + |
| 34 | +test('should have result containers', async ({ page }) => { |
| 35 | + const resultsContainer = await page.locator('#results'); |
| 36 | + expect(resultsContainer).not.toBeNull(); |
| 37 | +}); |
| 38 | + |
0 commit comments