Skip to content

Commit c0ca45b

Browse files
committed
test: promotions integ tests works only when user is not logged in
1 parent 82109da commit c0ca45b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/spec/promotions-integ-test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ define(function (require, exports, module) {
9393
await SpecRunnerUtils.closeTestWindow();
9494
}, 30000);
9595

96+
it("should require user to be logged out for promotion tests to work", async function () {
97+
// Check if user is logged in - these tests only work for non-logged-in users
98+
const isLoggedIn = LoginService.LoginService.isLoggedIn();
99+
if (isLoggedIn) {
100+
throw new Error("Promotion tests require user to be logged out. Please log out before running these tests. Logged-in users with pro subscriptions will not trigger trial activation logic.");
101+
}
102+
// If we reach here, user is not logged in - tests should work
103+
expect(isLoggedIn).toBe(false);
104+
});
105+
96106
describe("Trial Activation", function () {
97107

98108
it("should have access to trial functions", function () {
@@ -655,6 +665,11 @@ define(function (require, exports, module) {
655665
// This should NOT grant a new 30-day trial
656666
await LoginService.activateProTrial();
657667

668+
// Should show trial ended dialog again (since trial is still expired)
669+
await testWindow.__PR.waitForModalDialog(".modal");
670+
testWindow.__PR.clickDialogButtonID("secondaryButton");
671+
await testWindow.__PR.waitForModalDialogClosed(".modal");
672+
658673
// Should still have the expired marker, not a new 30-day trial
659674
const afterRestartResult = await LoginService._getTrialData();
660675
expect(afterRestartResult.data).toBeDefined();

0 commit comments

Comments
 (0)