Skip to content

DATA: InstallPlaywrightBrowsersTask#140

Open
mabroukmahdhi wants to merge 4 commits intomainfrom
users/mabroukmahdhi/data-install-playwright-browsers-task
Open

DATA: InstallPlaywrightBrowsersTask#140
mabroukmahdhi wants to merge 4 commits intomainfrom
users/mabroukmahdhi/data-install-playwright-browsers-task

Conversation

@mabroukmahdhi
Copy link
Contributor

closes #138

@mabroukmahdhi mabroukmahdhi self-assigned this Jan 24, 2025
@github-actions github-actions bot added the DATA For creating data models and migrations label Jan 24, 2025

namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks
{
public class WorkloadUpdateTask : GithubTask
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not expecting this file as it is in another PR already

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that this branche is based on other one.

{
public class InstallPlaywrightTask : GithubTask
{
public override string Run { get; set; } = "dotnet tool install --global Microsoft.Playwright.CLI";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not expecting this as we have another PR for this. Can you remove this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that this branche is based on other one.


namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks
{
public class InstallPlaywrightBrowsersTask : GithubTask
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation

{
[YamlIgnore]
public string ProjectName { get; set; }
public override string Run => $"pwsh ./{ProjectName}/bin/Debug/net9.0/playwright.ps1 install";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation to show the default command so consumers can know when to override it with additional arguments

Copy link
Collaborator

@cjdutoit cjdutoit Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just using ProjectName as a property is not enforcing its use. I would suggest taking that value in via a constructor so consumer does not have to figure out what is needed.

/// <summary>
/// Represents a task that installs Playwright browsers for a given project.
/// </summary>
public class InstallPlaywrightBrowsersTask : GithubTask
{
    /// <summary>
    /// Initializes a new instance of the <see cref="InstallPlaywrightBrowsersTask"/> class.
    /// </summary>
    /// <param name="projectName">The name of the project for which Playwright browsers should be installed.</param>
    public InstallPlaywrightBrowsersTask(string projectName)
    {
        this.projectName = projectName;
    }

    /// <summary>
    /// Gets or sets the name of the task.
    /// The default value is: "Install Microsoft.Playwright.CLI".
    /// </summary>
    public override string Name { get; set; } = "Install Microsoft.Playwright.CLI.";

    /// <summary>
    /// Gets the command to execute for the task.
    /// The command installs Playwright browsers by running the Playwright CLI script.
    /// The default value is: "pwsh ./{projectName}/bin/Debug/net9.0/playwright.ps1 install".
    /// </summary>
    public override string Run => $"pwsh ./{projectName}/bin/Debug/net9.0/playwright.ps1 install";

    private readonly string projectName;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added .NET version as parameter:

 public InstallPlaywrightBrowsersTask(
     string projectName,
     string dotnetVersion = "net9.0")
 {
     this.projectName = projectName;
     this.dotnetVersion = dotnetVersion;
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DATA For creating data models and migrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DATA: InstallPlaywrightBrowsersTask

2 participants