import Routing from '../../../../pages/eui/10x/routing-10x.js'
import CookieBannerActions from '../../../../actions/cookieBanner.js'
import AmarkerPage from '../../../../pages/eui/10x/ux/ux-a-marker-10x.po.js'

describe('eUI - <ux-a-marker> Component Object @CCQA-703', async() => {
  let markerPage = new AmarkerPage();
  it('should navigate to <ux-a-marker> component @354145', async() => {
    await markerPage.open(Routing.getUxComponentUrl('ux-a-marker'));
    await CookieBannerActions.cookieBanner(true);
    let pgTitle = await $(markerPage.pageTitle);
    let appDocPageId = await $(markerPage.appDocPageById('ux-a-marker'));
    let navigationList = await $(markerPage.navigationList);
    await pgTitle.scrollIntoView();
    await expect(pgTitle).toBeDisplayed({wait:1000, message:'<ux-a-marker> page title is not visible on page'});
    await expect(await pgTitle.getText()).toBe('ux-a-marker', 'Page title text is not as expected')
    await expect(appDocPageId).toExist({wait:1000, message:'Page Id is not present in page'});
    await expect(navigationList).toBeDisplayed({wait:1000, message:'Navigation List -> is not visible on page'});
  });
  it('should verify the presence of the Component Object on the page @354146', async() => {
    let co1 = await $(markerPage.markerFromSectionById('Default').markerDataDiv);
    let co2 = await $(markerPage.markerByIndex(1).markerDataDiv);

    await expect(co1).toExist({wait:1000, message:'<Default> section -> is not visible on page'});
    await expect(co2).toExist({wait:1000, message:'Marker by index "1" is not visible on page'});
    await chaiExpect(await markerPage.markerByIndex(1).defaultComponentsCount()).equal(32, 'There should be 32 <ux-a-marker> components on the page.')
  });
  it('should verify the ux-a-marker CO typeclass property @354147', async() => {
    let sectionId= 'typeClass';
    let section = await $(markerPage.sectionById(sectionId));
    await section.scrollIntoView();
    await expect(await markerPage.markerFromSectionWithIdByIndex(sectionId,1).typeClass()).toBe('primary');
    await expect(await markerPage.markerFromSectionWithIdByIndex(sectionId,2).typeClass()).toBe('secondary');
    await expect(await markerPage.markerFromSectionWithIdByIndex(sectionId,3).typeClass()).toBe('info');
    await expect(await markerPage.markerFromSectionWithIdByIndex(sectionId,4).typeClass()).toBe('success');
    await expect(await markerPage.markerFromSectionWithIdByIndex(sectionId,5).typeClass()).toBe('warning');
    await expect(await markerPage.markerFromSectionWithIdByIndex(sectionId,6).typeClass()).toBe('danger');
  });
});
