Unverified Commit b86048b4 authored by 陈帅's avatar 陈帅 Committed by GitHub

feat: win add test script (#3845)

* feat: win add test script

* bugfix: fix test error

* use new config
parent cc57c6a9
......@@ -52,6 +52,10 @@ jobs:
displayName: install
- script: npm run lint
displayName: lint
- script: npm run test:all
env:
PROGRESS: none
displayName: test
- script: npm run build
env:
PROGRESS: none
......
......@@ -6,6 +6,7 @@ module.exports = {
'--disable-dev-shm-usage',
'--no-first-run',
'--no-zygote',
'--no-sandbox'
],
},
};
......@@ -5,13 +5,17 @@ const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
function formatter(data) {
return data
.reduce((pre, item) => {
if (item.routes) {
pre.push(item.routes[0].path);
} else {
pre.push(item.path);
}
return pre;
}, [])
.filter(item => item);
}
describe('Homepage', async () => {
describe('Homepage', () => {
const testPage = path => async () => {
await page.goto(`${BASE_URL}${path}`);
await page.waitForSelector('footer', {
......
......@@ -4,6 +4,7 @@ describe('Homepage', () => {
beforeAll(async () => {
jest.setTimeout(1000000);
});
it('topmenu should have footer', async () => {
const params = '/form/basic-form?navTheme=light&layout=topmenu';
await page.goto(`${BASE_URL}${params}`);
......
import React from 'react';
import { shallow } from 'enzyme';
import Success from './Success';
it('renders with Result', () => {
const wrapper = shallow(<Success />);
expect(wrapper.find('Result').length).toBe(1);
expect(wrapper.find('Result').prop('type')).toBe('success');
});
// use localStorage to store the authority info, which might be sent from server in actual project.
const { NODE_ENV } = process.env;
export function getAuthority(str) {
// return localStorage.getItem('antd-pro-authority') || ['admin', 'user'];
const authorityString =
......@@ -13,6 +15,9 @@ export function getAuthority(str) {
if (typeof authority === 'string') {
return [authority];
}
if (!authority && NODE_ENV !== 'production') {
return ['admin'];
}
return authority;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment