chore: add possibility to skip paid features in the e2e test suite

This commit is contained in:
Karol Sójko
2023-05-18 12:26:38 +02:00
parent a33365a4d9
commit f14b047d7e
4 changed files with 21 additions and 15 deletions

View File

@@ -62,7 +62,7 @@ describe('files', function () {
localStorage.clear()
})
it('should create valet token from server', async function () {
it('should create valet token from server - @paidfeature', async function () {
await setup({ fakeCrypto: true, subscription: true })
const remoteIdentifier = Utils.generateUuid()
@@ -80,7 +80,7 @@ describe('files', function () {
expect(tokenOrError.tag).to.equal('no-subscription')
})
it('should not create valet token from server when user has an expired subscription', async function () {
it('should not create valet token from server when user has an expired subscription - @paidfeature', async function () {
await setup({ fakeCrypto: true, subscription: false })
await Factory.publishMockedEvent('SUBSCRIPTION_PURCHASED', {
@@ -107,7 +107,7 @@ describe('files', function () {
expect(tokenOrError.tag).to.equal('expired-subscription')
})
it('creating two upload sessions successively should succeed', async function () {
it('creating two upload sessions successively should succeed - @paidfeature', async function () {
await setup({ fakeCrypto: true, subscription: true })
const firstToken = await application.apiService.createFileValetToken(Utils.generateUuid(), 'write')
@@ -121,7 +121,7 @@ describe('files', function () {
expect(secondSession.uploadId).to.be.ok
})
it('should encrypt and upload small file', async function () {
it('should encrypt and upload small file - @paidfeature', async function () {
await setup({ fakeCrypto: false, subscription: true })
const response = await fetch('/packages/snjs/mocha/assets/small_file.md')
@@ -134,7 +134,7 @@ describe('files', function () {
expect(downloadedBytes).to.eql(buffer)
})
it('should encrypt and upload big file', async function () {
it('should encrypt and upload big file - @paidfeature', async function () {
await setup({ fakeCrypto: false, subscription: true })
const response = await fetch('/packages/snjs/mocha/assets/two_mb_file.md')
@@ -147,7 +147,7 @@ describe('files', function () {
expect(downloadedBytes).to.eql(buffer)
})
it('should delete file', async function () {
it('should delete file - @paidfeature', async function () {
await setup({ fakeCrypto: false, subscription: true })
const response = await fetch('/packages/snjs/mocha/assets/small_file.md')

View File

@@ -116,7 +116,7 @@ describe('settings service', function () {
expect(settings.getSettingValue(SettingName.create(SettingName.NAMES.MfaSecret).getValue())).to.not.be.ok
})
it('reads a subscription setting', async () => {
it('reads a subscription setting - @paidfeature', async () => {
await Factory.publishMockedEvent('SUBSCRIPTION_PURCHASED', {
userEmail: context.email,
subscriptionId: subscriptionId++,
@@ -139,7 +139,7 @@ describe('settings service', function () {
expect(setting).to.be.a('string')
})
it('persist irreplaceable subscription settings between subsequent subscriptions', async () => {
it('persist irreplaceable subscription settings between subsequent subscriptions - @paidfeature', async () => {
await reInitializeApplicationWithRealCrypto()
await Factory.publishMockedEvent('SUBSCRIPTION_PURCHASED', {

View File

@@ -49,7 +49,7 @@ describe('subscriptions', function () {
await Factory.sleep(2)
})
it('should invite a user by email to a shared subscription', async () => {
it('should invite a user by email to a shared subscription - @paidfeature', async () => {
await subscriptionManager.inviteToSubscription('test@test.te')
const existingInvites = await subscriptionManager.listSubscriptionInvitations()
@@ -59,7 +59,7 @@ describe('subscriptions', function () {
expect(newlyCreatedInvite.status).to.equal('sent')
})
it('should not invite a user by email if the limit of shared subscription is breached', async () => {
it('should not invite a user by email if the limit of shared subscription is breached - @paidfeature', async () => {
await subscriptionManager.inviteToSubscription('test1@test.te')
await subscriptionManager.inviteToSubscription('test2@test.te')
await subscriptionManager.inviteToSubscription('test3@test.te')
@@ -77,7 +77,7 @@ describe('subscriptions', function () {
expect(existingInvites.length).to.equal(5)
})
it('should cancel a user invitation to a shared subscription', async () => {
it('should cancel a user invitation to a shared subscription - @paidfeature', async () => {
await subscriptionManager.inviteToSubscription('test@test.te')
await subscriptionManager.inviteToSubscription('test2@test.te')
@@ -96,7 +96,7 @@ describe('subscriptions', function () {
expect(existingInvites.filter(invite => invite.status === 'canceled').length).to.equal(1)
})
it('should invite a user by email if the limit of shared subscription is restored', async () => {
it('should invite a user by email if the limit of shared subscription is restored - @paidfeature', async () => {
await subscriptionManager.inviteToSubscription('test1@test.te')
await subscriptionManager.inviteToSubscription('test2@test.te')
await subscriptionManager.inviteToSubscription('test3@test.te')

View File

@@ -16,6 +16,7 @@
const urlParams = new URLSearchParams(window.location.search);
const syncServerHostName = urlParams.get('sync_server_host_name') ?? 'syncing-server-proxy';
const bail = urlParams.get('bail') === 'false' ? false : true;
const skipPaidFeatures = urlParams.get('skip_paid_features') === 'true' ? true : false;
Object.assign(window, SNCrypto);
@@ -29,9 +30,14 @@
console.error(error);
};
mocha.setup('bdd');
mocha.timeout(5000);
mocha.bail(bail);
mocha.setup({
ui: 'bdd',
timeout: 5000,
bail: bail,
});
if (skipPaidFeatures) {
mocha.grep('@paidfeature').invert();
}
</script>
<script type="module" src="memory.test.js"></script>
<script type="module" src="protocol.test.js"></script>