| 123456789101112131415161718192021222324 |
- 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');
- });
- // TODO: SPA前端缺少路由守卫,孩子可以访问家长页面URL。
- // 需要在前端路由层实现角色权限判断后才能启用此测试。
- test.skip('[场景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');
- });
- });
|