Skip to content

Commit

Permalink
+ [CY] implement
Browse files Browse the repository at this point in the history
  • Loading branch information
lanfon72 committed Jun 6, 2022
1 parent 94982d7 commit 9332f04
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const dotenvPlugin = require('cypress-dotenv');
const fs = require("fs");
const yaml = require('js-yaml');
const { isFileExist, findFiles } = require('cy-verify-downloads');
const AdmZip = require("adm-zip");

// ***********************************************************
// This example plugins/index.js can be used to load plugins
Expand All @@ -27,8 +28,9 @@ module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
config.baseUrl = config.env.baseUrl;
on('task', { isFileExist, findFiles }),
on("task", {
isFileExist,
findFiles,
readYaml(filename) {
return new Promise((res, rej) => {
try {
Expand Down Expand Up @@ -59,6 +61,16 @@ module.exports = (on, config) => {
resolve(true)
})
})
},
readZipFile (fileName) {
return new Promise((resolve, reject) => {
try {
resolve(new AdmZip(fileName).getEntries())
} catch (e) {
console.error(e)
resolve(e.message)
}
})
}
})

Expand Down

0 comments on commit 9332f04

Please sign in to comment.