Exemplo n.º 1
0
        private static async Task InstallAllDriverAsync(InstallAllOptions opts)
        {
            opts.DriverPath ??= ".";

            Playwright.InstallDriver(opts.DriverPath);
            await Playwright.InstallAsync(opts.DriverPath, opts.BrowsersPath);
        }
Exemplo n.º 2
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Installing playwright");
            await Playwright.InstallAsync();

            ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
            {
                builder.SetMinimumLevel(LogLevel.Debug);
                builder.AddDebug();
                builder.AddFilter((f, _) => f == "PlaywrightSharp.Playwright");
            });

            using var playwright = await Playwright.CreateAsync(loggerFactory, debug : "pw:api");

            await using var browser = await playwright.Chromium.LaunchAsync(new LaunchOptions { Headless = true });

            var page = await browser.NewPageAsync();

            Console.WriteLine("Navigating google");
            await page.GoToAsync("http://www.google.com");

            Console.WriteLine("Generating PDF");
            await page.GetPdfAsync(Path.Combine(Directory.GetCurrentDirectory(), "google.pdf"));

            Console.WriteLine("Export completed");
        }
Exemplo n.º 3
0
        public async Task Test1()
        {
            Console.WriteLine("Installing playwright");
            await Playwright.InstallAsync();

            Console.WriteLine("Creating playwright");
            var playwright = await Playwright.CreateAsync();
        }
Exemplo n.º 4
0
        private async Task <IBrowser> GetBrowserAsync()
        {
            await Playwright.InstallAsync();

            var playwright = await Playwright.CreateAsync();

            return(await playwright.Chromium.LaunchAsync(headless : false));
        }
Exemplo n.º 5
0
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddSingleton((x) => x.GetRequiredService <IConfiguration>().Get <TestSettings>());
     services.AddSingleton <DisposableServices>();
     Playwright.InstallAsync().Wait();
     services.AddSingleton <IPlaywright>((x) => {
         var playwright = Playwright.CreateAsync().Result;
         x.GetRequiredService <DisposableServices>().Services.Add(playwright);
         return(playwright);
     });
     services.AddSingleton <BrowserFactory>();
 }
Exemplo n.º 6
0
        public Tests(ITestOutputHelper outputHelper)
        {
            outputHelper.WriteLine("Setting up browser drivers. This might take awhile");
            Playwright.InstallAsync().GetAwaiter().GetResult();
            Environment.SetEnvironmentVariable("PWDEBUG", "1");
            Environment.SetEnvironmentVariable("DEBUG", "pw:api");

            playwright = Playwright.CreateAsync().GetAwaiter().GetResult();

            outputHelper.WriteLine("Finished setting up browser drivers");
            this.outputHelper = outputHelper;
        }
Exemplo n.º 7
0
        public async Task Test1()
        {
            await Playwright.InstallAsync();

            using var playwright = await Playwright.CreateAsync();

            await using var browser = await playwright.Chromium.LaunchAsync(headless : false);

            var page = await browser.NewPageAsync();

            await page.GoToAsync("http://www.google.com");
        }
Exemplo n.º 8
0
        static async Task Main(string[] args)
        {
            await Playwright.InstallAsync().ConfigureAwait(false);

            var playwright = await Playwright.CreateAsync();

            var chromium = playwright.Chromium;
            var browser  = await chromium.LaunchAsync(new LaunchOptions { Headless = false });

            var page = await browser.NewPageAsync();

            await page.GoToAsync("https://example.com");

            Console.ReadLine();
        }
Exemplo n.º 9
0
        public async Task <bool> InstallPlaywrightAsync()
        {
            try
            {
                Console.WriteLine($"Installing Playwright to {EnvironmentVariables["PLAYWRIGHT_BROWSERS_PATH"]}");
                await Playwright.InstallAsync(EnvironmentVariables["PLAYWRIGHT_BROWSERS_PATH"]);

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Exception installing playwright: {e.ToString()}");
                return(false);
            }
        }
Exemplo n.º 10
0
        public async Task <bool> InstallPlaywrightAsync()
        {
            try
            {
                Console.WriteLine($"Installing Playwright to Browsers: {Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH")} Driver: {Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH")}");
                await Playwright.InstallAsync(Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH"), Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH"));

                DisplayContents(Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH"));
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Exception installing playwright: {e.ToString()}");
                return(false);
            }
        }
        public async void ThenUserShouldStayOnTheSamePage()
        {
            Console.WriteLine(" it has entered the block");
            await Playwright.InstallAsync();

            using var playwright = await Playwright.CreateAsync();

#pragma warning disable CS0164 // This label has not been referenced
            await using var browser = await playwright.Chromium.LaunchAsync(headless : false);

#pragma warning restore CS0164 // This label has not been referenced
            var context = await browser.NewContextAsync();

            var page = await context.NewPageAsync();

            await page.GoToAsync("http://www.bing.com");
        }
Exemplo n.º 12
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Installing playwright");
            await Playwright.InstallAsync();

            using var playwright = await Playwright.CreateAsync();

            await using var browser = await playwright.Chromium.LaunchAsync(new LaunchOptions { Headless = true });

            Console.WriteLine("Navigating microsoft");
            var page = await browser.NewPageAsync();

            await page.GoToAsync("http://www.microsoft.com");

            Console.WriteLine("Taking Screenshot");
            File.WriteAllBytes(Path.Combine(Directory.GetCurrentDirectory(), "microsoft.png"), await page.ScreenshotAsync());

            Console.WriteLine("Export completed");
        }
Exemplo n.º 13
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Installing playwright");
            await Playwright.InstallAsync();

            using var playwright = await Playwright.CreateAsync();

            await using var browser = await playwright.Chromium.LaunchAsync(new LaunchOptions { Headless = true });

            var page = await browser.NewPageAsync();

            Console.WriteLine("Navigating google");
            await page.GoToAsync("http://www.google.com");

            Console.WriteLine("Generating PDF");
            await page.GetPdfAsync(Path.Combine(Directory.GetCurrentDirectory(), "google.pdf"));

            Console.WriteLine("Export completed");
        }
Exemplo n.º 14
0
        /// <summary>
        /// Create and returns the WebDriver / Remote WebDriver instance based on the executionType parameter
        /// </summary>
        /// <param name="browserType">Browser key value which is specified in App.config file</param>
        /// <param name="executionType">When passed with value "local", will execute in your local machine, else will execute in a Selenium Grid</param>
        /// <returns>IWebDriver instance</returns>

        // public IPlaywright GetDriver(string executionType, string browserType)



        /// <inheritdoc/>
        /// public Task InitializeAsync() => LaunchBrowserAsync();

        /// <inheritdoc/>
        // public Task DisposeAsync() => ShutDownAsync();

        //public static async Task LaunchBrowserAsync()
        //{
        //    try
        //    {
        //        Playwright = await PlaywrightSharp.Playwright.CreateAsync(TestConstants.LoggerFactory, debug: "pw*");
        //        Browser = await Playwright[TestConstants.Product].LaunchAsync(TestConstants.GetDefaultBrowserOptions());
        //        var page = await Browser.NewPageAsync();
        //        await page.GoToAsync(TestConstants.ServerUrl);
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.WriteLine(ex);
        //        throw new Exception("Launch failed", ex);
        //    }
        //}



        //public async Task<IPage> InitalizePlaywright(Browser browser, LaunchOptions launchOptions)
        //{
        //    // launchOptions.Headless = false;
        //    // launchOptions.ExecutablePath = @"C:\kasi\Backup\UdamyPlaywrightbackup\chromedriver_win32\chromedriver.exe";
        //    await Playwright.InstallAsync();
        //    var playwright = await Playwright.CreateAsync(TestConstants.LoggerFactory, debug: "pw*");

        //    IBrowser pBrowser = null;
        //    if (browser == Browser.Chromium)
        //        pBrowser = await playwright.Chromium.LaunchAsync(launchOptions);
        //    if (browser == Browser.Firefox)
        //        pBrowser = await playwright.Firefox.LaunchAsync(launchOptions);
        //    Page = await pBrowser.NewPageAsync();
        //    // await pBrowser.CloseAsync(); closing browser
        //    return Page;
        //}


        public async Task <IPage> InitalizePlaywright(string browser, LaunchOptions launchOptions)
        {
            // launchOptions.Headless = false;
            // launchOptions.ExecutablePath = @"C:\kasi\Backup\UdamyPlaywrightbackup\chromedriver_win32\chromedriver.exe";
            await Playwright.InstallAsync();

            var playwright = await Playwright.CreateAsync(TestConstants.LoggerFactory, debug : "pw*");

            IBrowser pBrowser = null;

            if (browser == "Chrome")
            {
                pBrowser = await playwright.Chromium.LaunchAsync(launchOptions);
            }
            if (browser == "Firefox")
            {
                pBrowser = await playwright.Firefox.LaunchAsync(launchOptions);
            }
            Page = await pBrowser.NewPageAsync();

            // await pBrowser.CloseAsync(); closing browser
            return(Page);
        }
Exemplo n.º 15
0
        public async Task <IActionResult> Index()
        {
            await Playwright.InstallAsync();

            using var playwright = await Playwright.CreateAsync();

            await using var browser = await playwright.Chromium.LaunchAsync(new LaunchOptions
            {
                Headless = true
            });

            var page = await browser.NewPageAsync();

            var htmlContent = await System.IO.File.ReadAllTextAsync("wwwroot/testPage.html");

            await page.SetContentAsync(htmlContent, LifecycleEvent.Load);

            var headerTemplate = @"<!DOCTYPE html>
                <html>
                    <head>
                        <title>FooterTemplate</title>
                        <style>bodye { font-size: 16px; color: lightblue;}</style>
                    </head>
                    <body>
                        <div>Test header template</div>
                    </body>
                </html>";


            var bytesResponse = await page.GetPdfAsync(null, 1, true, headerTemplate, "<div>Test footer template</div>", true, false, "", null,
                                                       null, null, new Margin { Bottom = "1in", Top = "2in" }, false);

            FileResult fileResult = new FileContentResult(bytesResponse, "application/pdf");

            fileResult.FileDownloadName = "test.pdf";
            return(fileResult);
        }
Exemplo n.º 16
0
        public async Task <IPage> InitalizePlaywright(Browser browser, LaunchOptions launchOptions)
        {
            await Playwright.InstallAsync();

            var playwright = await Playwright.CreateAsync();

            IBrowser pBrowser = null;

            if (browser == Browser.Chromium)
            {
                pBrowser = await playwright.Chromium.LaunchAsync(launchOptions);
            }
            if (browser == Browser.Firefox)
            {
                pBrowser = await playwright.Firefox.LaunchAsync(launchOptions);
            }
            if (browser == Browser.WebKit)
            {
                pBrowser = await playwright.Webkit.LaunchAsync(launchOptions);
            }
            Page = await pBrowser.NewPageAsync();

            return(Page);
        }
Exemplo n.º 17
0
 public static void Main(string[] args)
 {
     Playwright.InstallAsync();
     CreateHostBuilder(args).Build().Run();
 }
Exemplo n.º 18
0
 static BasePdfController()
 {
     playwrightInstall = Playwright.InstallAsync();
 }
Exemplo n.º 19
0
        public async Task FilterSmokeTest()
        {
            await Playwright.InstallAsync();

            using var playwright = await Playwright.CreateAsync();

            await using var browser = await playwright.Chromium.LaunchAsync(
                            headless : false
                            );

            var context = await browser.NewContextAsync();

            // Open new page
            var page = await context.NewPageAsync();


            await page.GoToAsync("https:qafour.profitstarsfps.com");

            // Click [placeholder="Enter User Name"]
            await page.ClickAsync("[placeholder=\"Enter User Name\"]");

            // Fill [placeholder="Enter User Name"]
            await page.FillAsync("[placeholder=\"Enter User Name\"]", "mpantoja");

            // Press Tab
            await page.PressAsync("[placeholder=\"Enter User Name\"]", "Tab");

            // Fill [aria-label="Password"]
            await page.FillAsync("[aria-label=\"Password\"]", "Kiara###");

            // Press Enter
            await Task.WhenAll(
                page.WaitForNavigationAsync(/*"https://qafour.profitstarsfps.com/"*/),
                page.PressAsync("[aria-label=\"Password\"]", "Enter"));

            // Go to https://qafour.profitstarsfps.com/#/home
            await page.GoToAsync("https://qafour.profitstarsfps.com/#/home");

            // Go to https://qafour.profitstarsfps.com/#/dashboard
            await page.GoToAsync("https://qafour.profitstarsfps.com/#/dashboard");

            // Click text=PROFITABILITY
            await Task.WhenAll(
                page.WaitForNavigationAsync(/*"https://qafour.profitstarsfps.com/#/profitabilityLandingPage/relationship"*/),
                page.ClickAsync("text=PROFITABILITY"));

            // Click text=Relationships
            await page.ClickAsync("text=Relationships");

            // Click [placeholder="Select"]
            await page.ClickAsync("[placeholder=\"Select\"]");

            // Click #viewsrelationshipsPopoverButton
            await page.ClickAsync("#viewsrelationshipsPopoverButton");

            // Click text=My Saved Views CSV Excel Jan 2020 Custom From 2020 Jan Feb Mar Apr May Jun Jul A >> :nth-match(i, 2)
            await page.ClickAsync("span:nth-child(2) .px-vertical-middle");

            // Click text=Filters
            await page.ClickAsync("text=Filters");

            // Click text=× Close
            await page.ClickAsync("text=× Close");

            await page.ClickAsync("text=× Close");

            // Click text = My Saved Views CSV Excel Jan 2020 Custom From 2020 Jan Feb Mar Apr May Jun Jul A >> :nth - match(i, 2)
            await page.ClickAsync("span:nth-child(2) .px-vertical-middle");

            // Click text=Filters
            await page.ClickAsync("text=Filters");

            // Click button:has-text("Cancel")
            await page.ClickAsync("button:has-text(\"Cancel\")");

            // Click text = My Saved Views CSV Excel Jan 2020 Custom From 2020 Jan Feb Mar Apr May Jun Jul A >> :nth - match(i, 2)
            await page.ClickAsync("span:nth-child(2) .px-vertical-middle");

            // Press ArrowDown
            await page.PressAsync("[placeholder='Select Column']", "ArrowDown");

            // Press ArrowDown
            await page.PressAsync("[placeholder=\"Select Column\"]", "ArrowDown");

            // Press Tab
            await page.PressAsync("[placeholder=\"Select Column\"]", "Tab");

            // Press ArrowDown
            await page.PressAsync("[placeholder=\"Select Filter\"]", "ArrowDown");

            await page.PressAsync("[placeholder=\"Select Filter\"]", "ArrowDown");

            await page.PressAsync("[placeholder=\"Select Filter\"]", "ArrowDown");

            // Press Tab
            await page.PressAsync("[placeholder=\"Select Filter\"]", "Tab");

            // Fill input[name="numericInputFilterDetailInputField"]
            await page.FillAsync("input[name=\"numericInputFilterDetailInputField\"]", "1");

            // Click button:has-text("Apply")
            await page.ClickAsync("button:has-text(\"Apply\")");

            // Assert.Equal("https://qafour.profitstarsfps.com/#/profitabilityLandingPage/relationship?viewData=%7B%22dataDictionary%22:%7B%22relationships%22:%22%7B%5C%220%5C%22:0,%5C%221%5C%22:%5C%22relationshipName%5C%22,%5C%222%5C%22:%5B%5C%22loans%5C%5Cb3%5C%5Cb1%5C%5Cb2%5C%5Cb1%5C%5CbLoans%20%3D%20$1.00%5C%22%5D,%5C%223%5C%22:%5B%5C%22profit%5C%5Cbdesc%5C%22%5D,%5C%224%5C%22:%5C%2224240%5C%5Cb24240%5C%5CbJan%202020%5C%22,%5C%225%5C%22:0,%5C%226%5C%22:1%7D%22%7D,%22viewID%22:%22relationships%22%7D", page.Url);

            // Click text=My Saved Views CSV Excel Jan 2020 Custom From 2020 Jan Feb Mar Apr May Jun Jul A >> i
            await page.ClickAsync("#actionsrelationships span span span");

            // Click input[name="saveAsDialogInputInputField"]
            await page.ClickAsync("input[name=\"saveAsDialogInputInputField\"]");

            // Fill input[name="saveAsDialogInputInputField"]
            await page.FillAsync("input[name=\"saveAsDialogInputInputField\"]", "TestMatt");

            // Click text=OK
            await page.ClickAsync("text=OK");

            // Click #viewsrelationshipsPopoverButton
            await page.ClickAsync("#viewsrelationshipsPopoverButton");

            // Click #viewsrelationshipsPopoverButton
            await page.ClickAsync("#viewsrelationshipsPopoverButton");

            // Click text=My Saved Views CSV Excel Jan 2020 Custom From 2020 Jan Feb Mar Apr May Jun Jul A >> :nth-match(i, 2)
            await page.ClickAsync("span:nth-child(2) .px-vertical-middle");

            // Click text=Yes
            await page.ClickAsync("text=Yes");


            // Click img
            await page.ClickAsync("img");

            // Assert.Equal("https://qafour.profitstarsfps.com/#/dashboard", page.Url);

            // Click a:has-text("Ovation Bank")
            await page.ClickAsync("a:has-text(\"Ovation Bank\")");

            // Click text=Sign Out
            await page.ClickAsync("text=Sign Out");

            // Assert.Equal("https://profitstarsfpsdev.b2clogin.com/profitstarsfpsdev.onmicrosoft.com/oauth2/v2.0/logout?p=b2c_1_jha.signin&post_logout_redirect_uri=https%3A%2F%2Fqasp.profitstarsfps.com%2FLogOut", page.Url);

            // Go to https://qafour.profitstarsfps.com/LogOut
            await page.GoToAsync("https://qafour.profitstarsfps.com/LogOut");
        }
Exemplo n.º 20
0
        public async Task CustRankingFavorite()
        {
            //Context Context;
            //LogIn login = null;
            //LogOff logOff = null;

            //public LogInSteps(Context context)
            //{
            //    Context = context;
            //    login = new LogIn(Context.Page);
            //    logOff = new LogOff(Context.Page);
            //}
            //await login.LoginFPS("DMLTest12", "Kiara%%%");



            string baseNameFavRep = "AAA BB Fav ";

            string dateappend     = DateTime.Now.ToString();
            string dateappend1    = dateappend.Replace("/", "");
            string dateappend2    = dateappend1.Replace(":", "");
            string faveAppendName = baseNameFavRep + dateappend2;

            await Playwright.InstallAsync();

            using var playwright = await Playwright.CreateAsync();

            await using var browser = await playwright.Chromium.LaunchAsync(
                            headless : false,
                            slowMo : 500

                            );

            var context = await browser.NewContextAsync();

            //// Open new page
            var page = await context.NewPageAsync();

            await page.GoToAsync("https://qafour.profitstarsfps.com");


            //// Click [placeholder="Enter User Name"]
            await page.ClickAsync("[placeholder=\"Enter User Name\"]");

            //Fill [placeholder="Enter User Name"]
            await page.FillAsync("[placeholder=\"Enter User Name\"]", "mpantoja");

            //  Press Tab
            await page.PressAsync("[placeholder=\"Enter User Name\"]", "Tab");

            //// Fill [aria-label="Password"]
            await page.FillAsync("[aria-label=\"Password\"]", "Kiara###" +
                                 "");

            //Press Enter
            await Task.WhenAll(
                page.WaitForNavigationAsync(/*"https://qafour.profitstarsfps.com/"*/),
                page.PressAsync("[aria-label=\"Password\"]", "Enter"));

            await page.GoToAsync("https://qafour.profitstarsfps.com/#/home");

            await page.GoToAsync("https://qafour.profitstarsfps.com/#/dashboard");

            // Click text=REPORTING
            await page.ClickAsync("text=REPORTING");

            // Click text=Create Reports
            await Task.WhenAll(
                page.WaitForNavigationAsync(/*"https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%229%22:29,%2223%22:0%7D"*/),
                page.ClickAsync("text=Create Reports"));

            // Click input[type="text"]
            await page.ClickAsync("input[type=\"text\"]");

            // Fill input[type="text"]
            await page.FillAsync("input[type=\"text\"]", "Customer Ranking");

            // Press Enter
            await page.PressAsync("input[type=\"text\"]", "Enter");

            // Assert.Equal("https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%229%22:46,%2223%22:0%7D", page.Url);
            // Check input[name="Save as Favorite"]
            await page.CheckAsync("input[name=\"Save as Favorite\"]");

            // Click input[name="favoriteNameInputField"]
            await page.ClickAsync("input[name=\"favoriteNameInputField\"]");

            // Fill input[name="favoriteNameInputField"]
            await page.FillAsync("input[name=\"favoriteNameInputField\"]", faveAppendName);

            // Click text=Excel
            await page.ClickAsync("text=Excel");

            // Click text=Save
            await page.ClickAsync("text=Save");

            // Click text=Favorites
            await page.ClickAsync("text=Favorites");

            // Assert.Equal("https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%229%22:1,%2223%22:1%7D", page.Url);
            // Click #scrollCanvas

            await page.ClickAsync("text=View Reports");

            // Assert.Equal("https://qafour.profitstarsfps.com/#/viewReports", page.Url);
            // Click text=Create Reports
            await Task.WhenAll(
                page.WaitForNavigationAsync(/*"https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%229%22:29,%2223%22:0%7D"*/),
                page.ClickAsync("text=Create Reports"));

            // Assert.Equal("https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%7D", page.Url);
            // Click text=Favorites
            await page.ClickAsync("text=Favorites");

            // Assert.Equal("https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%229%22:1,%2223%22:1%7D", page.Url);
            // Click input[type="text"]
            await page.ClickAsync("input[type=\"text\"]");

            // Fill input[type="text"]
            await page.FillAsync("input[type=\"text\"]", faveAppendName);

            // Click text=AAA BB Fav 4212021 93938 PM
            await page.ClickAsync("text=" + faveAppendName);

            // below is just a sort of stub area until we can figure out the scroll canvas issue

            //  await page.FocusAsync("#delete4");

            // await page.QuerySelectorAllAsync("#delete3");
            // await page.GetAttributeAsync("delete3",);

            // await page.ClickAsync(clickX);
            // await page.GetAttributeAsync("#delete3",faveAppendName);

            //await page.ClickAsync("//*[@id='delete4']");

            // await page.ClickAsync("//div[@id='SelectionPanelTreeview']//*[@id='delete3']");

            //  < span id = "delete4" class="treeview-node-button fa fa-times" ng-style="{left: node.deleteButtonLeft, position: 'absolute'}" ng-click="vm.deleteNode($index)" ng-class="node.deleteButtonClass" style="left: 584px; position: absolute;">
            //          </span>

            //await page.ClickAsync("#delete3", force: true);

            // ---------------------
        }
Exemplo n.º 21
0
        public async Task DecileSummaryCPP()
        {
            await Playwright.InstallAsync();

            using var playwright = await Playwright.CreateAsync();

            await using var browser = await playwright.Chromium.LaunchAsync(
                            headless : false,
                            slowMo : 500

                            );

            var context = await browser.NewContextAsync();

            //// Open new page
            var page = await context.NewPageAsync();

            await page.GoToAsync("https://qafour.profitstarsfps.com");

            // await login.LoginFPS("DMLTest12", "Kiara%%%");

            //// Click [placeholder="Enter User Name"]
            await page.ClickAsync("[placeholder=\"Enter User Name\"]");

            //Fill [placeholder="Enter User Name"]
            await page.FillAsync("[placeholder=\"Enter User Name\"]", "mpantoja");

            //  Press Tab
            await page.PressAsync("[placeholder=\"Enter User Name\"]", "Tab");

            //// Fill [aria-label="Password"]
            await page.FillAsync("[aria-label=\"Password\"]", "Kiara###");

            //Press Enter
            await Task.WhenAll(
                page.WaitForNavigationAsync(/*"https://qafour.profitstarsfps.com/"*/),
                page.PressAsync("[aria-label=\"Password\"]", "Enter"));

            await page.GoToAsync("https://qasp.profitstarsfps.com/#/home");



            // Go to https://qafour.profitstarsfps.com/#/dashboard
            await page.GoToAsync("https://qafour.profitstarsfps.com/#/dashboard");

            // Click text=REPORTING
            await page.ClickAsync("text=REPORTING");

            // Click text=Create Reports
            await Task.WhenAll(
                page.WaitForNavigationAsync(/*"https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%229%22:29,%2223%22:0%7D"*/),
                page.ClickAsync("text=Create Reports"));

            // Click input[type="text"]
            await page.ClickAsync("input[type=\"text\"]");

            // Fill input[type="text"]
            await page.FillAsync("input[type=\"text\"]", "Decile Summary");

            // Click text=Decile Summary
            // Press Enter
            await page.PressAsync("input[type=\"text\"]", "Enter");

            // Assert.Equal("https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%229%22:49,%2223%22:0%7D", page.Url);
            // Fill input[name="_Option1"]
            // await page.FillAsync("input[name=\"_Option1\"]", "1");
            // Click input[name="_Option1"]
            await page.ClickAsync("input[name=\"_Option1\"]");

            // Click text=PDF
            await page.ClickAsync("text=PDF");

            // Click text=Generate
            await page.ClickAsync("text=Generate");

            // Click text=View Reports
            await page.ClickAsync("text=View Reports");

            // Assert.Equal("https://qafour.profitstarsfps.com/#/viewReports", page.Url);
            // Click text=Decile Summary PDF04/20/2021 8:16 PM 1 Selected >> span
            await page.WaitForSelectorAsync("// html / body / div[2] / div[1] / div / section / div[2] / div[2] / div / div / div[3] / form / div / div / div[3] / table / tbody / tr / td[1] / div / div / span");

            // await page.ClickAsync("text=Decile Summary PDF04/20/2021 8:16 PM 1 Selected >> span");
            // Click td[role="gridcell"] span
            await page.ClickAsync("td[role=\"gridcell\"] span");

            // Click text=Delete
            await page.ClickAsync("text=Delete");

            // Click text=Yes
            await page.ClickAsync("text=Yes");

            // Click text=Create Reports
            await Task.WhenAll(
                page.WaitForNavigationAsync(/*"https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%229%22:29,%2223%22:0%7D"*/),
                page.ClickAsync("text=Create Reports"));

            // Assert.Equal("https://qafour.profitstarsfps.com/#/createReports?userSelection=%7B%7D", page.Url);
            // ---------------------
        }
Exemplo n.º 22
0
 private static Task InstallAsync(InstallBrowsersOptions opts) => Playwright.InstallAsync(browsersPath: opts.Path);