permission-table-simple.test.js 32.9 KB
Newer Older
study夏羽's avatar
study夏羽 已提交
1
describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', () => {
A
Anne_LXM 已提交
2
	let page,errMsgA,errMsgB,errMsgC;
study夏羽's avatar
study夏羽 已提交
3 4 5 6
	beforeAll(async () => {
		// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
		page = await program.reLaunch(
			'/pages/clientDB/permission-table-simple/permission-table-simple')
A
Anne_LXM 已提交
7 8 9 10 11 12 13 14 15
		
		await page.waitFor(1000)
		
		errMsgA = "权限校验未通过,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error"
		
		errMsgB = "权限校验未通过,未能获取当前用户信息,当前用户为匿名身份 ,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error"
		
		errMsgC = "未能获取当前用户信息:当前用户为匿名身份"
		
study夏羽's avatar
study夏羽 已提交
16 17 18
		page = await program.currentPage()
	})

A
Anne_LXM 已提交
19 20 21 22
	beforeEach(async()=>{
		jest.setTimeout(20000)
		return false
	})
study夏羽's avatar
study夏羽 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48


	it('创建--未登陆', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击创建
		await segItems[0].tap()
		await roles[0].tap()


		const createUnlogin = await page.waitFor(async () => {
			const createUnlogintIndex = await page.data('typeIndex')
			const createUnloginRole = await page.data('currentRole')
			// console.log({
			// 	createUnlogintIndex,
			// 	createUnloginRole
			// });
			return createUnlogintIndex === 0 && createUnloginRole === 0
		})
		console.log(createUnlogin, "创建--未登陆");

		if (createUnlogin) {
A
Anne_LXM 已提交
49
			// 允许任何角色创建本表
50
			const createA = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
51 52 53
				"type": "create",
				"index": 0
			})
54
			expect(createA.success).toBeTruthy()
A
Anne_LXM 已提交
55
			
56 57
			// 禁止任何角色创建,管理员除外
			const createB = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
58 59 60
				"type": "create",
				"index": 1
			})
61 62 63 64
			expect(createB.errMsg).toBe(errMsgC)
			
			// 需要登录后
			const createC = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
65 66 67
				"type": "create",
				"index": 2
			})
68 69 70 71
			expect(createC.errMsg).toBe(errMsgC)
			
			// 限审核员角色创建
			const createD = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
72 73 74
				"type": "create",
				"index": 5
			})
75
			expect(createD.errMsg).toBe(errMsgC)
study夏羽's avatar
study夏羽 已提交
76

77 78
			// 请求同时必须同时附带执行一个action云函数,如未触发该action则权限验证失败
			const createE = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
79 80 81
				"type": "create",
				"index": 6
			})
82 83 84 85
			expect(createE.errMsg).toBe(errMsgB)
			
			// 附带执行一个action云函数
			const createAction = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
86 87 88 89
				"type": "create",
				"index": 6,
				"action": "add_view_count"
			})
90
			expect(createAction.success).toBeTruthy()
study夏羽's avatar
study夏羽 已提交
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
		}

	})

	it('读取--未登陆', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')
		//点击创建
		await segItems[1].tap()
		await roles[0].tap()


		const readUnlogin = await page.waitFor(async () => {
			const readUnloginIndex = await page.data('typeIndex')
			const readUnloginRole = await page.data('currentRole')
			return readUnloginIndex === 1 && readUnloginRole === 0
		})
		//console.log(readUnlogin, '读取--未登陆');


		if (readUnlogin) {
A
Anne_LXM 已提交
115
			// 含义解释:允许任何角色【读取】
116
			const readA = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
117 118 119
				"type": "read",
				"index": 0
			})
120
			expect(readA.success).toBeTruthy()
A
Anne_LXM 已提交
121 122
			
			// 禁止任何角色读取
123
			const readB = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
124 125 126
				"type": "read",
				"index": 1
			})
