Skip to content

Ard2025/e2e migration #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
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
110 changes: 110 additions & 0 deletions E2eTest/CursorTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
using E2eTest.Extensions;
using E2eTestWebApp.TestPages;

namespace E2eTest;

[TestClass]
public class CursorTest : TestBase<CursorTestPage>
{
[TestMethod]
public async Task Force_Cursor_Equal_Test(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere36);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Basic_Cursor_Equal_Test(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere41);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Multiple_Cursor_Conditions_OR(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere48);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Take_And_With_Index_Test(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere54);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task TakeLast_And_With_Index_Test(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere55);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Cursor_Last_Or_Default_Where_Test(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere61);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Index_Last_Or_Default_Where_Test(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere65);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Cursor_Where_Plus_OrderBy_Plus_Skip_Plus_Take(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere69);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Cursor_Where_Plus_OrderBy_Plus_Skip_Plus_Take_Plus_first_or_default(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere70);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Cursor_Where_Plus_OrderBy_Plus_Skip_Plus_Take_Plus_last_or_default(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere71);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Index_Where_Plus_OrderBy_Plus_Skip_Plus_Take(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere72);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Index_Where_Plus_OrderBy_Desc_Plus_Skip_Plus_Take(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere73);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Where_Plus_OrderByDescending_Plus_TakeLast(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere74);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Cursor_Test_Equals(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere85);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Where_Plus_OrderBy_Plus_Skip_Plus_TakeLast(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere91);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Paginated_Index_Query_with_AND_Condition(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere92);
Assert.AreEqual("OK", result);
}

[TestMethod]
public async Task Paginated_Cursor_Query_with_AND_Condition(){
var result = await this.RunTestPageMethodAsync(p => p.TestWhere93);
Assert.AreEqual("OK", result);
}
}
5 changes: 2 additions & 3 deletions E2eTest/OpenTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using E2eTest.Entities;
using E2eTest.Extensions;
using E2eTestWebApp.Models;
using TestBase.Models;
using E2eTestWebApp.TestPages;
using Magic.IndexedDb;

Expand All @@ -12,7 +12,6 @@ public class OpenTest : TestBase<OpenTestPage>
[TestMethod]
public async Task DirectOpenTest()
{

var page = await this.NewPageAsync();
await page.DeleteDatabaseAsync("Person");

Expand All @@ -22,7 +21,7 @@ public async Task DirectOpenTest()
var databases = await page.EvaluateAsync<DatabaseInfo[]>("indexedDB.databases()");
// The actual version will be 10:
// https://dexie.org/docs/Dexie/Dexie.version()
Assert.IsTrue(databases!.Any(x => x.Name == "Person" && x.Version == 10));
Assert.IsTrue(databases!.Any(x => x.Name == "Employee" && x.Version == 10));
}


Expand Down
12 changes: 0 additions & 12 deletions E2eTest/SingleRecordBasicTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,27 @@ public class SingleRecordBasicTest : TestBase<SingleRecordBasicTestPage>
[TestMethod]
public async Task AddTest()
{
var page = await this.NewPageAsync();
await page.DeleteDatabaseAsync("Person");

var result = await this.RunTestPageMethodAsync(p => p.Add);
Assert.AreEqual(result, "OK");
}

[TestMethod]
public async Task DeleteTest()
{
var page = await this.NewPageAsync();
await page.DeleteDatabaseAsync("Person");

var result = await this.RunTestPageMethodAsync(p => p.Delete);
Assert.AreEqual(result, "OK");
}

[TestMethod]
public async Task UpdateTest()
{
var page = await this.NewPageAsync();
await page.DeleteDatabaseAsync("Person");

var result = await this.RunTestPageMethodAsync(p => p.Update);
Assert.AreEqual(result, "OK");
}

[TestMethod]
public async Task GetAllTest()
{
var page = await this.NewPageAsync();
await page.DeleteDatabaseAsync("Person");

var result = await this.RunTestPageMethodAsync(p => p.GetAll);
Assert.AreEqual(result, "OK");
}
Expand Down
5 changes: 5 additions & 0 deletions E2eTest/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.Playwright;
using System.Linq.Expressions;
using System.Reflection;
using E2eTest.Extensions;

namespace E2eTest;

Expand Down Expand Up @@ -49,6 +50,10 @@ protected async ValueTask<string> RunTestPageMethodAsync(

await page.GotoAsync(typeof(TPage).GetCustomAttribute<RouteAttribute>()?.Template ?? "");
await this.Expect(page.GetByTestId("output")).ToHaveValueAsync("Loaded.");

await page.DeleteDatabaseAsync("Animal");
await page.DeleteDatabaseAsync("Client");
await page.DeleteDatabaseAsync("Employee");

await page.GetByTestId("method").FillAsync(ResolveMethod(method));
await page.WaitForTimeoutAsync(500);
Expand Down
Loading