import { test, expect, Page } from '@playwright/test';
import { strictEqual } from 'assert';

let page: Page;

test.beforeAll(async ({ browser }) => {
  page = await browser.newPage();
});

test.afterAll(async () => {
  if (page !== undefined) {
    await page.close();
  }
});

test('Login', async () => {
  // Login
  await page.goto('http://192.168.1.90:20001/');
  await expect(page).toHaveTitle(/^Sign in to /);
  await page.fill("input[name='username']", 'admin');
  await page.fill("input[name='password']", '1234');
  await page.click('id=kc-login');
  await page.waitForTimeout(2000);
  //   await page.click('id=acceptBtn');
});

test('Search Branch Management', async () => {
  await page.click('id=menu-icon-branch-management');
  await page.fill('id=input-Search', 'สีลม');
  await page.waitForTimeout(2000);
  await page.fill('id=input-Search', 'สีลม1');
  await page.waitForTimeout(2000);
  await page.fill('id=input-Search', 'สี');
  await page.waitForTimeout(2000);
  await page.fill('id=input-Search', '1');
  await page.waitForTimeout(2000);
  await page.fill('id=input-Search', '20/02');
  await page.waitForTimeout(2000);
  await page.fill('id=input-Search', 'เชียงใหม่');
  await page.waitForTimeout(2000);
  await page.fill('id=input-Search', 'เมือง');
  await page.waitForTimeout(2000);
  await page.fill('id=input-Search', 'ช้างเผือก');
  await page.waitForTimeout(2000);
  await page.fill('id=input-Search', 'ดำเนินการอยู่');
  await page.waitForTimeout(2000);
  await page.fill('id=input-Search', 'ปิดดำเนินการ');
  await page.waitForTimeout(2000);
});