127 128 129 130
			expect(readB.errMsg).toBe(errMsgB)
			
			// 需登录后读取
			const readC = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
131 132 133
				"type": "read",
				"index": 2
			})
134
			expect(readC.errMsg).toBe(errMsgB)
A
Anne_LXM 已提交
135
			
136 137
			// 只能读取自己创建的数据,先创建数据
			const readD = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
138 139 140
				"type": "create",
				"index": 3
			})
141 142 143 144
			expect(readD.errMsg).toBe(errMsgC)
			
			// 只能读取自己创建的数据
			const readE = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
145 146 147 148
				"type": "read",
				"index": 3,
				"where": "uid == $env.uid"
			})
149
			expect(readE.errMsg).toBe(errMsgC)
study夏羽's avatar
study夏羽 已提交
150

151 152
			// 读取全表数据
			const readF = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
153 154 155
				"type": "read",
				"index": 3
			})
156 157 158 159 160 161
			console.log('readF: ',readF);
			// expect(readF.errMsg).toBe(errMsgC)
			
			
			// 只能读取1分钟内创建的数据,先创建数据
			const readG = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
162 163 164
				"type": "create",
				"index": 4
			})
165 166 167 168
			expect(readG.errMsg).toBe(errMsgC)
			
			// 只能读取1分钟内创建的数据
			const readH = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
169 170 171
				"type": "read",
				"index": 4,
				"where": "create_time > 1613541303576"
172 173 174 175 176 177 178
				})
			console.log('readH: ',readH);
			// expect(readH.success).toBeTruthy()
			
			
			// 读取全表数据
			const readI =await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
179 180 181
				"type": "read",
				"index": 4
			})
182 183 184 185
			console.log('readI: ',readI);
			// expect(readI.errCode).toBe(0)
			
			
A
Anne_LXM 已提交
186
			// 限审核员读取
187
			const readJ = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
188 189 190
				"type": "create",
				"index": 5
			})
191
			expect(readJ.errMsg).toBe(errMsgC)
study夏羽's avatar
study夏羽 已提交
192

193 194
			// 请求同时必须同时附带执行一个action云函数,如未触发该action则权限验证失败 读取全表数据
			const readK = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
195 196 197
				"type": "create",
				"index": 6
			})
198 199 200
			expect(readK.errMsg).toBe(errMsgB)
			
			// 执行一个action云函数
A
Anne_LXM 已提交
201
			const actionRead = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
202 203 204 205
				"type": "read",
				"index": 6,
				"action": "add_view_count"
			})
A
Anne_LXM 已提交
206
			expect(actionRead.errCode).toBe(0)
study夏羽's avatar
study夏羽 已提交
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
		}

	})

	it('更新--未登陆', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击更新
		await segItems[2].tap()
		await roles[0].tap()

		const updateUnlogin = await page.waitFor(async () => {
			const updateUnloginIndex = await page.data('typeIndex')
			const updateUnloginRole = await page.data('currentRole')
			return updateUnloginIndex === 2 && updateUnloginRole === 0
		})
		//console.log(updateUnlogin, '更新--未登陆');


		if (updateUnlogin) {
231 232 233
			
			// 允许任何角色更新此表
			const updateA = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
234 235 236
				"type": "update",
				"index": 0
			})
237 238 239 240
			expect(updateA.result.updated).toBeGreaterThanOrEqual(1)
			
			// 禁止任何角色更新,管理员除外
			const updateB = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
241 242 243
				"type": "update",
				"index": 1
			})
244 245 246 247
			expect(updateB.errMsg).toBe(errMsgB)
			
			// 需要登录后
			const updateC = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
248 249 250
				"type": "update",
				"index": 2
			})
251 252 253 254
			expect(updateC.errMsg).toBe(errMsgB)
			
			// 只能更新自己创建的数据,先创建数据
			const updateD = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
255 256 257
				"type": "create",
				"index": 3
			})
258 259 260 261
			expect(updateD.errMsg).toBe(errMsgC)
			
			// 只能更新自己创建的数据
			const updateE = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
