import { LoginPage } from '@admin-lib/index';
import { OfficeGuides } from '@profile-lib/office-guides';
import { User_Type } from '@support-onboard/index';

describe('Trips: Office Guides tests', () => {
  beforeEach(() => {
    cy.session('officeGuides', () => {
      LoginPage.createNewCompanyAndLoginWithUserByType({ users: [User_Type.ADMIN] });
      OfficeGuides.visitAdminOrgPage();
      OfficeGuides.createLegalEntity();
      OfficeGuides.createOfficeGuide();
    });
  });

  it(
    'C127262: As an admin, there are toggles next to each office that enable/disable visibility for each office',
    { tags: ['@tier3'] },
    () => {
      OfficeGuides.visitOfficeGuidesPage();
      OfficeGuides.verifyOfficeToggles();
    }
  );

  it(
    'C127263: Users can search for offices using the search field',
    { tags: ['@tier3'] },
    () => {
      const officeSearch = 'SF Office';
      OfficeGuides.visitOfficeGuidesPage();
      OfficeGuides.verifyOfficeSearch(officeSearch);
    }
  );
});
