Skip to content

Commit a444f28

Browse files
committed
Intialized SmartUI Selenium Support in Csharp
0 parents  commit a444f28

File tree

10 files changed

+675
-0
lines changed

10 files changed

+675
-0
lines changed

.gitignore

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
# Ignore build outputs
2+
bin/
3+
obj/
4+
5+
# Ignore user-specific files
6+
*.user
7+
*.suo
8+
*.userosscache
9+
*.sln.docstates
10+
11+
# Ignore Rider / Resharper / IDEA files
12+
.idea/
13+
*.sln.iml
14+
*.sln.ide/
15+
*.sln.ReSharper/
16+
*.sln.idea/
17+
18+
# Ignore VS Code settings
19+
.vscode/
20+
21+
# Ignore local history for Rider
22+
.idea/.idea.LocalHistory/
23+
24+
# Ignore dotnet specific files
25+
project.lock.json
26+
project.fragment.lock.json
27+
artifacts/
28+
29+
# Ignore NuGet packages
30+
*.nupkg
31+
packages/
32+
33+
# Ignore build results
34+
[Dd]ebug/
35+
[Rr]elease/
36+
x64/
37+
x86/
38+
[Aa][Rr][Mm]/
39+
[Aa][Rr][Mm]64/
40+
bld/
41+
[Bb]in/
42+
[Oo]bj/
43+
44+
# Ignore files generated by popular Visual Studio add-ons.
45+
# User-specific files
46+
*.rsuser
47+
*.rsrestart
48+
49+
# User-specific files (Mono Auto Generated)
50+
mono_crash.*
51+
52+
# ASP.NET Scaffolding
53+
ScaffoldingReadMe.txt
54+
55+
# StyleCop
56+
StyleCopReport.xml
57+
58+
# Files built by Visual Studio
59+
*.Build.*
60+
*.config
61+
*.pdb
62+
*.cache
63+
*.log
64+
*.ide
65+
*.ipch
66+
*.ilk
67+
*.obj
68+
*.sdf
69+
*.tlog
70+
*.vcxproj.*
71+
*_i.c
72+
*_p.c
73+
*.o
74+
*.p
75+
76+
# Windows image file caches
77+
Thumbs.db
78+
ehthumbs.db
79+
80+
# Folder config file
81+
Desktop.ini
82+
83+
# Recycle Bin used on file shares
84+
$RECYCLE.BIN/
85+
86+
# VS Code directories
87+
.vscode/
88+
.vscode/settings.json
89+
.vscode/tasks.json
90+
.vscode/launch.json
91+
.vscode/extensions.json
92+
.vscode/*.code-workspace
93+
94+
# Rider project files
95+
.idea/
96+
*.sln.iml
97+
98+
# Windows Installer files
99+
*.cab
100+
*.msi
101+
*.msm
102+
*.msp
103+
104+
# Windows shortcuts
105+
*.lnk
106+
107+
# WCF temporary files
108+
*.IClientProxy.cs
109+
*.IPartial.cs
110+
*.iproxy.dll
111+
*.iproxy.xml
112+
113+
# JetBrains Rider
114+
.idea/
115+
116+
# Rider local history
117+
.idea/.idea.LocalHistory/
118+
119+
# User-specific files for Rider
120+
.idea/.idea.LocalHistory/
121+
.idea/.idea.LocalHistory.temp/
122+
.idea/.idea.LocalHistory.version/
123+
.idea/.idea.LocalHistory.vfs/
124+
.idea/.idea.LocalHistory.vfs2/
125+
.idea/.idea.LocalHistory.vfs3/
126+
127+
# Rider settings folder
128+
.idea/
129+
130+
# Rider .NET Core solution
131+
*.Rider/
132+
*.RiderSolution/
133+
134+
# Rider ReSharper settings
135+
*.DotSettings
136+
*.DotSettings.user
137+
138+
# Rider editor config
139+
*.editorconfig
140+
141+
# Rider code style
142+
*.editorconfig
143+
144+
# Rider local settings
145+
.idea/.idea.LocalHistory/
146+
.idea/.idea.LocalHistory.temp/
147+
.idea/.idea.LocalHistory.version/
148+
.idea/.idea.LocalHistory.vfs/
149+
.idea/.idea.LocalHistory.vfs2/
150+
.idea/.idea.LocalHistory.vfs3/
151+
.idea/.idea.LocalHistory.vfs4/
152+
.idea/.idea.LocalHistory.vfs5/
153+
.idea/.idea.LocalHistory.vfs6/
154+
.idea/.idea.LocalHistory.vfs7/
155+
.idea/.idea.LocalHistory.vfs8/
156+
.idea/.idea.LocalHistory.vfs9/
157+
.idea/.idea.LocalHistory.vfs10/
158+
159+
# Rider project settings
160+
.idea/.idea.project-settings/
161+
162+
# Rider shared solution settings
163+
.idea/.idea.sln/
164+
.idea/.idea.sln.iml
165+
.idea/.idea.sln.xml
166+
.idea/.idea.sln.md
167+
168+
# Rider shared solution settings
169+
.idea/.idea.sln.vfs/
170+
171+
# Rider shared solution settings
172+
.idea/.idea.sln.vfs/
173+
.idea/.idea.sln.vfs2/
174+
.idea/.idea.sln.vfs3/
175+
.idea/.idea.sln.vfs4/
176+
.idea/.idea.sln.vfs5/
177+
.idea/.idea.sln.vfs6/
178+
.idea/.idea.sln.vfs7/
179+
.idea/.idea.sln.vfs8/
180+
.idea/.idea.sln.vfs9/
181+
.idea/.idea.sln.vfs10/
182+
.idea/.idea.sln.vfs11/
183+
.idea/.idea.sln.vfs12/
184+
.idea/.idea.sln.vfs13/
185+
.idea/.idea.sln.vfs14/
186+
.idea/.idea.sln.vfs15/
187+
.idea/.idea.sln.vfs16/
188+
.idea/.idea.sln.vfs17/
189+
.idea/.idea.sln.vfs18/
190+
.idea/.idea.sln.vfs19/
191+
.idea/.idea.sln.vfs20/
192+
193+
# Rider ReSharper settings
194+
.idea/.idea.sln.vfs/
195+
.idea/.idea.sln.vfs2/
196+
.idea/.idea.sln.vfs3/
197+
.idea/.idea.sln.vfs4/
198+
.idea/.idea.sln.vfs5/
199+
.idea/.idea.sln.vfs6/
200+
.idea/.idea.sln.vfs7/
201+
.idea/.idea.sln.vfs8/
202+
.idea/.idea.sln.vfs9/
203+
.idea/.idea.sln.vfs10/
204+
.idea/.idea.sln.vfs11/
205+
.idea/.idea.sln.vfs12/
206+
.idea/.idea.sln.vfs13/
207+
.idea/.idea.sln.vfs14/
208+
.idea/.idea.sln.vfs15/
209+
.idea/.idea.sln.vfs16/
210+
.idea/.idea.sln.vfs17/
211+
.idea/.idea.sln.vfs18/
212+
.idea/.idea.sln.vfs19/
213+
.idea/.idea.sln.vfs20/
214+
215+
# Rider ReSharper settings
216+
.idea/.idea.sln.vfs/
217+
.idea/.idea.sln.vfs2/
218+
.idea/.idea.sln.vfs3/
219+
.idea/.idea.sln.vfs4/
220+
.idea/.idea.sln.vfs5/
221+
.idea/.idea.sln.vfs6/
222+
.idea/.idea.sln.vfs7/
223+
.idea/.idea.sln.vfs8/
224+
.idea/.idea.sln.vfs9/
225+
.idea/.idea.sln.vfs10/
226+
.idea/.idea.sln.vfs11/
227+
.idea/.idea.sln.vfs12/
228+
.idea/.idea.sln.vfs13/
229+
.idea/.idea.sln.vfs14/
230+
.idea/.idea.sln.vfs15/
231+
.idea/.idea.sln.vfs16/
232+
.idea/.idea.sln.vfs17/
233+
.idea/.idea.sln.vfs18/
234+
.idea/.idea.sln.vfs19/
235+
.idea/.idea.sln.vfs20/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 LambdaTest
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

LambdaTest.Sdk.Utils/Constants.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
3+
namespace LambdaTest.Sdk.Utils
4+
{
5+
public static class Constants
6+
{
7+
public static string GetSmartUIServerAddress()
8+
{
9+
var address = Environment.GetEnvironmentVariable("SMARTUI_SERVER_ADDRESS");
10+
if (string.IsNullOrEmpty(address))
11+
{
12+
throw new Exception("SmartUI server address not found");
13+
}
14+
return address;
15+
}
16+
}
17+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net8.0</TargetFramework>
4+
<PackageId>LambdaTest.Sdk.Utils</PackageId>
5+
<Version>1.0.0</Version>
6+
<Authors>Lambdatest-SmartUI</Authors>
7+
<Company>LambdaTest</Company>
8+
<Description>LambdaTest SDK Utilities for SmartUI CLI in C#</Description>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
12+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
13+
</ItemGroup>
14+
</Project>
15+

LambdaTest.Sdk.Utils/Logger.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using Microsoft.Extensions.Logging;
3+
4+
namespace LambdaTest.Sdk.Utils
5+
{
6+
public static class Logger
7+
{
8+
private static ILoggerFactory loggerFactory;
9+
private static bool isInitialized = false;
10+
11+
public static void Initialize()
12+
{
13+
if (!isInitialized)
14+
{
15+
loggerFactory = LoggerFactory.Create(builder =>
16+
{
17+
builder.AddConsole();
18+
builder.SetMinimumLevel(GetLogLevel());
19+
});
20+
isInitialized = true;
21+
}
22+
}
23+
24+
private static LogLevel GetLogLevel()
25+
{
26+
var debug = Environment.GetEnvironmentVariable("LT_SDK_DEBUG");
27+
if (debug != null && debug.Equals("true", StringComparison.OrdinalIgnoreCase))
28+
{
29+
return LogLevel.Debug;
30+
}
31+
32+
var logLevelStr = Environment.GetEnvironmentVariable("LT_SDK_LOG_LEVEL")?.ToLower() ?? "info";
33+
return logLevelStr switch
34+
{
35+
"debug" => LogLevel.Debug,
36+
"warning" => LogLevel.Warning,
37+
"error" => LogLevel.Error,
38+
"critical" => LogLevel.Critical,
39+
_ => LogLevel.Information,
40+
};
41+
}
42+
43+
public static ILogger CreateLogger(string packageName)
44+
{
45+
Initialize();
46+
return loggerFactory.CreateLogger(packageName);
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)