262 263 264 265
				"type": "update",
				"index": 3,
				"where": "uid == $env.uid"
			})
266
			expect(updateE.errMsg).toBe(errMsgC)
study夏羽's avatar
study夏羽 已提交
267

268 269
			//更新全表数据表
			const updateF = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
270 271 272
				"type": "update",
				"index": 3
			})
273
			expect(updateF.result.updated).toBe(0)
study夏羽's avatar
study夏羽 已提交
274

275 276
			// 只更新1分钟内创建的数据,先创建数据
			const updateG = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
277 278 279
				"type": "create",
				"index": 4
			})
280
			expect(updateG.errMsg).toBe(errMsgC)
study夏羽's avatar
study夏羽 已提交
281

282 283
			// 只更新1分钟内创建的数据
			const updateH = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
284 285 286 287
				"type": "update",
				"index": 4,
				"where": "create_time > 1613546251521"
			})
288 289 290 291
			expect(updateH.result.updated).toBe(0)
			
			// 更新全表数据
			const updateI = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
292 293 294
				"type": "update",
				"index": 4
			})
295
			expect(updateI.success).toBeTruthy()
study夏羽's avatar
study夏羽 已提交
296

297 298
			//限审核员更新全表数据
			const updateJ = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
299 300 301
				"type": "update",
				"index": 5
			})
302 303 304 305
			expect(updateJ.errMsg).toBe(errMsgB)
			
			// 更新全表 请求同时必须同时附带执行一个action云函数
			const updateK = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
306 307 308
				"type": "update",
				"index": 6
			})
309
			expect(updateK.errMsg).toBe(errMsgB)
study夏羽's avatar
study夏羽 已提交
310

311 312
			// 执行一个action云函数
			const updateAction = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
313 314 315 316
				"type": "update",
				"index": 6,
				"action": "add_view_count"
			})
317
			expect(updateAction.result.updated).toBe(1)
study夏羽's avatar
study夏羽 已提交
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338

		}

	})

	it('删除--未登陆', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击更新
		await segItems[3].tap()
		await roles[0].tap()

		const deleteUnlogin = await page.waitFor(async () => {
			const deleteUnloginIndex = await page.data('typeIndex')
			const deleteUnloginRole = await page.data('currentRole')
			return deleteUnloginIndex === 3 && deleteUnloginRole === 0
		})
339
		console.log(deleteUnlogin, '删除--未登陆');
study夏羽's avatar
study夏羽 已提交
340

341 342
		// 允许任何角色删除全表
		const deleteA = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
343 344 345
			"type": "delete",
			"index": 0
		})
346 347 348 349
		expect(deleteA.result.deleted).toBeGreaterThan(0)
		
		// 禁止任何角色删除,管理员除外
		const deleteB = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
350 351 352
			"type": "delete",
			"index": 1
		})
353 354 355 356
		expect(deleteB.errMsg).toBe(errMsgB)
		
		// 需登录后可删除
		const deleteC = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
357 358 359
			"type": "delete",
			"index": 2
		})
360 361 362 363
		expect(deleteC.errMsg).toBe(errMsgB)
		
		// 只能删除自己创建的数据,先创建数据
		const deleteD = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
364 365 366
			"type": "create",
			"index": 3
		})
367 368 369 370
		expect(deleteD.errMsg).toBe(errMsgC)
		
		// 只能删除自己创建的数据
		const deleteE = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
371 372 373 374
			"type": "delete",
			"index": 3,
			"where": "uid == $env.uid"
		})
375
		expect(deleteE.errMsg).toBe(errMsgC)
study夏羽's avatar
study夏羽 已提交
376

377 378
		// 删除全表数据
		const deleteF = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
379 380 381
			"type": "delete",
			"index": 3
		})
A
Anne_LXM 已提交
382
		console.log('deleteF: ',deleteF);
383
		// expect(deleteF.success).toBeTruthy()
