Skip to content

Commit

Permalink
update ChromeDriver and rename class
Browse files Browse the repository at this point in the history
  • Loading branch information
fangdatto committed Jun 9, 2024
1 parent 0353e3c commit 7e1a6e2
Showing 7 changed files with 59 additions and 55 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -35,13 +35,13 @@ jobs:
uses: browser-actions/setup-chrome@v1
with:
# Optional: do not specify to match Chrome's version
chrome-version: '123'
chrome-version: '125'

- name: Setup Chrome-driver
uses: nanasess/setup-chromedriver@v2
with:
# Optional: do not specify to match Chrome's version
chromedriver-version: '123.0.6312.122'
chromedriver-version: '125.0.6422.14100'

- name: Restore dependencies
run: dotnet restore $SOLUTION
2 changes: 1 addition & 1 deletion Solution1/ClassLibrary1/Calculator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ClassLibrary1
namespace TestLibrary
{
public class Calculator
{
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@
<ItemGroup>
<PackageReference Include="Selenium.Support" Version="4.19.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.19.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="123.0.6312.12200" />
</ItemGroup>

</Project>
74 changes: 37 additions & 37 deletions Solution1/UnitTest.sln
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{26D6D1D3-EC61-491B-A460-264E3AB6C143}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTestProject", "UnitTestProject\UnitTestProject.csproj", "{E1317B48-A1F1-4C66-A546-465BB0FB92AE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestRWCore", "TestRWCore\TestRWCore.csproj", "{9989925A-0944-43F3-BD45-EFA7A401C671}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{26D6D1D3-EC61-491B-A460-264E3AB6C143}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26D6D1D3-EC61-491B-A460-264E3AB6C143}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26D6D1D3-EC61-491B-A460-264E3AB6C143}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26D6D1D3-EC61-491B-A460-264E3AB6C143}.Release|Any CPU.Build.0 = Release|Any CPU
{E1317B48-A1F1-4C66-A546-465BB0FB92AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1317B48-A1F1-4C66-A546-465BB0FB92AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1317B48-A1F1-4C66-A546-465BB0FB92AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1317B48-A1F1-4C66-A546-465BB0FB92AE}.Release|Any CPU.Build.0 = Release|Any CPU
{9989925A-0944-43F3-BD45-EFA7A401C671}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9989925A-0944-43F3-BD45-EFA7A401C671}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9989925A-0944-43F3-BD45-EFA7A401C671}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9989925A-0944-43F3-BD45-EFA7A401C671}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C0F12B39-1122-4D6D-B50B-AE623BABC56F}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestLibrary", "ClassLibrary1\TestLibrary.csproj", "{26D6D1D3-EC61-491B-A460-264E3AB6C143}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nUnitTestProject", "UnitTestProject\nUnitTestProject.csproj", "{E1317B48-A1F1-4C66-A546-465BB0FB92AE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestRWCore", "TestRWCore\TestRWCore.csproj", "{9989925A-0944-43F3-BD45-EFA7A401C671}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{26D6D1D3-EC61-491B-A460-264E3AB6C143}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26D6D1D3-EC61-491B-A460-264E3AB6C143}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26D6D1D3-EC61-491B-A460-264E3AB6C143}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26D6D1D3-EC61-491B-A460-264E3AB6C143}.Release|Any CPU.Build.0 = Release|Any CPU
{E1317B48-A1F1-4C66-A546-465BB0FB92AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1317B48-A1F1-4C66-A546-465BB0FB92AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1317B48-A1F1-4C66-A546-465BB0FB92AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1317B48-A1F1-4C66-A546-465BB0FB92AE}.Release|Any CPU.Build.0 = Release|Any CPU
{9989925A-0944-43F3-BD45-EFA7A401C671}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9989925A-0944-43F3-BD45-EFA7A401C671}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9989925A-0944-43F3-BD45-EFA7A401C671}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9989925A-0944-43F3-BD45-EFA7A401C671}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C0F12B39-1122-4D6D-B50B-AE623BABC56F}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -1,43 +1,48 @@
using System;
using ClassLibrary1;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace UnitTestProject
{
public class ChromeTest
public class TestChrome
{
Calculator calculator;

[SetUp]
public void Setup()
{
calculator = new Calculator();
//
}
[TearDown]
public void TearDown()
{
//
}

[Test]
public void startBrowser()
public void goItalle()
{
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("headless");
var driver = new ChromeDriver(chromeOptions);
Console.WriteLine("start2");
Console.WriteLine("open rw.italle.dk");
driver.Navigate().GoToUrl("https://rw.italle.dk");
Console.WriteLine(driver.Title);
driver.FindElement(By.Name("username")).SendKeys("fang");
Assert.AreEqual(driver.Title, "HB System Login");
driver.Quit();
}

[Test]
public void goWish()
public void goSoonr()
{
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("headless");
var driver = new ChromeDriver(chromeOptions);
Console.WriteLine("start2");
driver.Navigate().GoToUrl("https://onskeskyen.dk/da");
Console.WriteLine("open workplace");
driver.Navigate().GoToUrl("https://us.workplace.datto.com/login");
Console.WriteLine(driver.Title);
//driver.FindElement(By.Name("username")).SendKeys("fang");
driver.FindElement(By.Name("userName")).SendKeys("fang");
Assert.AreEqual(driver.Title, "Workplace | Sign In");
driver.Quit();
}

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using ClassLibrary1;
using TestLibrary;
using NUnit.Framework;

namespace UnitTestProject
{
public class Tests
public class TestsCalculator
{
Calculator calculator;

Check warning on line 8 in Solution1/UnitTestProject/TestsCalculator.cs

GitHub Actions / build_and_test

Non-nullable field 'calculator' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 8 in Solution1/UnitTestProject/TestsCalculator.cs

GitHub Actions / build_and_test

Non-nullable field 'calculator' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@
<PackageReference Include="coverlet.collector" Version="3.1.0" />
<PackageReference Include="Selenium.Support" Version="4.19.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.19.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="123.0.6312.12200" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="125.0.6422.14100" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj" />
<ProjectReference Include="..\ClassLibrary1\TestLibrary.csproj" />
</ItemGroup>

</Project>

0 comments on commit 7e1a6e2

Please sign in to comment.