permission-table-compound.test.js 17.3 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2
jest.setTimeout(20000)

study夏羽's avatar
study夏羽 已提交
3
describe('pages/clientDB/permission-table-compound/permission-table-compound.vue', () => {
A
Anne_LXM 已提交
4
	let page,errMsgA,errMsgB,perPage,segItems,roles;
study夏羽's avatar
study夏羽 已提交
5 6 7 8
	beforeAll(async () => {
		// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
		page = await program.reLaunch(
			'/pages/clientDB/permission-table-compound/permission-table-compound')
A
Anne_LXM 已提交
9
		await page.waitFor('view')
study夏羽's avatar
study夏羽 已提交
10
		
A
Anne_LXM 已提交
11 12 13 14
		errMsgA = "权限校验未通过,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error"
		
		errMsgB = "权限校验未通过,未能获取当前用户信息,当前用户为匿名身份 ,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error"
		// page = await program.currentPage()
A
Anne_LXM 已提交
15 16 17 18 19
		perPage = await page.$('.page')
		//头部操作控制条
		segItems = await perPage.$$('.segmented-control__item')
		//底部角色控制条
		roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
20 21 22 23
	})
	

	it('创建--未登陆', async () => {
A
Anne_LXM 已提交
24
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
25
		//头部操作控制条
A
Anne_LXM 已提交
26
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
27
		//底部角色控制条
A
Anne_LXM 已提交
28
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

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

		const createUnlogin = await page.waitFor(async () => {
			const createUnloginIndex = await page.data('typeIndex')
			const createUnloginRole = await page.data('currentRole')
			return createUnloginIndex === 0 && createUnloginRole === 0
		})



		const createA = await page.callMethod('myFn', {
			"type": "create",
			"index": 1
		})
A
Anne_LXM 已提交
46
		expect(createA).toBe(errMsgB)
study夏羽's avatar
study夏羽 已提交
47 48 49 50 51 52 53 54 55 56 57 58

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



	})

	it('读取--未登陆', async () => {
A
Anne_LXM 已提交
59
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
60
		//头部操作控制条
A
Anne_LXM 已提交
61
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
62
		//底部角色控制条
A
Anne_LXM 已提交
63
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
		//点击创建
		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
		})




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

		const readA = await page.callMethod('myFn', {
			"type": "read",
			"index": 0,
			"where": "create_time > 1613534788761"
		})
		// expect(readA).toBe('未能获取当前用户信息:30205 | 当前用户为匿名身份')

		const readB = await page.callMethod('myFn', {
			"type": "read",
			"index": 0
		})
A
Anne_LXM 已提交
93
		expect(readB).toBe(errMsgB)
study夏羽's avatar
study夏羽 已提交
94 95 96 97 98

		const readC = await page.callMethod('myFn', {
			"type": "read",
			"index": 1
		})
A
Anne_LXM 已提交
99
		expect(readC).toBe(errMsgB)
study夏羽's avatar
study夏羽 已提交
100 101 102 103 104 105 106 107 108 109

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

	})

	it('更新--未登陆', async () => {
A
Anne_LXM 已提交
110
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
111
		//头部操作控制条
A
Anne_LXM 已提交
112
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
113
		//底部角色控制条
A
Anne_LXM 已提交
114
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136

		//点击更新
		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
		})


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

		const updateA = await page.callMethod('myFn', {
			"type": "read",
			"index": 0,
			"where": "create_time > 1613534788761"
		})
A
Anne_LXM 已提交
137
		expect(updateA).toBe(errMsgB)
study夏羽's avatar
study夏羽 已提交
138 139 140 141 142

		const updateB = await page.callMethod('myFn', {
			"type": "update",
			"index": 0
		})
A
Anne_LXM 已提交
143
		// console.log("updateB: ",updateB);
study夏羽's avatar
study夏羽 已提交
144 145 146 147 148 149
		// expect(updateB).toBe('权限校验未通过')

		const updateC = await page.callMethod('myFn', {
			"type": "update",
			"index": 1
		})
A
Anne_LXM 已提交
150
		expect(updateC).toBe(errMsgB)
study夏羽's avatar
study夏羽 已提交
151 152 153 154 155 156 157 158 159 160 161

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


	})

	it('删除--未登陆', async () => {
A
Anne_LXM 已提交
162
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
163
		//头部操作控制条
A
Anne_LXM 已提交
164
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
165
		//底部角色控制条
A
Anne_LXM 已提交
166
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189

		//点击删除
		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
		})



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

		const deleteA = await page.callMethod('myFn', {
			"type": "read",
			"index": 0,
			"where": "create_time > 1613534788761"
		})
A
Anne_LXM 已提交
190
		expect(deleteA).toBe(errMsgB)
study夏羽's avatar
study夏羽 已提交
191 192 193 194 195

		const deleteB = await page.callMethod('myFn', {
			"type": "delete",
			"index": 0
		})
A
Anne_LXM 已提交
196
		// console.log("deleteB: ",deleteB);
study夏羽's avatar
study夏羽 已提交
197 198 199 200 201 202
		// expect(deleteB).toBe('权限校验未通过')

		const deleteC = await page.callMethod('myFn', {
			"type": "delete",
			"index": 1
		})
A
Anne_LXM 已提交
203
		expect(deleteC).toBe(errMsgB)
