Skip to content

Commit

Permalink
added local copy for videoUpload E2E test in CI pipe so its in the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Radoslav Radev committed May 1, 2024
1 parent 9f835c8 commit edd736e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/E2Etest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
jobs:
test:
runs-on: windows-latest

env:
REPO_ROOT: ${{ github.workspace }}

steps:
- name: Checkout code
Expand Down
14 changes: 12 additions & 2 deletions Backend/Tests/E2E.Tests/UploadVideo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ public UploadVideo()
[Fact]
public void Upload()
{
var repoRoot = GetRepositoryRoot();
var videoFilePath = Path.Combine(repoRoot, "tmp", "SampleVideo1mb.mp4");
var thumbnailFilePath = Path.Combine(repoRoot, "tmp", "sampleThumbnail.jpg");
login.Login();
_driver.Navigate().GoToUrl("http://145.220.74.148:3000/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(@"tmp\SampleVideo1mb.mp4");
_driver.FindElement(UploadPage.SelectThumbnail).SendKeys(@"tmp\sampleThumbnail.jpg");
_driver.FindElement(UploadPage.SelectVideoButton).SendKeys(videoFilePath);
_driver.FindElement(UploadPage.SelectThumbnail).SendKeys(thumbnailFilePath);
_driver.FindElement(UploadPage.UploadButton).Click();
Thread.Sleep(7000);
var alert = _driver.SwitchTo().Alert();
Expand All @@ -33,4 +36,11 @@ public void Upload()
_driver.SwitchTo().DefaultContent();
}


string GetRepositoryRoot()
{
// This could be an environment variable or a static path
return Environment.GetEnvironmentVariable("REPO_ROOT") ?? throw new InvalidOperationException("Repository root not set.");
}

}

0 comments on commit edd736e

Please sign in to comment.