study夏羽's avatar
study夏羽 已提交
384

385 386 387
		// 只更新1分钟内创建的数据,先创建数据
		const deleteG = await page.callMethod('myFn', {
			"type": "create",
study夏羽's avatar
study夏羽 已提交
388 389
			"index": 4
		})
390
		expect(deleteG.errMsg).toBe(errMsgC)
study夏羽's avatar
study夏羽 已提交
391

392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
		// 只更新1分钟内创建的数据
		expect((
			await page.callMethod('myFn', {
				"type": "delete",
				"index": 4,
				"where": "create_time > 1613546644107"
			})
		).success).toBeTruthy()
		
		// 删除全表数据
		expect((
			await page.callMethod('myFn', {
				"type": "delete",
				"index": 4
			})
		).success).toBeTruthy()
study夏羽's avatar
study夏羽 已提交
408

409 410
		// 删除全表 仅审核员
		const deleteH = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
411 412 413
			"type": "delete",
			"index": 5
		})
414 415 416 417
		expect(deleteH.errMsg).toBe(errMsgB)
		
		// 更新全表 请求同时必须同时附带执行一个action云函数
		const deleteI = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
418 419 420
			"type": "delete",
			"index": 6
		})
421
		expect(deleteI.errMsg).toBe(errMsgB)
study夏羽's avatar
study夏羽 已提交
422

423 424
		// 附带执行一个action云函数
		const deleteAction = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
425 426 427 428
			"type": "delete",
			"index": 6,
			"action": "add_view_count"
		})
429
		expect(deleteAction.result.deleted).toBe(1)
study夏羽's avatar
study夏羽 已提交
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
	})



	it('创建--用户', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')


		//点击创建
		await segItems[0].tap()
		await roles[1].tap()
		const createUser = await page.waitFor(async () => {
			const typeIndex = await page.data('typeIndex')
			const currentRole = await page.data('currentRole')
			return typeIndex === 0 && currentRole == 'user'
		})
		console.log(createUser, '创建--用户');


453 454
		// 任何角色可创建
		const createUserA = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
455 456 457
			"type": "create",
			"index": 0
		})
458 459 460 461
		expect(createUserA.result.id).toHaveLength(24)
		
		// 禁止任何角色创建,仅管理员
		const createUserB = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
462 463 464
			"type": "create",
			"index": 1
		})
465 466 467 468
		expect(createUserB.errMsg).toBe(errMsgA)
		
		// 已登录 可创建
		const createUserC = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
469 470 471
			"type": "create",
			"index": 2
		})
472
		expect(createUserC.result.id).toHaveLength(24)
study夏羽's avatar
study夏羽 已提交
473

474 475
		// 仅审核员可创建
		const createUserD = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
476 477 478
			"type": "create",
			"index": 5
		})
479
		expect(createUserD.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
480

481 482
		// 请求同时必须同时附带执行一个action云函数,如未触发该action则权限验证失败
		const createUserE = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
483 484 485
			"type": "create",
			"index": 6
		})
486 487 488 489
		expect(createUserE.errMsg).toBe(errMsgA)
		
		// 附带执行一个action云函数
		const createUserF = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
490 491 492 493
			"type": "create",
			"index": 6,
			"action": "add_view_count"
		})
494
		expect(createUserF.result.id).toHaveLength(24)
study夏羽's avatar
study夏羽 已提交
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513

	})

	it('读取--用户', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击读取
		await segItems[1].tap()
		await roles[1].tap()

		const readUser = await page.waitFor(async () => {
			const readUserIndex = await page.data('typeIndex')
			const readUserRole = await page.data('currentRole')
			return readUserIndex === 1 && readUserRole == 'user'
		})
514
		console.log(readUser, '读取--用户');
study夏羽's avatar
study夏羽 已提交
515

516 517
		// 任何人可读取
		const readUserA = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
518 519 520
			"type": "read",
			"index": 0
		})
