я занимаюсь написанием автотестов EDR, объясни, пожалуйста, подробно что тут происходит
import { test, expect } from '@playwright/test';
import { AgentName } from '../../../../../enums/agentName';
import { OsName, OsVersion, Platform } from '../../../../../enums/osName.enum';
import { Project } from '../../../../../enums/userRole.enum';
import { genereteString } from '../../../../../helper/generateRandomData.helper';
import { AgentList } from '../../../../../interface/service/agentList';
import { agentService } from '../../../../../service/agentService';
import { clickHouseService } from '../../../../../service/clickHouseService';
import { sshService } from '../../../../../service/sshService';
import { OperationRepeater } from '../../../../../utils/operationRepeater.utils';
import { storageHelper } from '../../../../../helper/context.helper';
import { allure } from 'allure-playwright';

test.describe.parallel('ClickHouse - UAM', () => {
  test(`UAM create user ${OsName.Astra} ${OsVersion.Astra_2_12}`, async () => {
    allure.suite(OsName.Astra);
    const agent = agentService.filterAgent(await storageHelper.getAgentList(), OsName.Astra, OsVersion.Astra_2_12)[0];
    const login = await createDeleteUser(agent);

    await runTestCreate(agent, login);
  });

  test(`UAM create user ${OsName.Ubuntu} ${OsVersion.Ubuntu_22_04}`, async () => {
    allure.suite(OsName.Ubuntu);
    const agent = agentService.filterAgent(await storageHelper.getAgentList(), OsName.Ubuntu, OsVersion.Ubuntu_22_04)[0];
    const login = await createDeleteUser(agent);

    await runTestCreate(agent, login);
  });

  test(`UAM create user ${OsName.CentOS} ${OsVersion.CentOS_7_9}`, async () => {
    allure.suite(OsName.CentOS);
    const agent = agentService.filterAgent(await storageHelper.getAgentList(), OsName.CentOS, OsVersion.CentOS_7_9)[0];
    const login = await createDeleteUser(agent);

    await runTestCreate(agent, login);
  });

  test(`UAM create user ${AgentName.Zabbix} ${OsName.Debian} ${OsVersion.Debian_11}`, async () => {
    allure.suite(OsName.Debian);
    const agent = agentService.filterAgent(await storageHelper.getAgentList(), AgentName.Zabbix)[0];
    const login = await createDeleteUser(agent);

    await runTestCreate(agent, login);
  });

  test(`UAM delete user ${OsName.Astra} ${OsVersion.Astra_2_12}`, async () => {
    allure.suite(OsName.Astra);
    const agent = agentService.filterAgent(await storageHelper.getAgentList(), OsName.Astra, OsVersion.Astra_2_12)[0];
    const login = await createDeleteUser(agent);

    await runTestDelete(agent, login);
  });

  test(`UAM delete user ${OsName.Ubuntu} ${OsVersion.Ubuntu_22_04}`, async () => {
    allure.suite(OsName.Ubuntu);
    const agent = agentService.filterAgent(await storageHelper.getAgentList(), OsName.Ubuntu, OsVersion.Ubuntu_22_04)[0];
    const login = await createDeleteUser(agent);

    await runTestDelete(agent, login);
  });

  test(`UAM delete user ${OsName.CentOS} ${OsVersion.CentOS_7_9}`, async () => {
    allure.suite(OsName.CentOS);
    const agent = agentService.filterAgent(await storageHelper.getAgentList(), OsName.CentOS, OsVersion.CentOS_7_9)[0];
    const login = await createDeleteUser(agent);

    await runTestDelete(agent, login);
  });

  test(`UAM delete user ${AgentName.Zabbix} ${OsName.Debian} ${OsVersion.Debian_11}`, async () => {
    allure.suite(OsName.Debian);
    const agent = agentService.filterAgent(await storageHelper.getAgentList(), AgentName.Zabbix)[0];
    const login = await createDeleteUser(agent);

    await runTestDelete(agent, login);
  });
});

async function runTestCreate(agent: AgentList, login: string): Promise<void> {
  const cmdCreate = 'useradd';

  await OperationRepeater.RepeatUntil(async () => (await clickHouseService.getUAM(agent.name, login, cmdCreate, 4720))[0] !== undefined, 30, 1);
  const uamCreate = await clickHouseService.getUAM(agent.name, login, cmdCreate, 4720);

  expect(uamCreate.length === 1, `length 1 !== ${uamCreate.length} username: ${login}`).toBeTruthy();
  expect(uamCreate[0].at, 'at').toEqual(Project.Rpoint);
  expect(uamCreate[0].logSource, 'logSource').toEqual(Platform.Linux);
  expect(uamCreate[0].dstacc, 'dstacc').toEqual(login);
  expect(uamCreate[0].sproc, 'sproc').toEqual(cmdCreate);
  expect(uamCreate[0].shost, 'shost').toEqual(agent.name);
  expect(uamCreate[0].eventId, 'eventId').toEqual(4720);
}

async function runTestDelete(agent: AgentList, login: string): Promise<void> {
  const cmdDelete = 'userdel';

  await OperationRepeater.RepeatUntil(async () => (await clickHouseService.getUAM(agent.name, login, cmdDelete, 4726))[0] !== undefined, 30, 1);
  const uamDelete = await clickHouseService.getUAM(agent.name, login, cmdDelete, 4726);

  expect(uamDelete.length === 1, `length 1 !== ${uamDelete.length} username: ${login}`).toBeTruthy();
  expect(uamDelete[0].at, 'at').toEqual(Project.Rpoint);
  expect(uamDelete[0].logSource, 'logSource').toEqual(Platform.Linux);
  expect(uamDelete[0].dstacc, 'dstacc').toEqual(login);
  expect(uamDelete[0].sproc, 'sproc').toEqual(cmdDelete);
  expect(uamDelete[0].shost, 'shost').toEqual(agent.name);
  expect(uamDelete[0].eventId, 'eventId').toEqual(4726);
}

async function createDeleteUser(agent: AgentList): Promise<string> {
  const login = genereteString();

  await sshService.execCommandKey(agent.ip, Project.Rpoint, `sudo useradd ${login}`);
  await OperationRepeater.RepeatUntil(
    async () => (await sshService.execCommandKey(agent.ip, Project.Rpoint, 'compgen -u')).stdout.includes(login) === true,
    10,
    1,
  );
  await sshService.execCommandKey(agent.ip, Project.Rpoint, `echo -e "testsRRTT!@\ntestsRRTT!@\n" | sudo passwd ${login}`);
  await sshService.execCommandKey(agent.ip, Project.Rpoint, `sudo userdel ${login}`);

  return login;
}