aerokube / moon

Browser automation solution for Kubernetes and Openshift supporting Selenium, Playwright, Puppeteer and Cypress
http://aerokube.com/moon/latest
Apache License 2.0
224 stars 20 forks source link

Uploading files in Browser using an NFS share #318

Open johnqa opened 2 years ago

johnqa commented 2 years ago

Hi,

I have a deployment of Selenoid in a SWARM Cluster and I am using an NFS share to keep input data for my tests . This share is mounted in browsers containers.

I want to make the same thing for Moon deployed in Kubernetes, but I couldn't find any way of doing it.

Can you helm me with this?

Thank you, John

vania-pooh commented 2 years ago

@johnqa Moon only support S3 as storage. Kubernetes volumes \ NFS are not supported and we don't have plans to support it in the future.

johnqa commented 2 years ago

That is too bad.

But is there a way to run a sh script immediately after the browser container is initialised and mount the share in the filesystem?

vania-pooh commented 2 years ago

@johnqa currently we don't have such feature.

code-with-v commented 2 years ago

@johnqa Moon only support S3 as storage. Kubernetes volumes \ NFS are not supported and we don't have plans to support it in the future.

@vania-pooh how to integrate s3 as storage for file system

vania-pooh commented 2 years ago

@vivek-singh-thridsummit you can use third-party tools like minio.

code-with-v commented 2 years ago

@vania-pooh what i can see is that minio provide the storage solution for recorded video but I want a shared space for my test input data. Is there any tutorial where minio work in such a manner please provide, it would be a great help

@vivek-singh-thridsummit you can use third-party tools like minio.

vania-pooh commented 2 years ago

@vivek-singh-thridsummit storing test input data is out of Moon scope. Moon even does not know that you are running tests in browsers. This is just an API for efficient browser automation.

code-with-v commented 2 years ago

Ohh Got it, Is there any way to attach configmap or mount any host volume into browser pods ?

vania-pooh commented 2 years ago

@vivek-singh-thridsummit no, currently this is not supported. But in Selenium e.g. you can upload files to browser pod using built-in upload feature. https://aerokube.com/selenoid/latest/#_uploading_files_to_browser

code-with-v commented 2 years ago

can we mount hostPath is Moongrid 2.x like we do for Moongrid 1.x browser.json ?

vania-pooh commented 2 years ago

@vivek-singh-thridsummit currently this was not ported to Moon 2.

joshianand18 commented 2 years ago

Hi This is the approach to upload a file in c# Language. This might help you.

    [TestMethod]
    public void UploadFileTests_Test()
    {
        driver.Navigate().GoToUrl("https://cgi-lib.berkeley.edu/ex/fup.html");
        IWebElement upload = TestWebDriver.FindElement(By.Name("note"));
        upload.SendKeys(@System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location) + "/SampleFile.xlsx");
        TestWebDriver.FindElement(By.XPath("//input[@value='Press']")).Click();
        Console.WriteLine("File Uploaded Successfully");
    }
vania-pooh commented 2 years ago

@joshianand18 in Moon 2 we also have this: https://aerokube.com/moon/latest/#selenium-context Detailed article: https://blog.aerokube.com/selenium-moon-environment-provisioning-72402242c917