Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
auto-test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xie.qin
auto-test
Commits
0e9c1e6e
Commit
0e9c1e6e
authored
Sep 22, 2021
by
xie.qin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
To support download openapi file.
parent
89eef867
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
12 deletions
+18
-12
README.md
e2e/README.md
+2
-1
cypress.json
e2e/cypress.json
+1
-1
openApiFileDownload.js
...ss/integration/openApiFileDownload/openApiFileDownload.js
+8
-5
index.js
e2e/cypress/plugins/index.js
+7
-5
case-948.feature.mp4
e2e/cypress/videos/case-948.feature.mp4
+0
-0
No files found.
e2e/README.md
View file @
0e9c1e6e
...
...
@@ -23,7 +23,8 @@ Cypress几年前还属于一个比较小众的Web测试方案,现如今已有
## 测试执行及结果展示:
-
安装Node.js 12 or 14 and above
-
安装依赖
-
node install
-
node install
-
如果需要在Linux服务器上运行,
[
点击链接
](
https://docs.cypress.io/guides/continuous-integration/introduction#Dependencies
)
安装其它依赖
-
调试窗口:
-
npm run cypress:open
-
运行命令:
...
...
e2e/cypress.json
View file @
0e9c1e6e
...
...
@@ -21,7 +21,7 @@
"openMode"
:
0
},
"pageLoadTimeout"
:
10000
,
"defaultCommandTimeout"
:
5
000
,
"defaultCommandTimeout"
:
10
000
,
"testFiles"
:
"**/*.feature"
,
"chromeWebSecurity"
:
false
}
e2e/cypress/integration/openApiFileDownload/openApiFileDownload.js
View file @
0e9c1e6e
...
...
@@ -35,11 +35,13 @@ Then('download openapi file and save', () => {
cy
.
log
(
'**read downloaded file**'
)
// file path is relative to the working folder
const
filename
=
path
.
join
(
downloadsFolder
,
'2.X版本_OpenAPI.json'
)
//debugger
cy
.
task
(
'getFileSize'
,
filename
).
then
((
fileSize
)
=>
{
debugger
// file path is relative to the working folder
const
filename
=
path
.
join
(
downloadsFolder
,
'/2.X版本_OpenAPI.json'
)
cy
.
log
(
filename
)
cy
.
readFile
(
filename
)
/**
* cy.task('getFileSize', filename).then((fileSize) => {
expect(fileSize).to.greaterThan(1500000)
})
*/
})
\ No newline at end of file
e2e/cypress/plugins/index.js
View file @
0e9c1e6e
...
...
@@ -18,6 +18,7 @@
// eslint-disable-next-line no-unused-vars
const
cucumber
=
require
(
'cypress-cucumber-preprocessor'
).
default
const
{
rmdir
,
statSync
,
mkdirSync
,
writeFile
}
=
require
(
'fs'
)
const
path
=
require
(
'path'
)
module
.
exports
=
(
on
,
config
)
=>
{
// `on` is used to hook into various events Cypress emits
...
...
@@ -38,16 +39,17 @@ module.exports = (on, config) => {
})
})
},
getFileSize
(
filePath
)
{
console
.
log
(
'getting size of file: %s'
,
filePath
)
return
new
Promise
((
resolve
,
reject
)
=>
{
var
fileSize
=
statSync
(
filePath
,
(
err
,
stats
)
=>
{
getFileSize
(
fileName
)
{
console
.
log
(
'getting size of file: %s'
,
fileName
)
// wait file finished to download
return
new
Promise
((
resolve
,
reject
)
=>
{
statSync
(
fileName
,
(
err
,
stats
)
=>
{
if
(
err
)
{
console
.
error
(
err
)
return
reject
(
err
)
}
resolve
(
stats
.
size
)
})
;
})
})
},
})
...
...
e2e/cypress/videos/case-948.feature.mp4
deleted
100644 → 0
View file @
89eef867
File deleted
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