521 522 523 524
		expect(readUserA.result.data.length).toBeGreaterThan(0)
		
		// 仅管理员可读
		const readUserB = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
525 526 527
			"type": "read",
			"index": 1
		})
528 529 530 531
		expect(readUserB.errMsg).toBe(errMsgA)
		
		// 登录后可读取
		const readUserC = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
532 533 534
			"type": "read",
			"index": 2
		})
535 536 537 538
		expect(readUserC.result.data.length).toBeGreaterThan(0)
		
		// 只能读取自己创建的数据,先创建数据
		const readUserD = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
539 540 541
			"type": "create",
			"index": 3
		})
542 543 544 545
		expect(readUserD.result.id).toHaveLength(24)
		
		// 只能读取自己创建的数据
		const readUserE = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
546 547 548 549
			"type": "read",
			"index": 3,
			"where": "uid == $env.uid"
		})
550 551 552 553
		expect(readUserE.result.data.length).toBeGreaterThan(0)
		
		// 读取全表数据
		const readUserF = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
554 555 556
			"type": "read",
			"index": 3
		})
557 558 559 560
		expect(readUserF.result.data.length).toBeGreaterThan(0)
		
		// 只读取1分钟内创建的数据,先创建数据
		const readUserG = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
561 562 563
			"type": "create",
			"index": 4
		})
564 565 566 567
		expect(readUserG.result.id).toHaveLength(24)
		
		// 只读取1分钟内创建的数据
		const readUserH = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
568 569 570 571
			"type": "read",
			"index": 4,
			"where": "create_time > 1613541303576"
		})
572 573 574 575
		expect(readUserH.result.data.length).toBeGreaterThan(0)
		
		// 读取全表数据
		const readUserI = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
576 577 578
			"type": "read",
			"index": 4
		})
579 580 581 582
		expect(readUserI.result.data.length).toBeGreaterThanOrEqual(1)
		
		// 仅审核员读取全表数据
		const readUserJ = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
583 584 585
			"type": "read",
			"index": 5
		})
586
		expect(readUserJ.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
587

588 589
		// 请求同时必须同时附带执行一个action云函数,如未触发该action则权限验证失败
		const readUserK = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
590 591 592
			"type": "read",
			"index": 6
		})
593 594 595 596
		expect(readUserK.errMsg).toBe(errMsgA)
		
		// 执行一个action云函数
		const readUserO = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
597 598 599 600
			"type": "read",
			"index": 6,
			"action": "add_view_count"
		})
601
		expect(readUserO.result.data.length).toBeGreaterThan(0)
study夏羽's avatar
study夏羽 已提交
602 603

	})
604
	// ----------------------------------------------
study夏羽's avatar
study夏羽 已提交
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
	it('更新--用户', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击更新
		await segItems[2].tap()
		await roles[1].tap()


		const updateUser = await page.waitFor(async () => {
			const updateUserIndex = await page.data('typeIndex')
			const updateUserRole = await page.data('currentRole')
			return updateUserIndex === 2 && updateUserRole == 'user'
		})
		console.log(updateUser, '更新--用户');

624 625
		// 允许任何人更新
		const updateUserA = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
626 627 628
			"type": "update",
			"index": 0
		})
629 630 631 632
		expect(updateUserA.result.updated).toBeGreaterThanOrEqual(1)
		
		// 禁止任何人更新 除管理员
		const updateUserB = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
633 634 635
			"type": "update",
			"index": 1
		})
636 637 638 639
		expect(updateUserB.errMsg).toBe(errMsgA)
		
		// 需要登录后更新
		const updateUserC = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
640 641 642
			"type": "update",
			"index": 2
		})
643 644 645 646 647
		console.log('updateUserC: ',updateUserC);
		
		
		// 仅更新自己创建的数据 先创建数据
		const updateUserD = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
648 649 650
			"type": "create",
			"index": 3
		})
651
		expect(updateUserD.result.id).toHaveLength(24)
study夏羽's avatar
study夏羽 已提交
652

653 654
		// 仅更新自己创建的数据 
		const updateUserE = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
655 656 657 658
			"type": "update",
			"index": 3,
			"where": "uid == $env.uid"
		})
659 660 661 662
		expect(updateUserE.result.updated).toBeGreaterThanOrEqual(1)
		
		// 更新全部数据
		const updateUserF = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
663 664 665
			"type": "update",
			"index": 3
		})
666 667 668 669
		expect(updateUserF.result.updated).toBeGreaterThanOrEqual(1)
		
		// 只更新1分钟内创建的数据 先创建数据
		const updateUserG = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
670 671 672
			"type": "create",
			"index": 4
		})
673
		expect(updateUserG.result.id).toHaveLength(24)
study夏羽's avatar
study夏羽 已提交
674

675 676
		// 只更新1分钟内创建的数据
		const updateUserH = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
677 678 679 680
			"type": "update",
			"index": 4,
			"where": "create_time > 1613546251521"
		})
681 682 683 684
		expect(updateUserH.result.updated).toBeGreaterThanOrEqual(1)
		
		// 更新全部数据
		const updateUserI = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
685 686 687
			"type": "update",
			"index": 4
		})
688 689 690 691
		expect(updateUserI.result.updated).toBeGreaterThanOrEqual(1)
		
		// 限审核员更新数据
		const updateUserJ = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
692 693 694
			"type": "update",
			"index": 5
		})
695 696 697 698
		expect(updateUserJ.errMsg).toBe(errMsgA)
		
		// 请求同时必须同时附带执行一个action云函数,如未触发该action则权限验证失败
		const updateUserK = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
699 700 701
			"type": "update",
			"index": 6
		})
702
		expect(updateUserK.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
703

704 705
		// 请求同时必须同时附带执行一个action云函数
		const updateUserAction = await page.callMethod('myFn', {
study夏羽's avatar
study夏羽 已提交
706 707 708 709
			"type": "update",
			"index": 6,
			"action": "add_view_count"
		})
710
		console.log('updateUserAction: ',updateUserAction);
study夏羽's avatar
study夏羽 已提交
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729

	})

	it('删除--用户', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击更新
		await segItems[3].tap()
		await roles[1].tap()

		const deleteUser = await page.waitFor(async () => {
			const deleteUserIndex = await page.data('typeIndex')
			const deleteUserRole = await page.data('currentRole')
			return deleteUserIndex === 3 && deleteUserRole == 'user'
		})
730
		console.log(deleteUser, '删除--用户');
study夏羽's avatar
study夏羽 已提交
731 732 733 734 735 736 737 738 739 740

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 0
		})

		const deleteUserA = await page.callMethod('myFn', {
			"type": "delete",
			"index": 1
		})
A
Anne_LXM 已提交
741
		expect(deleteUserA.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 2
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 3,
			"where": "uid == $env.uid"
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 4,
			"where": "create_time > 1613547725091"
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 4
		})

		const deleteUserB = await page.callMethod('myFn', {
			"type": "delete",
			"index": 5
		})
A
Anne_LXM 已提交
784
		expect(deleteUserB.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
785 786 787 788 789

		const deleteUserC = await page.callMethod('myFn', {
			"type": "delete",
			"index": 6
		})
A
Anne_LXM 已提交
790
		expect(deleteUserC.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 6,
			"action": "add_view_count"
		})

	})



	it('创建--审核员Auditor', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击创建
		await segItems[0].tap()
		await roles[2].tap()

		const createAuditor = await page.waitFor(async () => {
			const createAuditorIndex = await page.data('typeIndex')
			const createAuditorRole = await page.data('currentRole')
			return createAuditorIndex === 0 && createAuditorRole == 'auditor'
		})
		//console.log(createAuditor, '创建--审核员');


		await page.callMethod('myFn', {
			"type": "create",
			"index": 0
		})

		const createAuditorA = await page.callMethod('myFn', {
			"type": "create",
			"index": 1
		})
A
Anne_LXM 已提交
830
		expect(createAuditorA.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885

		await page.callMethod('myFn', {
			"type": "create",
			"index": 2
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 5
		})


		const createAuditorB = await page.callMethod('myFn', {
			"type": "create",
			"index": 6
		})
		// expect(createAuditorB.id).toBeTruthy()
		// expect(createAuditorB).toBe('[permission-test-7.create]权限校验未通过')

		await page.callMethod('myFn', {
			"type": "create",
			"index": 6,
			"action": "add_view_count"
		})

	})

	it('读取--审核员', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击读取
		await segItems[1].tap()
		await roles[2].tap()

		const readAuditor = await page.waitFor(async () => {
			const readAuditorIndex = await page.data('typeIndex')
			const readAuditorRole = await page.data('currentRole')
			return readAuditorIndex === 1 && readAuditorRole == 'auditor'
		})
		console.log(readAuditor, '读取--审核员');


		await page.callMethod('myFn', {
			"type": "read",
			"index": 0
		})

		const readAuditorA = await page.callMethod('myFn', {
			"type": "read",
			"index": 1
		})
A
Anne_LXM 已提交
886
		expect(readAuditorA.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936

		await page.callMethod('myFn', {
			"type": "read",
			"index": 2
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 3,
			"where": "uid == $env.uid"
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 4,
			"where": "create_time > 1613541303576"
		})


		await page.callMethod('myFn', {
			"type": "read",
			"index": 4
		})


		await page.callMethod('myFn', {
			"type": "read",
			"index": 5
		})


		const readAuditorB = await page.callMethod('myFn', {
			"type": "read",
			"index": 6
		})
A
Anne_LXM 已提交
937
		expect(readAuditorB.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978

		await page.callMethod('myFn', {
			"type": "read",
			"index": 6,
			"action": "add_view_count"
		})





	})

	it('更新--审核员', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击更新
		await segItems[2].tap()
		await roles[2].tap()

		const updateAuditor = await page.waitFor(async () => {
			const updateAuditorIndex = await page.data('typeIndex')
			const updateAuditorRole = await page.data('currentRole')
			return updateAuditorIndex === 2 && updateAuditorRole == 'auditor'
		})
		console.log(updateAuditor, '更新--审核员');


		await page.callMethod('myFn', {
			"type": "update",
			"index": 0
		})

		const updateAuditorA = await page.callMethod('myFn', {
			"type": "update",
			"index": 1
		})
A
Anne_LXM 已提交
979
		expect(updateAuditorA.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027

		await page.callMethod('myFn', {
			"type": "update",
			"index": 2
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 3,
			"where": "uid == $env.uid"
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 3
		})


		await page.callMethod('myFn', {
			"type": "create",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 4,
			"where": "create_time > 1613546251521"
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 5
		})

		const updateAuditorB = await page.callMethod('myFn', {
			"type": "update",
			"index": 6
		})
A
Anne_LXM 已提交
1028
		expect(updateAuditorB.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068

		await page.callMethod('myFn', {
			"type": "update",
			"index": 6,
			"action": "add_view_count"
		})




	})

	it('删除--审核员', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击更新
		await segItems[3].tap()
		await roles[2].tap()

		const deleteAuditor = await page.waitFor(async () => {
			const deleteAuditorIndex = await page.data('typeIndex')
			const deleteAuditorRole = await page.data('currentRole')
			return deleteAuditorIndex === 3 && deleteAuditorRole == 'auditor'
		})
		//console.log(deleteAuditor, '删除--审核员');


		await page.callMethod('myFn', {
			"type": "delete",
			"index": 0
		})

		const deleteAuditorA = await page.callMethod('myFn', {
			"type": "delete",
			"index": 1
		})
A
Anne_LXM 已提交
1069
		expect(deleteAuditorA.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 2
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 3,
			"where": "uid == $env.uid"
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 4,
			"where": "create_time > 1613547725091"
		})


		await page.callMethod('myFn', {
			"type": "delete",
			"index": 4
		})



		await page.callMethod('myFn', {
			"type": "delete",
			"index": 5
		})


		const deleteAuditorB = await page.callMethod('myFn', {
			"type": "delete",
			"index": 6
		})
A
Anne_LXM 已提交
1121
		expect(deleteAuditorB.errMsg).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 6,
			"action": "add_view_count"
		})

	})

	it('创建--管理员admin', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击创建
		await segItems[0].tap()
		await roles[3].tap()


		const createAdmin = await page.waitFor(async () => {
			const createAdminIndex = await page.data('typeIndex')
			const createAdminRole = await page.data('currentRole')
			return createAdminIndex === 0 && createAdminRole == 'admin'
		})
		console.log(createAdmin, '创建--管理员');


		await page.callMethod('myFn', {
			"type": "create",
			"index": 0
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 1
		})


		await page.callMethod('myFn', {
			"type": "create",
			"index": 2
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 5
		})


		await page.callMethod('myFn', {
			"type": "create",
			"index": 6
		})


		await page.callMethod('myFn', {
			"type": "create",
			"index": 6,
			"action": "add_view_count"
		})


	})

	it('读取--管理员', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击读取
		await segItems[1].tap()
		await roles[3].tap()

		const readAdmin = await page.waitFor(async () => {
			const readAdminIndex = await page.data('typeIndex')
			const readAdminRole = await page.data('currentRole')
			return readAdminIndex === 1 && readAdminRole == 'admin'
		})
		//console.log(readAdmin, '读取--管理员');




		await page.callMethod('myFn', {
			"type": "read",
			"index": 0
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 1
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 2
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 3,
			"where": "uid == $env.uid"
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 4,
			"where": "create_time > 1613541303576"
		})



		await page.callMethod('myFn', {
			"type": "read",
			"index": 4
		})


		await page.callMethod('myFn', {
			"type": "read",
			"index": 5
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 6
		})

		await page.callMethod('myFn', {
			"type": "read",
			"index": 6,
			"action": "add_view_count"
		})





	})

	it('更新--管理员', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击更新
		await segItems[2].tap()
		await roles[3].tap()

		const updateAdmin = await page.waitFor(async () => {
			const updateAdminIndex = await page.data('typeIndex')
			const updateAdminRole = await page.data('currentRole')
			return updateAdminIndex === 2 && updateAdminRole == 'admin'
		})
		//console.log(updateAdmin, '更新--管理员');


		await page.callMethod('myFn', {
			"type": "update",
			"index": 0
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 1
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 2
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 3,
			"where": "uid == $env.uid"
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 3
		})


		await page.callMethod('myFn', {
			"type": "create",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 4,
			"where": "create_time > 1613546251521"
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 5
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 6
		})

		await page.callMethod('myFn', {
			"type": "update",
			"index": 6,
			"action": "add_view_count"
		})





	})

	it('删除--管理员', async () => {
		const perPage = await page.$('.page')
		//头部操作控制条
		const segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		const roles = await perPage.$$('.roles-item')

		//点击更新
		await segItems[3].tap()
		await roles[3].tap()

		const deleteAdmin = await page.waitFor(async () => {
			const deleteAdminIndex = await page.data('typeIndex')
			const deleteAdminRole = await page.data('currentRole')
			return deleteAdminIndex === 3 && deleteAdminRole === 'admin'
		})
		//console.log(deleteAdmin, '删除--管理员');



		await page.callMethod('myFn', {
			"type": "delete",
			"index": 0
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 1
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 2
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 3,
			"where": "create_time > 1613572491536"
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 3
		})

		await page.callMethod('myFn', {
			"type": "create",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 4,
			"where": "create_time > 1613547725091"
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 4
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 5
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 6
		})

		await page.callMethod('myFn', {
			"type": "delete",
			"index": 6,
			"action": "add_view_count"
		})

	})

})