const { test, expect } = require('@playwright/test'); const { loginAs } = require('../../helpers/auth'); test.describe('【孩子】登录', function() { var auth; test.beforeAll(async function({ browser }) { auth = await loginAs(browser, 'child'); }); test('[场景1] 孩子角色登录 — 获得合法token', async function() { expect(auth.token).toBeTruthy(); expect(auth.role).toBe('child'); }); test('[场景2] 孩子尝试访问家长页面 — 被重定向', async function({ page }) { await page.goto('http://cfc.iwintrue.com/#/pages/parent/index'); await page.waitForLoadState('networkidle'); var url = page.url(); expect(url).not.toContain('/parent/index'); }); });