Skip to content

Commit 99c1f38

Browse files
author
ehtasham
committed
test(e2e): automation tests for login, navbar and signup creation flows
1 parent aea5931 commit 99c1f38

21 files changed

+1574
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin/
2+
obj/

Config/Configurations.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace SpecFlowSecond.Config
8+
{
9+
public partial class Configurations
10+
{
11+
protected static readonly string AppURL = "YOUR_WEB_URL";
12+
13+
protected static string Uniqueness = DateTime.Now.ToString("ddMMyyHHmmss");
14+
15+
}
16+
}
17+

Drivers/Driver.cs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using Microsoft.Extensions.Configuration;
2+
using Microsoft.Playwright;
3+
4+
namespace SpecFlowSecond.Drivers
5+
{
6+
public class Driver : IDisposable
7+
{
8+
private readonly Task<IPage> _page;
9+
private IBrowser? _browser;
10+
11+
12+
//bool runInPipelineMode = configuration.GetValue<bool>("RunInPipelineMode");
13+
public Driver()
14+
{
15+
_page = InitializePlaywright();
16+
}
17+
public IPage Page => _page.Result;
18+
19+
private async Task<IPage> InitializePlaywright()
20+
{
21+
string originalPath = Directory.GetCurrentDirectory();
22+
var configuration = new ConfigurationBuilder()
23+
.SetBasePath(originalPath)
24+
.AddJsonFile("appsettings.json")
25+
.AddUserSecrets<Program>()
26+
.Build();
27+
28+
var playwright = await Playwright.CreateAsync();
29+
30+
var browserType = configuration["browser"];
31+
var isHeadless = bool.Parse(configuration["isHeadless"]);
32+
33+
BrowserTypeLaunchOptions launchOptions = new BrowserTypeLaunchOptions
34+
{
35+
Headless = isHeadless
36+
// Other options can be added as needed
37+
};
38+
39+
switch (browserType.ToLower())
40+
{
41+
case "firefox":
42+
_browser = await playwright.Firefox.LaunchAsync(launchOptions);
43+
break;
44+
case "chrome":
45+
_browser = await playwright.Chromium.LaunchAsync(launchOptions);
46+
break;
47+
case "edge":
48+
_browser = await playwright.Webkit.LaunchAsync(launchOptions);
49+
break;
50+
default:
51+
// Handle other browser types or provide a default option
52+
throw new ArgumentException("Unsupported browser type specified in appsettings.json");
53+
}
54+
55+
var page = await _browser.NewPageAsync();
56+
return page;
57+
}
58+
59+
public void Dispose() => _browser?.CloseAsync();
60+
}
61+
}

Features/Login.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Feature: Login
2+
This feature is of login. The tests contains the login to platform
3+
4+
@Regression
5+
Scenario: Logging in to platform with a valid username and password
6+
Given We navigate to the login page
7+
And We we click on accept consent button
8+
And We enter username and password and click on Login button
9+
Then User is logged into dashboard

Features/Login.feature.cs

Lines changed: 137 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Features/NavbarValidation.feature

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Feature: NavbarValidation
2+
3+
This feature contains tests related to the navigation bar menu
4+
Scenario: Admin user login to the platform and verifies all the navbar items that he is authorized to see
5+
Given "[ADMIN_EMAIL_ADDRESS]@gmail.com" logs in to the platform
6+
When When the navbar appears
7+
And "Dashboard" is appearing in the navbar
8+
And "Deal analytics" is appearing in the navbar
9+
And "Companies" is appearing in the navbar
10+
And "Offers" is appearing in the navbar
11+
And "Investor profiles" is appearing in the navbar
12+
And "Meetings" is appearing in the navbar
13+
14+
Scenario: Issuer user login to the platform and verifies all the navbar items that he is authorized to see
15+
Given "[ISSUER_EMAIL_ADDRESS]@gmail.com" logs in to the platform
16+
When When the navbar appears
17+
And "Dashboard" is appearing in the navbar
18+
And "My company" is appearing in the navbar
19+
And "Merger and acquisitions" is appearing in the navbar
20+
And "Matchmaking" is appearing in the navbar
21+
And "Data rooms" is appearing in the navbar
22+
And "Document access" is appearing in the navbar
23+
And "Meetings" is appearing in the navbar
24+
And "Auction management" is appearing in the navbar
25+
And "Offers" is appearing in the sub menu of "Auction management" in the navbar
26+
And "Flags" is appearing in the sub menu of "Auction management" in the navbar
27+
And "Tranches" is appearing in the sub menu of "Auction management" in the navbar
28+
And "Interest" is appearing in the navbar
29+
And "Secondary" is appearing in the sub menu of "Auction management" in the navbar
30+
And "Private" is appearing in the sub menu of "Auction management" in the navbar
31+
And "Forms" is appearing in the navbar
32+
And "Questionnaires" is appearing in the sub menu of "Forms" in the navbar
33+
And "Forms" is appearing in the sub menu of "Forms" in the navbar
34+
And "User management" is appearing in the navbar
35+
And "Referrals" is appearing in the sub menu of "User management" in the navbar
36+
And "Refer an investor" is appearing in the sub menu of "User management" in the navbar
37+
38+
39+
Scenario: Private investor user login to the platform and verifies all the navbar items that he is authorized to see
40+
Given "[INVESTOR_EMAIL_ADDRESS]@gmail.com" logs in to the platform
41+
When When the navbar appears
42+
And "Home" is appearing in the navbar
43+
And "Companies" is appearing in the navbar
44+
And "Companies" is appearing in the sub menu of "Companies" in the navbar
45+
And "Offers" is appearing in the sub menu of "Companies" in the navbar
46+
And "Meetings" is appearing in the sub menu of "Companies" in the navbar
47+
And "Investors" is appearing in the navbar
48+
And "My invitations" is appearing in the sub menu of "Investors" in the navbar
49+
And "Referrals" is appearing in the sub menu of "Investors" in the navbar
50+
And "Refer an investor" is appearing in the sub menu of "Investors" in the navbar
51+

0 commit comments

Comments
 (0)