import AppHomePage from '../pages/v10/app-home.po.js'
import EuiAlertPage from '../pages/v10/eui-alert.po.js'
import Routing from '../pages/routing.js'

describe('01.01.HomePage - Open Homepage and check elements', async() => {

  it('should open home page', async() => {
    browser.addTestMeta({
      uuid: "66ba19e0-b104-11ec-b909-0242ac120002", zephyrKey: "XXXX-999", zephyrStep: "9999991", reportGroups: ["GENERAL"],
      testedSystems: []
    });
    let homePage = new AppHomePage();
    await homePage.open(Routing.homeUrl);
    await expect(await homePage.euiAppCO.euiAppToolbarCO.element()).toBeDisplayed({ wait: 40000, message: 'EUI App toolbar did not appear' });
  }, 3);

  it('should open eui-alert page', async() => {
    let alertPage = new EuiAlertPage();
    await alertPage.open(Routing.euiAlertComponent);
    let myAlert = await alertPage.euiAlertCO.byIndex(10).element();
    await expect(myAlert).toBeExisting({ wait: 10000, message: 'Tenth EUI Alert component does not exist' });
    await myAlert.scrollIntoView();
    await expect(myAlert).toBeDisplayed({ wait: 1000, message: 'Tenth EUI Alert component is not displayed' });
  });
  
  it('network log', async () => {
    browser.logPuppeteerNetwork();
  });
})
