This repository has been archived on 2025-04-22. You can view files and clone it, but cannot push or open issues or pull requests.
hlk_autotest/tests/utils/customer.ts
LingandRX 6517e4192c feat: 初始化慧来客自动化测试项目
- 添加项目配置文件和环境变量设置
- 创建测试用例目录结构和命名规范
- 实现基础测试 fixture 和页面对象模型
- 添加示例测试用例和数据生成器
- 配置 playwright 和 gitignore 文件
2024-12-22 19:18:27 +08:00

41 lines
1.2 KiB
TypeScript

import { faker } from '@faker-js/faker/locale/zh_CN';
export type employee = { level: string, name: string };
interface CustomerOptions {
username?: string;
phone?: string;
archive?: string;
gender?: number;
source?: number;
birthday?: { year: number; month: number; day: number };
remark?: string;
employees?: employee[];
}
export class Customer {
store: number;
department: number;
username: string;
phone: string;
archive: string;
gender: number;
birthday?: { year: number; month: number; day: number };
source: number;
remark: string;
employees: employee[];
constructor(store: number, department: number, options: CustomerOptions = {}) {
this.store = store;
this.department = department;
this.username = options.username ?? faker.person.fullName();
this.phone = options.phone ?? faker.helpers.fromRegExp(/1[3-9][0-9]{6}/);
this.archive = options.archive ?? '';
this.gender = options.gender ?? 0;
this.source = options.source ?? 1;
this.birthday = options.birthday;
this.remark = options.remark ?? '';
this.employees = options.employees ?? [];
}
}