import { LoginPage } from '@admin-lib/index';
import { User_Type } from '@support-onboard/index';
import { ProfileInterceptApis, DelegateInfo } from '@profile-lib/index';
import { Profile } from '../../../lib/profile';

describe('Personal Travel: Delegate personal trip access', () => {
  beforeEach(() => {
    LoginPage.createNewCompanyAndLoginWithUserByType({ users: [User_Type.ADMIN] });
    ProfileInterceptApis.interceptProfileApis();
  });

  it(
    'C9712827: Should be able to set a delegate for personal trips',
    { tags: ['@tier1'] },
    () => {
      LoginPage.createNewTravelerAndLogin();
      DelegateInfo.visitProfileContactInfo();
      DelegateInfo.getDataFromCachedAdminUserAndSetHimAsDelegatedUser();
      Profile.profileDelegateInfoText();
      Profile.clickPickUser();
      Profile.getDataFromCachedAdminUserAndSetHimAsPersonalDelegatedUser();
    }
  );
});
