Files
standardnotes-app-web/packages/snjs/mocha/test.html
Karol Sójko 30b113cc84 chore: running paid subscription e2e tests on both self-hosted and home-server setup (#2355)
* chore: add activating paid subscription in e2e on both self-hosted and home-server setup

* chore: fix activating premium features on e2e test suites

* chore: remove unnecessary sleep duplication

* chore: add defining the subscription expires at date in e2e
2023-07-14 10:52:17 +02:00

81 lines
2.2 KiB
HTML

<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link href="assets/mocha.css" rel="stylesheet" />
<script src="https://unpkg.com/chai@4.3.6/chai.js"></script>
<script src="./vendor/chai-as-promised-built.js"></script>
<script src="https://unpkg.com/regenerator-runtime@0.13.9/runtime.js"></script>
<script src="https://unpkg.com/mocha@9.2.2/mocha.js"></script>
<script src="https://unpkg.com/chai-subset@1.6.0/lib/chai-subset.js"></script>
<script src="https://unpkg.com/sinon@13.0.2/pkg/sinon.js"></script>
<script src="./vendor/sncrypto-web.js"></script>
<script src="../dist/snjs.js"></script>
<script type="module">
Object.assign(window, SNCrypto);
Object.assign(window, SNLibrary);
SNLog.onLog = (message) => {
console.log(message);
};
SNLog.onError = (error) => {
console.error(error);
};
const urlParams = new URLSearchParams(window.location.search);
const bail = urlParams.get('bail') === 'false' ? false : true;
mocha.setup({
ui: 'bdd',
timeout: 5000,
bail: bail,
});
</script>
<script type="module">
import MainRegistry from './TestRegistry/MainRegistry.js'
const InternalFeatureStatus = {
[InternalFeature.Vaults]: { enabled: false, exclusive: false },
}
const loadTest = (fileName) => {
return new Promise((resolve) => {
const script = document.createElement('script');
script.type = 'module';
script.src = fileName;
script.async = false;
script.defer = false;
script.addEventListener('load', resolve);
document.head.append(script);
})
}
const loadTests = async (fileNames) => {
for (const fileName of fileNames) {
await loadTest(fileName);
}
}
if (InternalFeatureStatus[InternalFeature.Vaults].enabled) {
InternalFeatureService.get().enableFeature(InternalFeature.Vaults);
await loadTests(MainRegistry.VaultTests);
}
if (!InternalFeatureStatus[InternalFeature.Vaults].exclusive) {
await loadTests(MainRegistry.BaseTests);
}
mocha.run()
</script>
</head>
<body>
<div id="mocha"></div>
</body>
</html>