Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
b86048b4
Unverified
Commit
b86048b4
authored
Apr 02, 2019
by
陈帅
Committed by
GitHub
Apr 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: win add test script (#3845)
* feat: win add test script * bugfix: fix test error * use new config
parent
cc57c6a9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
11 deletions
+17
-11
azure-pipelines.yml
azure-pipelines.yml
+4
-0
jest-puppeteer.config.js
jest-puppeteer.config.js
+1
-0
src/e2e/baseLayout.e2e.js
src/e2e/baseLayout.e2e.js
+6
-2
src/e2e/topMenu.e2e.js
src/e2e/topMenu.e2e.js
+1
-0
src/pages/Result/Success.test.js
src/pages/Result/Success.test.js
+0
-9
src/utils/authority.js
src/utils/authority.js
+5
-0
No files found.
azure-pipelines.yml
View file @
b86048b4
...
@@ -52,6 +52,10 @@ jobs:
...
@@ -52,6 +52,10 @@ jobs:
displayName
:
install
displayName
:
install
-
script
:
npm run lint
-
script
:
npm run lint
displayName
:
lint
displayName
:
lint
-
script
:
npm run test:all
env
:
PROGRESS
:
none
displayName
:
test
-
script
:
npm run build
-
script
:
npm run build
env
:
env
:
PROGRESS
:
none
PROGRESS
:
none
...
...
jest-puppeteer.config.js
View file @
b86048b4
...
@@ -6,6 +6,7 @@ module.exports = {
...
@@ -6,6 +6,7 @@ module.exports = {
'
--disable-dev-shm-usage
'
,
'
--disable-dev-shm-usage
'
,
'
--no-first-run
'
,
'
--no-first-run
'
,
'
--no-zygote
'
,
'
--no-zygote
'
,
'
--no-sandbox
'
],
],
},
},
};
};
src/e2e/baseLayout.e2e.js
View file @
b86048b4
...
@@ -5,13 +5,17 @@ const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
...
@@ -5,13 +5,17 @@ const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;
function
formatter
(
data
)
{
function
formatter
(
data
)
{
return
data
return
data
.
reduce
((
pre
,
item
)
=>
{
.
reduce
((
pre
,
item
)
=>
{
pre
.
push
(
item
.
path
);
if
(
item
.
routes
)
{
pre
.
push
(
item
.
routes
[
0
].
path
);
}
else
{
pre
.
push
(
item
.
path
);
}
return
pre
;
return
pre
;
},
[])
},
[])
.
filter
(
item
=>
item
);
.
filter
(
item
=>
item
);
}
}
describe
(
'
Homepage
'
,
async
()
=>
{
describe
(
'
Homepage
'
,
()
=>
{
const
testPage
=
path
=>
async
()
=>
{
const
testPage
=
path
=>
async
()
=>
{
await
page
.
goto
(
`
${
BASE_URL
}${
path
}
`
);
await
page
.
goto
(
`
${
BASE_URL
}${
path
}
`
);
await
page
.
waitForSelector
(
'
footer
'
,
{
await
page
.
waitForSelector
(
'
footer
'
,
{
...
...
src/e2e/topMenu.e2e.js
View file @
b86048b4
...
@@ -4,6 +4,7 @@ describe('Homepage', () => {
...
@@ -4,6 +4,7 @@ describe('Homepage', () => {
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
jest
.
setTimeout
(
1000000
);
jest
.
setTimeout
(
1000000
);
});
});
it
(
'
topmenu should have footer
'
,
async
()
=>
{
it
(
'
topmenu should have footer
'
,
async
()
=>
{
const
params
=
'
/form/basic-form?navTheme=light&layout=topmenu
'
;
const
params
=
'
/form/basic-form?navTheme=light&layout=topmenu
'
;
await
page
.
goto
(
`
${
BASE_URL
}${
params
}
`
);
await
page
.
goto
(
`
${
BASE_URL
}${
params
}
`
);
...
...
src/pages/Result/Success.test.js
deleted
100644 → 0
View file @
cc57c6a9
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
'
);
});
src/utils/authority.js
View file @
b86048b4
// use localStorage to store the authority info, which might be sent from server in actual project.
// 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
)
{
export
function
getAuthority
(
str
)
{
// return localStorage.getItem('antd-pro-authority') || ['admin', 'user'];
// return localStorage.getItem('antd-pro-authority') || ['admin', 'user'];
const
authorityString
=
const
authorityString
=
...
@@ -13,6 +15,9 @@ export function getAuthority(str) {
...
@@ -13,6 +15,9 @@ export function getAuthority(str) {
if
(
typeof
authority
===
'
string
'
)
{
if
(
typeof
authority
===
'
string
'
)
{
return
[
authority
];
return
[
authority
];
}
}
if
(
!
authority
&&
NODE_ENV
!==
'
production
'
)
{
return
[
'
admin
'
];
}
return
authority
;
return
authority
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment