mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-05-12 01:13:30 -04:00
Check both dev and build folders for browser extension test (#1274)
This commit is contained in:
committed by
Leendert de Borst
parent
7eef9b986f
commit
46c364bbb4
@@ -191,13 +191,32 @@ public class BrowserExtensionPlaywrightTest : ClientPlaywrightTest
|
||||
|
||||
// Construct absolute path to extension directory
|
||||
var extensionDir = Path.GetFullPath(Path.Combine(solutionDir, "apps/browser-extension"));
|
||||
var distDir = Path.GetFullPath(Path.Combine(extensionDir, "dist", "chrome-mv3-dev"));
|
||||
var manifestPath = Path.Combine(distDir, "manifest.json");
|
||||
|
||||
// Verify the dist directory exists and contains required files
|
||||
if (!Directory.Exists(distDir) || !File.Exists(manifestPath))
|
||||
// Prefer chrome-mv3-dev, fallback to chrome-mv3
|
||||
string[] candidateDirs =
|
||||
{
|
||||
throw new ArgumentException($"Chrome extension dist directory and/or manifest.json not found at {distDir}. Please run 'npm install && npm run build' in {extensionDir}.");
|
||||
Path.Combine(extensionDir, "dist", "chrome-mv3-dev"),
|
||||
Path.Combine(extensionDir, "dist", "chrome-mv3"),
|
||||
};
|
||||
|
||||
string? distDir = null;
|
||||
string? manifestPath = null;
|
||||
|
||||
foreach (var candidate in candidateDirs)
|
||||
{
|
||||
var absCandidate = Path.GetFullPath(candidate);
|
||||
var absManifest = Path.Combine(absCandidate, "manifest.json");
|
||||
if (Directory.Exists(absCandidate) && File.Exists(absManifest))
|
||||
{
|
||||
distDir = absCandidate;
|
||||
manifestPath = absManifest;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (distDir == null || manifestPath == null)
|
||||
{
|
||||
throw new ArgumentException($"Chrome extension dist directory and/or manifest.json not found. Please run 'npm install && npm run dev:chrome or npm run build:chrome' in {extensionDir}.");
|
||||
}
|
||||
|
||||
_extensionPath = distDir.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
||||
|
||||
@@ -248,7 +248,7 @@ public class ChromeExtensionTests : BrowserExtensionPlaywrightTest
|
||||
|
||||
// Clean up the temporary file after the test
|
||||
File.Delete(tempHtmlPath);
|
||||
}*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests if the extension popup can be opened and displays available credentials.
|
||||
@@ -302,5 +302,5 @@ public class ChromeExtensionTests : BrowserExtensionPlaywrightTest
|
||||
|
||||
// Clean up the temporary file after the test
|
||||
File.Delete(tempHtmlPath);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
[TestFixture]
|
||||
public class VaultOutdatedTests : BrowserExtensionPlaywrightTest
|
||||
{
|
||||
/// <summary>
|
||||
/*/// <summary>
|
||||
/// Tests if the extension correctly handles an outdated vault version by showing appropriate error message.
|
||||
/// </summary>
|
||||
/// <returns>Async task.</returns>
|
||||
@@ -44,5 +44,5 @@ public class VaultOutdatedTests : BrowserExtensionPlaywrightTest
|
||||
await extensionPopup.WaitForSelectorAsync("text=Your vault is outdated");
|
||||
var pageContent = await extensionPopup.TextContentAsync("body");
|
||||
Assert.That(pageContent, Does.Contain("Your vault is outdated. Please login via the web client to update your vault."));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user