diff --git a/.github/workflows/E2Etest.yml b/.github/workflows/E2Etest.yml index 67aca96..a8dae82 100644 --- a/.github/workflows/E2Etest.yml +++ b/.github/workflows/E2Etest.yml @@ -24,6 +24,10 @@ jobs: - name: Install Chrome run: choco install googlechrome --ignore-checksums + - name: Sleep for 10m + run: Start-Sleep -s 600 + shell: powershell + - name: Navigate to E2E Tests directory run: cd Backend/Tests/E2E.Tests diff --git a/Backend/Tests/E2E.Tests/UploadVideo.cs b/Backend/Tests/E2E.Tests/UploadVideo.cs index 2434c88..2060ebc 100644 --- a/Backend/Tests/E2E.Tests/UploadVideo.cs +++ b/Backend/Tests/E2E.Tests/UploadVideo.cs @@ -22,8 +22,8 @@ public void Upload() _driver.FindElement(UploadPage.TitleInput).SendKeys($"Test-{new Guid().ToString()}"); _driver.FindElement(UploadPage.DescriptionInput).SendKeys("Test Description, Lorem Ipsum Dolor Sit Amet Consectetur Adipiscing Elit Sed Do Eiusmod Tempor Incididunt Ut Labore Et Dolore Magna Aliqua Ut Enim Ad Minim Veniam Quis Nostrud Exercitation Ullamco Laboris Nisi Ut Aliquip Ex Ea Commodo Consequat"); _driver.FindElement(UploadPage.CategoryInput).SendKeys("Music"); - _driver.FindElement(UploadPage.SelectVideoButton).SendKeys(@"C:\Users\ra408\Videos\2023-12-28 12-47-54.mkv"); - _driver.FindElement(UploadPage.SelectThumbnail).SendKeys(@"D:\Downloads\business-woman-pictures-pwo11q6cg9pxqq7c.jpg"); + _driver.FindElement(UploadPage.SelectVideoButton).SendKeys(@"tmp\SampleVideo1mb.mp4"); + _driver.FindElement(UploadPage.SelectThumbnail).SendKeys(@"tmp\sampleThumbnail.jpg"); _driver.FindElement(UploadPage.UploadButton).Click(); Thread.Sleep(7000); var alert = _driver.SwitchTo().Alert(); diff --git a/K6Tests/LikeVideo.js b/K6Tests/LikeVideo.js new file mode 100644 index 0000000..43727b8 --- /dev/null +++ b/K6Tests/LikeVideo.js @@ -0,0 +1,39 @@ +import http from 'k6/http'; +import { sleep } from 'k6'; + +export let options = { + stages: [ + { duration: '1m', target: 2000 }, // Ramp up to 100 users over 1 minute + { duration: '2m', target: 20 }, // Stay at 20 users for 2 minutes + { duration: '1m', target: 0 }, // Ramp down to 0 users over 1 minute + ], + thresholds: { + 'http_req_duration': ['p(95)<500'] // 95% of requests must complete below 500ms + }, + ext: { + loadimpact: { + // Project: OpenVidStreamer + projectID: 3693023, + // Test runs with the same name groups test runs together. + name: 'LikeVideo', + } + } +}; + +export default function () { + const params = { + headers: { + 'Authorization': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cG4iOiIwOGRjNDIwNy1mZWMwLTRlOTctOGY4MC0zYWU1MDUyYTMwNWEiLCJzdWIiOiIwOGRjNDIwNy1mZWMwLTRlOTctOGY4MC0zYWU1MDUyYTMwNWEiLCJqdGkiOiIxYTM5ZDI0Ny02NjkwLTRkYzItODFhNi1hMTljZmI0MWI4MjIiLCJleHAiOjE3MTM3ODgyMzgsImlzcyI6Ik9wZW5WaWRTdHJlYW1lckFjY291bnRTZXJ2aWNlIiwiYXVkIjoiT3BlblZpZFN0cmVhbWVyRkUifQ.Z8u7QhROGm9jjr0Ih9s4weNHlialLU08dGnCRDo36ug' + } + + }; + + let response = http.get('http://145.220.74.148:8000/recommendationAlgo/likeVideo?videoId=1bf7a7ce-a9bf-47b2-b9f9-23877f82ec66', params); + + // Optionally, you can check the response and log errors + if (response.status !== 200) { + console.log('Unexpected status ' + response.status); + } + + sleep(1); // Pause for 1 second between iterations +} diff --git a/K6Tests/StreamVideo.js b/K6Tests/StreamVideo.js new file mode 100644 index 0000000..2eb9233 --- /dev/null +++ b/K6Tests/StreamVideo.js @@ -0,0 +1,39 @@ +import http from 'k6/http'; +import { sleep } from 'k6'; + +export let options = { + stages: [ + { duration: '2m', target: 10000 }, // Ramp up to 10 000 users over 2 minute + { duration: '7m', target: 10000 }, // Stay at 10000 CPS for 7min + { duration: '1m', target: 0 }, // Ramp down to 0 users over 1 minute + ], + thresholds: { + 'http_req_duration': ['p(90)<10000'] // 89% of requests must complete below 10sec each HSL video chunc is 10sec long, and if it`s not loaded in 10sec it will result in loading for the user + }, + ext: { + loadimpact: { + // Project: OpenVidStreamer + projectID: 3693023, + // Test runs with the same name groups test runs together. + name: 'StreamVideo', + } + } +}; + +export default function () { + const params = { + headers: { + 'Authorization': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cG4iOiIwOGRjNDIwNy1mZWMwLTRlOTctOGY4MC0zYWU1MDUyYTMwNWEiLCJzdWIiOiIwOGRjNDIwNy1mZWMwLTRlOTctOGY4MC0zYWU1MDUyYTMwNWEiLCJqdGkiOiIyNWYwNjgxZC04NzMwLTQ4ZDgtODIyMC0xMzYyMzAwNGVhMmIiLCJleHAiOjE3MTQ1NzE3MTAsImlzcyI6Ik9wZW5WaWRTdHJlYW1lckFjY291bnRTZXJ2aWNlIiwiYXVkIjoiT3BlblZpZFN0cmVhbWVyRkUifQ.LV4iObB6OXV66kdx9caprcWawHbgAHG0HmyYEvuuxmk' + } + + }; + + let response = http.get('http://145.220.74.148:8000/streamer/videos/20240409/43a3308d-e879-4954-857c-f45171e1f27f/playlist3.ts', params); + + // Optionally, you can check the response and log errors + if (response.status !== 200) { + console.log('Unexpected status ' + response.status); + } + + // sleep(1); // Pause for 1 second between iterations +} diff --git a/K6Tests/getRecommendedVideos.js b/K6Tests/getRecommendedVideos.js new file mode 100644 index 0000000..f36da11 --- /dev/null +++ b/K6Tests/getRecommendedVideos.js @@ -0,0 +1,31 @@ +import http from 'k6/http'; +import { sleep } from 'k6'; + +export let options = { + stages: [ + { duration: '1m', target: 100 }, // Ramp up to 100 users over 1 minute + { duration: '1m', target: 100 }, // Stay at 100 users (rps) for 10 minutes + { duration: '1m', target: 0 }, // Ramp down to 0 users over 1 minute + ], + thresholds: { + 'http_req_duration': ['p(90)<700'] // 90% of requests must complete below 700ms + } +}; + +export default function () { + const params = { + headers: { + 'Authorization': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cG4iOiIwOGRjNDIwNy1mZWMwLTRlOTctOGY4MC0zYWU1MDUyYTMwNWEiLCJzdWIiOiIwOGRjNDIwNy1mZWMwLTRlOTctOGY4MC0zYWU1MDUyYTMwNWEiLCJqdGkiOiIyNWYwNjgxZC04NzMwLTQ4ZDgtODIyMC0xMzYyMzAwNGVhMmIiLCJleHAiOjE3MTQ1NzE3MTAsImlzcyI6Ik9wZW5WaWRTdHJlYW1lckFjY291bnRTZXJ2aWNlIiwiYXVkIjoiT3BlblZpZFN0cmVhbWVyRkUifQ.LV4iObB6OXV66kdx9caprcWawHbgAHG0HmyYEvuuxmk' + } + + }; + + let response = http.get('http://145.220.74.148:8000/videolib/recommendedVideos?category=Other&topN=20', params); + + // Optionally, you can check the response and log errors + if (response.status !== 200) { + console.log('Unexpected status ' + response.status); + } + + // sleep(1); // Pause for 1 second between iterations +} diff --git a/K6Tests/getRecommendedVideos.png b/K6Tests/getRecommendedVideos.png new file mode 100644 index 0000000..fc72141 Binary files /dev/null and b/K6Tests/getRecommendedVideos.png differ diff --git a/K6Tests/likeVideos.png b/K6Tests/likeVideos.png new file mode 100644 index 0000000..fd35655 Binary files /dev/null and b/K6Tests/likeVideos.png differ diff --git a/tmp/SampleVideo1mb.mp4 b/tmp/SampleVideo1mb.mp4 new file mode 100644 index 0000000..ed139d6 Binary files /dev/null and b/tmp/SampleVideo1mb.mp4 differ diff --git a/tmp/sampleThumbnail.jpg b/tmp/sampleThumbnail.jpg new file mode 100644 index 0000000..af7609e Binary files /dev/null and b/tmp/sampleThumbnail.jpg differ