From 156339786c3598a33fa932cf3e57645fe3c08d5a Mon Sep 17 00:00:00 2001 From: Jonathan McCaffrey Date: Wed, 27 Apr 2022 21:14:27 -0400 Subject: [PATCH] feat(Workflow) Now have a testing part of deploy workflow --- .github/workflows/development.yml | 33 ++++++++++++++++---------- .github/workflows/production.yml | 2 +- .github/workflows/test-development.yml | 25 +++++++++++++++++++ TestAutomation/TestAutomation.csproj | 2 +- TestAutomation/UnitTest1.cs | 13 ++++++---- 5 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/test-development.yml diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index d86ecf4..3bdd16e 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -1,4 +1,4 @@ -name: Azure Static Web Apps CI/CD +name: Deploy To Development on: push: @@ -11,11 +11,11 @@ on: jobs: build_and_deploy_job: - if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') + if: github.event_name == 'push' runs-on: ubuntu-latest name: Build and Deploy Job steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Build And Deploy @@ -28,15 +28,22 @@ jobs: app_location: "IGP" api_location: "" output_location: "./wwwroot" - - close_pull_request_job: - if: github.event_name == 'pull_request' && github.event.action == 'closed' + + test_deployed_website: + name: Test Deployed Website + needs: build_and_deploy_job + if: github.event_name == 'push' runs-on: ubuntu-latest - name: Close Pull Request Job + defaults: + run: + working-directory: ./TestAutomation steps: - - name: Close Pull Request - id: closepullrequest - uses: Azure/static-web-apps-deploy@v1 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_MUD_04916B210 }} - action: "close" + - uses: browser-actions/setup-geckodriver@latest + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 6.0.* + - run: dotnet restore + - run: dotnet build --no-restore + - run: dotnet test --no-build --verbosity normal \ No newline at end of file diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index b585c53..fa90e0d 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -1,4 +1,4 @@ -name: Azure Static Web Apps CI/CD +name: Deploy To Production on: push: diff --git a/.github/workflows/test-development.yml b/.github/workflows/test-development.yml new file mode 100644 index 0000000..56f6434 --- /dev/null +++ b/.github/workflows/test-development.yml @@ -0,0 +1,25 @@ +name: Run Development Tests + +on: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + tags: + description: 'Test scenario tags' + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 5.0.x + - name: Change Directory + run: cd TestAutomation | dotnet restore |dotnet build --no-restore | dotnet test --no-build --verbosity normal \ No newline at end of file diff --git a/TestAutomation/TestAutomation.csproj b/TestAutomation/TestAutomation.csproj index 25199cf..65a5e17 100644 --- a/TestAutomation/TestAutomation.csproj +++ b/TestAutomation/TestAutomation.csproj @@ -1,7 +1,7 @@ - net7.0 + net6.0 enable enable diff --git a/TestAutomation/UnitTest1.cs b/TestAutomation/UnitTest1.cs index 26a842b..b651b1b 100644 --- a/TestAutomation/UnitTest1.cs +++ b/TestAutomation/UnitTest1.cs @@ -11,16 +11,19 @@ public class Tests private Website Website { get; } public Tests() { - //var options = new FirefoxOptions(); - var options = new ChromeOptions(); + var options = new FirefoxOptions(); + //var options = new ChromeOptions(); options.AcceptInsecureCertificates = true; options.AddArgument("--headless"); + options.AddArgument("--ignore-certificate-errors"); options.AddArgument("--start-maximized"); - + options.AddArgument("--test-type"); + options.AddArgument("--allow-running-insecure-content"); + //_webDriver = new FirefoxDriver(options); - _webDriver = new ChromeDriver(Environment.CurrentDirectory, options); - //_webDriver = new FirefoxDriver(Environment.CurrentDirectory, options); + //_webDriver = new ChromeDriver(Environment.CurrentDirectory, options); + _webDriver = new FirefoxDriver(Environment.CurrentDirectory, options); Website = new Website(_webDriver);