Skip to content

Commit 0d26971

Browse files
committed
Stabilize iOS integration assertion for Settings General page
1 parent 6c5b10a commit 0d26971

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

test/integration/ios.test.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,41 @@ test('ios settings commands', { skip: shouldSkipIos() }, async () => {
3030
detail: 'expected snapshot to include a nodes array',
3131
});
3232

33-
const clickArgs = ['click', '@e21', '--json', ...session];
34-
integration.runStep('click @e21', clickArgs);
33+
const openGeneralArgs = ['find', 'text', 'General', 'click', '--json', ...session];
34+
const openGeneral = integration.runStep('open general', openGeneralArgs);
35+
integration.assertResult(
36+
openGeneral.json?.success,
37+
'open general success',
38+
openGeneralArgs,
39+
openGeneral,
40+
{ detail: 'expected find General click to return success=true' },
41+
);
3542

3643
const snapshotGeneralArgs = ['snapshot', '--json', ...session];
3744
const snapshotGeneral = integration.runStep('snapshot general', snapshotGeneralArgs);
38-
const generalDescription = 'Manage your overall setup and preferences';
45+
const generalDescriptionCandidates = [
46+
'Manage your overall setup and preferences',
47+
'About',
48+
'Software Update',
49+
];
3950
const generalNodes = Array.isArray(snapshotGeneral.json?.data?.nodes)
4051
? snapshotGeneral.json.data.nodes
4152
: [];
4253
integration.assertResult(
43-
generalNodes.some(
44-
(node: { label?: string }) =>
45-
typeof node?.label === 'string' && node.label.includes(generalDescription),
46-
),
54+
generalNodes.some((node: { label?: string }) => {
55+
const label = node?.label;
56+
if (typeof label !== 'string') return false;
57+
return generalDescriptionCandidates.some((candidate) => label.includes(candidate));
58+
}),
4759
'snapshot shows general page description',
4860
snapshotGeneralArgs,
4961
snapshotGeneral,
5062
{
51-
detail: `expected a node label containing ${JSON.stringify(generalDescription)}`,
63+
detail: `expected a node label containing one of ${JSON.stringify(generalDescriptionCandidates)}`,
5264
},
5365
);
5466

55-
const findTextArgs = ['find', 'text', generalDescription, 'exists', '--json', ...session];
67+
const findTextArgs = ['find', 'text', 'Software Update', 'exists', '--json', ...session];
5668
const findText = integration.runStep('find text', findTextArgs);
5769
integration.assertResult(
5870
findText.json?.success,

0 commit comments

Comments
 (0)