- 添加项目配置文件和环境变量设置 - 创建测试用例目录结构和命名规范 - 实现基础测试 fixture 和页面对象模型 - 添加示例测试用例和数据生成器 - 配置 playwright 和 gitignore 文件
41 lines
1.2 KiB
TypeScript
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 ?? [];
|
|
}
|
|
}
|