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
This commit is contained in:
Karol Sójko
2023-07-14 10:52:17 +02:00
committed by GitHub
parent c694268206
commit 30b113cc84
8 changed files with 79 additions and 137 deletions

View File

@@ -32,25 +32,10 @@ describe('subscriptions', function () {
password: context.password,
})
await Events.publishMockedEvent('SUBSCRIPTION_PURCHASED', {
userEmail: context.email,
subscriptionId: subscriptionId++,
subscriptionName: 'PRO_PLAN',
subscriptionExpiresAt: (new Date().getTime() + 3_600_000) * 1_000,
timestamp: Date.now(),
offline: false,
discountCode: null,
limitedDiscountPurchased: false,
newSubscriber: true,
totalActiveSubscriptionsCount: 1,
userRegisteredAt: 1,
billingFrequency: 12,
payAmount: 59.00
})
await Factory.sleep(2)
await context.activatePaidSubscriptionForUser()
})
it('should invite a user by email to a shared subscription - @paidfeature', async () => {
it('should invite a user by email to a shared subscription', async () => {
await subscriptionManager.inviteToSubscription('test@test.te')
const existingInvites = await subscriptionManager.listSubscriptionInvitations()
@@ -60,7 +45,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 - @paidfeature', async () => {
it('should not invite a user by email if the limit of shared subscription is breached', async () => {
await subscriptionManager.inviteToSubscription('test1@test.te')
await subscriptionManager.inviteToSubscription('test2@test.te')
await subscriptionManager.inviteToSubscription('test3@test.te')
@@ -78,7 +63,7 @@ describe('subscriptions', function () {
expect(existingInvites.length).to.equal(5)
})
it('should cancel a user invitation to a shared subscription - @paidfeature', async () => {
it('should cancel a user invitation to a shared subscription', async () => {
await subscriptionManager.inviteToSubscription('test@test.te')
await subscriptionManager.inviteToSubscription('test2@test.te')
@@ -97,7 +82,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 - @paidfeature', async () => {
it('should invite a user by email if the limit of shared subscription is restored', async () => {
await subscriptionManager.inviteToSubscription('test1@test.te')
await subscriptionManager.inviteToSubscription('test2@test.te')
await subscriptionManager.inviteToSubscription('test3@test.te')