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('Select Type Branch Name Out', async () => {
  await page.click('id=menu-icon-branch-management');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[1]");
  await page.waitForTimeout(2000);
});

test('Select Type Branch Telephone No. Out', async () => {
  await page.keyboard.press('Escape');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[2]");
  await page.waitForTimeout(2000);
});
test('Select Type Branch Address Out', async () => {
  await page.keyboard.press('Escape');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[3]");
  await page.waitForTimeout(2000);
});
test('Select Type Branch Type Out', async () => {
  await page.keyboard.press('Escape');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[4]");
  await page.waitForTimeout(2000);
});

test('Select Type Branch Status Out', async () => {
  await page.keyboard.press('Escape');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[5]");
  await page.waitForTimeout(2000);
});

test('Select Type Branch Name In', async () => {
  await page.keyboard.press('Escape');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[1]");
  await page.waitForTimeout(2000);
});

test('Select Type Branch Telephone No. In', async () => {
  await page.keyboard.press('Escape');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[2]");
  await page.waitForTimeout(2000);
});
test('Select Type Branch Address In', async () => {
  await page.keyboard.press('Escape');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[3]");
  await page.waitForTimeout(2000);
});
test('Select Type Branch Type In', async () => {
  await page.keyboard.press('Escape');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[4]");
  await page.waitForTimeout(2000);
});

test('Select Type Branch Status In', async () => {
  await page.keyboard.press('Escape');
  await page.click("//span[text()='ข้อมูลที่แสดง']");
  await page.click("(//div[@role='option'])[5]");
  await page.waitForTimeout(2000);
});
