How to use ShouldWorkForWebkitDirectory method of PuppeteerSharp.Tests.InputTests.FileChooserIsMultipleTests class

Best Puppeteer-sharp code snippet using PuppeteerSharp.Tests.InputTests.FileChooserIsMultipleTests.ShouldWorkForWebkitDirectory

Run Puppeteer-sharp automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

FileChooserIsMultipleTests.cs

Source: FileChooserIsMultipleTests.cs Github

copy
1using System;
2using System.Threading.Tasks;
3using PuppeteerSharp.Mobile;
4using Xunit;
5using Xunit.Abstractions;
6
7namespace PuppeteerSharp.Tests.InputTests
8{
9    [Collection(TestConstants.TestFixtureCollectionName)]
10    public class FileChooserIsMultipleTests : PuppeteerPageBaseTest
11    {
12        public FileChooserIsMultipleTests(ITestOutputHelper output) : base(output)
13        {
14        }
15
16        [Fact]
17        public async Task ShouldWorkForSingleFilePick()
18        {
19            await Page.SetContentAsync("<input type=file>");
20            var waitForTask = Page.WaitForFileChooserAsync();
21
22            await Task.WhenAll(
23                waitForTask,
24                Page.ClickAsync("input"));
25
26            Assert.False(waitForTask.Result.IsMultiple);
27        }
28
29        [Fact]
30        public async Task ShouldWorkForMultiple()
31        {
32            await Page.SetContentAsync("<input type=file multiple>");
33            var waitForTask = Page.WaitForFileChooserAsync();
34
35            await Task.WhenAll(
36                waitForTask,
37                Page.ClickAsync("input"));
38
39            Assert.True(waitForTask.Result.IsMultiple);
40        }
41        
42        [Fact]
43        public async Task ShouldWorkForWebkitDirectory()
44        {
45            await Page.SetContentAsync("<input type=file multiple webkitdirectory>");
46            var waitForTask = Page.WaitForFileChooserAsync();
47
48            await Task.WhenAll(
49                waitForTask,
50                Page.ClickAsync("input"));
51
52            Assert.True(waitForTask.Result.IsMultiple);
53        }
54    }
55}
56
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger ShouldWorkForWebkitDirectory code on LambdaTest Cloud Grid

Execute automation tests with ShouldWorkForWebkitDirectory on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)