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
d393c29d
Unverified
Commit
d393c29d
authored
Oct 09, 2018
by
陈帅
Committed by
GitHub
Oct 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add layout test (#2499)
* add layout test * change judge to tagName
parent
e0882a7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
2 deletions
+63
-2
src/components/GlobalFooter/index.js
src/components/GlobalFooter/index.js
+2
-2
src/e2e/layout.e2e.js
src/e2e/layout.e2e.js
+61
-0
No files found.
src/components/GlobalFooter/index.js
View file @
d393c29d
...
...
@@ -5,7 +5,7 @@ import styles from './index.less';
const
GlobalFooter
=
({
className
,
links
,
copyright
})
=>
{
const
clsString
=
classNames
(
styles
.
globalFooter
,
className
);
return
(
<
div
className
=
{
clsString
}
>
<
footer
className
=
{
clsString
}
>
{
links
&&
(
<
div
className
=
{
styles
.
links
}
>
{
links
.
map
(
link
=>
(
...
...
@@ -21,7 +21,7 @@ const GlobalFooter = ({ className, links, copyright }) => {
<
/div
>
)}
{
copyright
&&
<
div
className
=
{
styles
.
copyright
}
>
{
copyright
}
<
/div>
}
<
/
div
>
<
/
footer
>
);
};
...
...
src/e2e/layout.e2e.js
0 → 100644
View file @
d393c29d
import
puppeteer
from
'
puppeteer
'
;
import
RouterConfig
from
'
../../config/router.config
'
;
function
formatter
(
data
)
{
return
data
.
reduce
((
pre
,
item
)
=>
{
if
(
item
.
routes
)
{
return
pre
.
concat
(
formatter
(
item
.
routes
));
}
pre
.
push
(
item
.
path
);
return
pre
;
},
[])
.
filter
(
item
=>
item
);
}
describe
(
'
Homepage
'
,
()
=>
{
let
browser
;
let
page
;
const
testAllPage
=
async
layout
=>
new
Promise
(
async
(
resolve
,
reject
)
=>
{
const
loadPage
=
async
index
=>
{
const
path
=
layout
[
index
];
try
{
await
page
.
goto
(
`http://localhost:8000
${
path
}
`
,
{
waitUntil
:
'
networkidle2
'
});
const
haveFooter
=
await
page
.
evaluate
(
()
=>
document
.
getElementsByTagName
(
'
footer
'
).
length
>
0
);
expect
(
haveFooter
).
toBeTruthy
();
if
(
index
<
layout
.
length
-
1
)
{
loadPage
(
index
+
1
);
}
else
{
resolve
(
'
ok
'
);
}
}
catch
(
error
)
{
reject
(
error
);
}
};
loadPage
(
0
);
});
beforeAll
(
async
()
=>
{
browser
=
await
puppeteer
.
launch
({
args
:
[
'
--no-sandbox
'
]
});
page
=
await
browser
.
newPage
();
jest
.
setTimeout
(
1000000
);
});
it
(
'
test user layout
'
,
async
()
=>
{
const
userLayout
=
formatter
(
RouterConfig
[
0
].
routes
);
await
testAllPage
(
userLayout
);
});
it
(
'
test base layout
'
,
async
()
=>
{
const
baseLayout
=
formatter
(
RouterConfig
[
1
].
routes
);
await
testAllPage
(
baseLayout
);
});
afterAll
(()
=>
browser
.
close
());
});
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