study夏羽's avatar
study夏羽 已提交
204 205 206 207 208 209 210 211 212 213 214 215

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

	})



	it('创建--用户', async () => {
A
Anne_LXM 已提交
216
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
217
		//头部操作控制条
A
Anne_LXM 已提交
218
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
219
		//底部角色控制条
A
Anne_LXM 已提交
220
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248

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

		const createUser = await page.waitFor(async () => {
			const createUserIndex = await page.data('typeIndex')
			const createUserRole = await page.data('currentRole')
			return createUserIndex === 0 && createUserRole == 'user'
		})



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

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


	})

	it('读取--用户', async () => {
A
Anne_LXM 已提交
249
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
250
		//头部操作控制条
A
Anne_LXM 已提交
251
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
252
		//底部角色控制条
A
Anne_LXM 已提交
253
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302

		//点击创建
		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'
		})


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

		const readUserA = await page.callMethod('myFn', {
			"type": "read",
			"index": 0,
			"where": "create_time > 1613534788761"
		})
		//console.log(readUserA,"readUserA---------");
		//未能获取当前用户信息:30205 | 当前用户为匿名身份
		//expect(readUserA).toBe('权限校验未通过')

		const readUserB = await page.callMethod('myFn', {
			"type": "read",
			"index": 0
		})
		//console.log(readUserB,"readUserB---------");
		//expect(readUserB).toBe('权限校验未通过')

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

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



	})

	it('更新--用户', async () => {
A
Anne_LXM 已提交
303
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
304
		//头部操作控制条
A
Anne_LXM 已提交
305
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
306
		//底部角色控制条
A
Anne_LXM 已提交
307
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339

		//点击更新
		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'
		})



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

		const updateUserA = await page.callMethod('myFn', {
			"type": "read",
			"index": 0,
			"where": "create_time > 1613534788761"
		})
		//console.log(updateUserA,"updateUserA---------");
		//expect(updateUserA).toBe('权限校验未通过')
		//未能获取当前用户信息:30205 | 当前用户为匿名身份


		const updateUserB = await page.callMethod('myFn', {
			"type": "update",
			"index": 0
		})
A
Anne_LXM 已提交
340
		expect(updateUserB).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357

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

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



	})

	it('删除--用户', async () => {
A
Anne_LXM 已提交
358
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
359
		//头部操作控制条
A
Anne_LXM 已提交
360
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
361
		//底部角色控制条
A
Anne_LXM 已提交
362
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384

		//点击删除
		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'
		})


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

		const deleteUserA = await page.callMethod('myFn', {
			"type": "read",
			"index": 0,
			"where": "create_time > 1613534788761"
		})
A
Anne_LXM 已提交
385
		expect(deleteUserA).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
386 387 388 389 390

		const deleteUserB = await page.callMethod('myFn', {
			"type": "delete",
			"index": 0
		})
A
Anne_LXM 已提交
391
		expect(deleteUserB).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407

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

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



	it('创建--审核员', async () => {
A
Anne_LXM 已提交
408
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
409
		//头部操作控制条
A
Anne_LXM 已提交
410
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
411
		//底部角色控制条
A
Anne_LXM 已提交
412
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439

		//点击创建
		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'
		})


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

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


	})

	it('读取--审核员', async () => {
A
Anne_LXM 已提交
440
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
441
		//头部操作控制条
A
Anne_LXM 已提交
442
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
443
		//底部角色控制条
A
Anne_LXM 已提交
444
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489

		//点击创建
		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'
		})


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

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

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


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

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



	})

	it('更新--审核员', async () => {
A
Anne_LXM 已提交
490
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
491
		//头部操作控制条
A
Anne_LXM 已提交
492
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
493
		//底部角色控制条
A
Anne_LXM 已提交
494
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524

		//点击更新
		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'
		})




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

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


		const updateAuditorA = await page.callMethod('myFn', {
			"type": "update",
			"index": 0
		})
A
Anne_LXM 已提交
525
		expect(updateAuditorA).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541

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

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


	})

	it('删除--审核员', async () => {
A
Anne_LXM 已提交
542
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
543
		//头部操作控制条
A
Anne_LXM 已提交
544
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
545
		//底部角色控制条
A
Anne_LXM 已提交
546
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574

		//点击删除
		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'
		})


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

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


		const deleteAuditorB = await page.callMethod('myFn', {
			"type": "delete",
			"index": 0
		})
A
Anne_LXM 已提交
575
		expect(deleteAuditorB).toBe(errMsgA)
study夏羽's avatar
study夏羽 已提交
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594

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

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



	})



	it('创建--管理员', async () => {
A
Anne_LXM 已提交
595
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
596
		//头部操作控制条
A
Anne_LXM 已提交
597
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
598
		//底部角色控制条
A
Anne_LXM 已提交
599
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627

		//点击创建
		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'
		})


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

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



	})

	it('读取--管理员', async () => {
A
Anne_LXM 已提交
628
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
629
		//头部操作控制条
A
Anne_LXM 已提交
630
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
631
		//底部角色控制条
A
Anne_LXM 已提交
632
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676

		//点击创建
		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'
		})


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

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

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


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

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


	})

	it('更新--管理员', async () => {
A
Anne_LXM 已提交
677
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
678
		//头部操作控制条
A
Anne_LXM 已提交
679
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
680
		//底部角色控制条
A
Anne_LXM 已提交
681
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725

		//点击更新
		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'
		})


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

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

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

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

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



	})

	it('删除--管理员', async () => {
A
Anne_LXM 已提交
726
		// const perPage = await page.$('.page')
study夏羽's avatar
study夏羽 已提交
727
		//头部操作控制条
A
Anne_LXM 已提交
728
		// const segItems = await perPage.$$('.segmented-control__item')
study夏羽's avatar
study夏羽 已提交
729
		//底部角色控制条
A
Anne_LXM 已提交
730
		// const roles = await perPage.$$('.roles-item')
study夏羽's avatar
study夏羽 已提交
731 732 733 734 735 736 737 738 739 740 741 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

		//点击删除
		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'
		})


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

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


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


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

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



	})



})