Skip to content

Commit 81c81ac

Browse files
committed
push
1 parent 214c852 commit 81c81ac

3 files changed

Lines changed: 60 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gracefnr/synpress",
3-
"version": "1.0.19",
3+
"version": "1.0.20",
44
"packageManager": "pnpm@9.1.3",
55
"description": "Synpress is e2e testing framework based around Cypress.io & playwright with included MetaMask support. Test your dapps with ease.",
66
"keywords": [

plugins/index.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,60 @@ module.exports = (on, config) => {
243243
await etherscan.getTransactionStatus(txid),
244244
etherscanWaitForTxSuccess: async ({ txid }) =>
245245
await etherscan.waitForTxSuccess(txid),
246+
uploadVideo: async (videoPath) => {
247+
const fs = require('fs');
248+
const path = require('path');
249+
const FormData = require('form-data');
250+
const fetch = require('node-fetch');
251+
252+
try {
253+
// Check if video file exists
254+
const fullPath = path.resolve(videoPath);
255+
if (!fs.existsSync(fullPath)) {
256+
throw new Error(`Video file not found: ${fullPath}`);
257+
}
258+
259+
console.log(`📹 Uploading video: ${fullPath}`);
260+
261+
// Create form data
262+
const form = new FormData();
263+
form.append('file', fs.createReadStream(fullPath));
264+
265+
// Upload to transfer.toolsfdg.net
266+
const response = await fetch('https://transfer.toolsfdg.net/video', {
267+
method: 'POST',
268+
body: form,
269+
headers: form.getHeaders()
270+
});
271+
272+
const result = await response.text();
273+
274+
if (response.ok) {
275+
console.log(`✅ Video uploaded successfully: ${result}`);
276+
return {
277+
success: true,
278+
url: result,
279+
status: response.status,
280+
message: 'Video uploaded successfully'
281+
};
282+
} else {
283+
console.error(`❌ Video upload failed: ${response.status} - ${result}`);
284+
return {
285+
success: false,
286+
status: response.status,
287+
error: result,
288+
message: 'Video upload failed'
289+
};
290+
}
291+
} catch (error) {
292+
console.error(`❌ Video upload error: ${error.message}`);
293+
return {
294+
success: false,
295+
error: error.message,
296+
message: 'Video upload error'
297+
};
298+
}
299+
},
246300
});
247301

248302
if (process.env.BASE_URL) {

support/commands.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,8 @@ Cypress.Commands.add(
419419
return subject;
420420
},
421421
);
422+
423+
// Video upload command
424+
Cypress.Commands.add('uploadVideo', (videoPath) => {
425+
return cy.task('uploadVideo', videoPath);
426+
});

0 commit comments

Comments
 (0)