Skip to content

Commit bbccdf9

Browse files
committed
refactor: centralize pro context declaration
1 parent 6e5fdb7 commit bbccdf9

File tree

4 files changed

+12
-31
lines changed

4 files changed

+12
-31
lines changed

run/test/specs/message_length.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { CTAButtonNegative } from '../locators/global';
1515
import { PlusButton } from '../locators/home';
1616
import { EnterAccountID, NewMessageOption, NextButton } from '../locators/start_conversation';
17-
import { IOSTestContext } from '../utils/capabilities_ios';
17+
import { IOS_PRO_CONTEXT } from '../utils/capabilities_ios';
1818
import { newUser } from '../utils/create_account';
1919
import { makeAccountPro } from '../utils/mock_pro';
2020
import { closeApp, openAppOnPlatformSingleDevice, SupportedPlatformsType } from '../utils/open_app';
@@ -87,11 +87,8 @@ for (const testCase of messageLengthTestCases) {
8787
},
8888
allureDescription: `Verifies message length behavior at ${testCase.length} characters - ${testCase.description} (${proSuffix})`,
8989
testCb: async (platform: SupportedPlatformsType, testInfo: TestInfo) => {
90-
const iosContext: IOSTestContext = {
91-
sessionProEnabled: 'true',
92-
};
9390
const { device, alice } = await test.step(TestSteps.SETUP.NEW_USER, async () => {
94-
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, iosContext);
91+
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, IOS_PRO_CONTEXT);
9592
const alice = await newUser(device, USERNAME.ALICE);
9693
return { device, alice };
9794
});

run/test/specs/user_actions_animated_profile_picture.spec.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
UserSettings,
1414
} from '../locators/settings';
1515
import { open_Alice1_Bob1_friends } from '../state_builder';
16-
import { IOSTestContext } from '../utils/capabilities_ios';
16+
import { IOS_PRO_CONTEXT } from '../utils/capabilities_ios';
1717
import { newUser } from '../utils/create_account';
1818
import { makeAccountPro } from '../utils/mock_pro';
1919
import { closeApp, openAppOnPlatformSingleDevice, SupportedPlatformsType } from '../utils/open_app';
@@ -63,11 +63,8 @@ bothPlatformsIt({
6363
});
6464

6565
async function nonProAnimatedDP(platform: SupportedPlatformsType, testInfo: TestInfo) {
66-
const iosContext: IOSTestContext = {
67-
sessionProEnabled: 'true',
68-
};
6966
const { device } = await test.step(TestSteps.SETUP.NEW_USER, async () => {
70-
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, iosContext);
67+
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, IOS_PRO_CONTEXT);
7168
await newUser(device, USERNAME.ALICE, { saveUserData: false });
7269
return { device };
7370
});
@@ -81,11 +78,8 @@ async function nonProAnimatedDP(platform: SupportedPlatformsType, testInfo: Test
8178
});
8279
}
8380
async function proActivatedCTA(platform: SupportedPlatformsType, testInfo: TestInfo) {
84-
const iosContext: IOSTestContext = {
85-
sessionProEnabled: 'true',
86-
};
8781
const { device, alice } = await test.step(TestSteps.SETUP.NEW_USER, async () => {
88-
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, iosContext);
82+
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, IOS_PRO_CONTEXT);
8983
const alice = await newUser(device, USERNAME.ALICE);
9084
return { device, alice };
9185
});
@@ -104,11 +98,8 @@ async function proActivatedCTA(platform: SupportedPlatformsType, testInfo: TestI
10498
}
10599

106100
async function proAnimatedDP(platform: SupportedPlatformsType, testInfo: TestInfo) {
107-
const iosContext: IOSTestContext = {
108-
sessionProEnabled: 'true',
109-
};
110101
const { device, alice } = await test.step(TestSteps.SETUP.NEW_USER, async () => {
111-
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, iosContext);
102+
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, IOS_PRO_CONTEXT);
112103
const alice = await newUser(device, USERNAME.ALICE);
113104
return { device, alice };
114105
});
@@ -126,15 +117,12 @@ async function proAnimatedDP(platform: SupportedPlatformsType, testInfo: TestInf
126117
}
127118

128119
async function proAnimatedDPShows(platform: SupportedPlatformsType, testInfo: TestInfo) {
129-
const iosContext: IOSTestContext = {
130-
sessionProEnabled: 'true',
131-
};
132120
const { devices, prebuilt } = await test.step(TestSteps.SETUP.QA_SEEDER, async () => {
133121
return await open_Alice1_Bob1_friends({
134122
platform,
135123
focusFriendsConvo: false,
136124
testInfo,
137-
iOSContext: iosContext,
125+
iOSContext: IOS_PRO_CONTEXT,
138126
});
139127
});
140128
const { alice1, bob1 } = devices;

run/test/specs/user_actions_pin_unpin.spec.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { communities } from '../../constants/community';
55
import { TestSteps } from '../../types/allure';
66
import { bothPlatformsIt } from '../../types/sessionIt';
77
import { ConversationPinnedIcon, PlusButton } from '../locators/home';
8-
import { IOSTestContext } from '../utils/capabilities_ios';
8+
import { IOS_PRO_CONTEXT } from '../utils/capabilities_ios';
99
import { joinCommunities } from '../utils/community';
1010
import { assertPinOrder, getConversationOrder } from '../utils/conversation_order';
1111
import { newUser } from '../utils/create_account';
@@ -95,12 +95,9 @@ async function pinConversation(platform: SupportedPlatformsType, testInfo: TestI
9595
}
9696

9797
async function nonProPinnedLimit(platform: SupportedPlatformsType, testInfo: TestInfo) {
98-
const iosContext: IOSTestContext = {
99-
sessionProEnabled: 'true',
100-
};
10198
const numCommunities = 6;
10299
const { device } = await test.step(TestSteps.SETUP.NEW_USER, async () => {
103-
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, iosContext);
100+
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, IOS_PRO_CONTEXT);
104101
await newUser(device, USERNAME.ALICE, { saveUserData: false });
105102
return { device };
106103
});
@@ -131,12 +128,9 @@ async function nonProPinnedLimit(platform: SupportedPlatformsType, testInfo: Tes
131128
}
132129

133130
async function proPinnedLimit(platform: SupportedPlatformsType, testInfo: TestInfo) {
134-
const iosContext: IOSTestContext = {
135-
sessionProEnabled: 'true',
136-
};
137131
const numCommunities = 6;
138132
const { device, alice } = await test.step(TestSteps.SETUP.NEW_USER, async () => {
139-
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, iosContext);
133+
const { device } = await openAppOnPlatformSingleDevice(platform, testInfo, IOS_PRO_CONTEXT);
140134
const alice = await newUser(device, USERNAME.ALICE);
141135
return { device, alice };
142136
});

run/test/utils/capabilities_ios.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export type IOSTestContext = {
1212
sessionProEnabled?: string;
1313
};
1414

15+
export const IOS_PRO_CONTEXT: IOSTestContext = { sessionProEnabled: 'true' };
16+
1517
const iosPathPrefix = process.env.IOS_APP_PATH_PREFIX;
1618

1719
export const iOSBundleId = 'com.loki-project.loki-messenger';

0 commit comments

Comments
 (0)