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
P
pro-blocks
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
pro-blocks
Commits
b042b097
Commit
b042b097
authored
Nov 02, 2018
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test case timeout
parent
67fccc35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
32 deletions
+11
-32
src/e2e/layout.e2e.js
src/e2e/layout.e2e.js
+11
-32
No files found.
src/e2e/layout.e2e.js
View file @
b042b097
...
...
@@ -19,44 +19,23 @@ 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
(
`
${
BASE_URL
}${
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
);
});
const
testPage
=
path
=>
async
()
=>
{
await
page
.
goto
(
`
${
BASE_URL
}${
path
}
`
,
{
waitUntil
:
'
networkidle2
'
});
const
haveFooter
=
await
page
.
evaluate
(
()
=>
document
.
getElementsByTagName
(
'
footer
'
).
length
>
0
);
expect
(
haveFooter
).
toBeTruthy
();
};
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
);
RouterConfig
.
forEach
(({
routes
=
[]
})
=>
{
formatter
(
routes
).
forEach
(
route
=>
{
it
(
`test pages
${
route
}
`
,
testPage
(
route
));
});
});
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