Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/PlaywrightProjectTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,36 @@ on:
options:
- ubuntu-latest
- windows-latest
default: ubunntu-latest
default: ubuntu-latest
pull_request:

jobs:
PlaywrightProjectTests:
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core SDK '8.0.x'

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Run Blazor app

# Windows Runner
- name: Run Blazor app (Windows)
if: runner.os == 'Windows'
run: |
Start-Job -ScriptBlock { Start-Process -NoNewWindow -FilePath dotnet -ArgumentList "run" -WorkingDirectory ./src/BlazorApp }
Start-Sleep -Seconds 20

# Ubuntu Runner
- name: Run Blazor app (Ubuntu)
if: runner.os == 'Linux'
run: |
cd ./src/BlazorApp
dotnet run &

- name: Test Blazor app
run: |
cd ./Behavioral.Automation.Playwright/UITests
dotnet test

19 changes: 16 additions & 3 deletions .github/workflows/SeleniumProjectTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
default: windows-latest
pull_request:
branches: [ main ]

env:
BROWSER_PARAMS: "--window-size=1920,1080 --allowed-ips --no-sandbox"

jobs:
build:
Expand All @@ -28,6 +25,21 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

# Windows Runner
- name: Run Blazor app (Windows)
if: runner.os == 'Windows'
run: |
Start-Job -ScriptBlock { Start-Process -NoNewWindow -FilePath dotnet -ArgumentList "run" -WorkingDirectory ./src/BlazorApp }
Start-Sleep -Seconds 20

# Ubuntu Runner
- name: Run Blazor app (Ubuntu)
if: runner.os == 'Linux'
run: |
cd ./src/BlazorApp
dotnet run &

- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -36,3 +48,4 @@ jobs:
- name: Test
working-directory: ./Behavioral.Automation.Selenium/Behavioral.Automation.DemoScenarios
run: dotnet test -c Release --no-build --verbosity normal

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"BASE_URL": "http://localhost:4200/",
"BROWSER_PARAMS": "--window-size=1920,1080",
"BROWSER_PARAMS": "--window-size=1920,1080 --allowed-ips --no-sandbox --headless",
"ACCESS_CLIPBOARD": false,
"DOWNLOAD_PATH": "",
"SEARCH_ATTRIBUTE": "data-automation-id",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using Behavioral.Automation.Configs;
using Behavioral.Automation.FluentAssertions;
using Behavioral.Automation.FluentAssertions;
using Behavioral.Automation.Services;
using BoDi;
using TechTalk.SpecFlow;
Expand All @@ -17,7 +12,6 @@ public class Bootstrapper
private readonly ITestRunner _runner;
private readonly DemoTestServicesBuilder _servicesBuilder;
private readonly BrowserRunner _browserRunner;
private static Process _coreRunProcess;

public Bootstrapper(IObjectContainer objectContainer, ITestRunner runner, BrowserRunner browserRunner)
{
Expand All @@ -27,53 +21,6 @@ public Bootstrapper(IObjectContainer objectContainer, ITestRunner runner, Browse
_servicesBuilder = new DemoTestServicesBuilder(objectContainer, new TestServicesBuilder(_objectContainer));
}

private static bool IsConnectionEstablished()
{
try
{
WebRequest.CreateHttp(ConfigManager.GetConfig<Config>().BaseUrl).GetResponse();
return true;
}
catch (WebException)
{
return false;
}
}

private static void RunTestApp()
{
string testAppPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "..", "..", "src",
"BlazorApp");

_coreRunProcess = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = "/c dotnet run",
WorkingDirectory = testAppPath
}
};
_coreRunProcess.Start();
}

[BeforeTestRun]
public static void StartDemoApp()
{
if (!IsConnectionEstablished())
RunTestApp();
}

[AfterTestRun]
public static void StopDemoApp()
{
if (_coreRunProcess != null)
{
_coreRunProcess.Kill(true);
_coreRunProcess.Dispose();
}
}

[AfterScenario]
public void CloseBrowser()
{
Expand Down
Loading