Skip to content

Commit b6ebe95

Browse files
committed
address remaining TP review comments
1 parent 1bf16c0 commit b6ebe95

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

src/python_testing/TC_CC_2_2.py

+28-24
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,17 @@
3939

4040

4141
class TC_CC_2_3(MatterBaseTest):
42+
43+
# Test includes several long waits, adjust timeout to accommodate.
44+
@property
45+
def default_timeout(self) -> int:
46+
return 180
47+
4248
def steps_TC_CC_2_2(self):
4349
THcommand = "Test Harness sends the"
4450

4551
def store_values(attr: str) -> str:
46-
return f"TH stores the reported values of _{attr}_ in all incoming reports for _{attr}_ attribute, that contains data in _reportedCurrentHueValuesList_, over a period of 30 seconds."
52+
return f"TH stores the reported values of _{attr}_ in all incoming reports for _{attr}_ attribute, that contains data in _reportedCurrentHueValuesList_, over a period of 20 seconds."
4753

4854
def verify_entry_count(attr: str) -> str:
4955
return f'TH verifies that _reportedCurrentHueValuesList_ does not contain more than 10 entries for _{attr}_'
@@ -72,7 +78,9 @@ def entry_count_verification() -> str:
7278
TestStep(15, verify_entry_count('CurrentSaturation'), entry_count_verification()),
7379
TestStep(16, 'If XY feature is not supported, skip steps 17-21'),
7480
TestStep(
75-
17, f"{THcommand} MoveToColor with _ColorX_ field set to 13107, _ColorY_ set to 13107, _TransitionTime_ field set to 100 and remaining fields set to 0"),
81+
"17a", f"{THcommand} MoveToColor with _ColorX_ field set to 32768, _ColorY_ set to 19660, _TransitionTime_ field set to 0 and remaining fields set to 0"),
82+
TestStep(
83+
"17b", f"{THcommand} MoveToColor with _ColorX_ field set to 13107, _ColorY_ set to 13107, _TransitionTime_ field set to 100 and remaining fields set to 0"),
7684
TestStep(18, store_values('CurrentX')),
7785
TestStep(19, store_values('CurrentY')),
7886
TestStep(20, verify_entry_count('CurrentX'), entry_count_verification()),
@@ -84,12 +92,8 @@ def entry_count_verification() -> str:
8492
TestStep(26, "If the RemainingTime attribute is not supported, skip the remaining steps and end test case"),
8593
TestStep(27, store_values('RemainingTime')),
8694
TestStep(
87-
28, f"If HS feature is supported and XY feature is not supported, {THcommand} MoveToHue with _Hue_ field set to 254, _TransitionTime_ field set to 100, _Direction_ field set to Shortest and remaining fields set to 0", verify_success()),
88-
TestStep(
89-
29, f"If the XY feature is supported and the HS feature is not supported, {THcommand} MoveToColor with _ColorX_ field set to 13107, _ColorY_ set to 13107, _TransitionTime_ field set to 100 and remaining fields set to 0", verify_success()),
95+
29, f"If the XY feature is supported and the HS feature is not supported, {THcommand} MoveToColor with _ColorX_ field set to 32768, _ColorY_ set to 19660, _TransitionTime_ field set to 100 and remaining fields set to 0", verify_success()),
9096
TestStep(30, "Wait for 5 seconds"),
91-
TestStep(
92-
31, f"If HS feature is supported and XY feature is not supported, {THcommand} MoveToHue with _Hue_ field set to 254, _TransitionTime_ field set to 150, _Direction_ field set to Shortest and remaining fields set to 0", verify_success()),
9397
TestStep(
9498
32, f"If the XY feature is supported and the HS feature is not supported, {THcommand} MoveToColor with _ColorX_ field set to 13107, _ColorY_ set to 13107, _TransitionTime_ field set to 150 and remaining fields set to 0", verify_success()),
9599
TestStep(33, "Wait for 20 seconds"),
@@ -197,8 +201,12 @@ def check_report_counts(attr: ClusterObjects.ClusterAttributeDescriptor):
197201
self.skip_step(20)
198202
self.skip_step(21)
199203
else:
200-
self.step(17)
201-
cmd = cc.Commands.MoveToColor(colorX=13107, colorY=13107, transitionTime=100)
204+
self.step("17a")
205+
cmd = cc.Commands.MoveToColor(colorX=32768, colorY=19660, transitionTime=0)
206+
await self.send_single_cmd(cmd)
207+
208+
self.step("17b")
209+
cmd = cc.Commands.MoveToColor(colorX=13107, colorY=13107, transitionTime=0)
202210
await self.send_single_cmd(cmd)
203211

204212
self.step(18)
@@ -238,41 +246,37 @@ def check_report_counts(attr: ClusterObjects.ClusterAttributeDescriptor):
238246
self.step(27)
239247
accumulate_reports()
240248

241-
self.step(28)
242-
if supports_hs and not supports_xy:
243-
cmd = cc.Commands.MoveToHue(hue=254, transitionTime=100, direction=cc.Enums.HueDirection.kShortestDistance)
244-
await self.send_single_cmd(cmd)
245-
246249
self.step(29)
247-
if supports_xy and not supports_hs:
248-
cmd = cc.Commands.MoveToColor(colorX=13107, colorY=13107, transitionTime=100)
250+
# TODO: If this is mandatory, we should just omit this
251+
if supports_xy:
252+
cmd = cc.Commands.MoveToColor(colorX=32768, colorY=19660, transitionTime=100)
249253
await self.send_single_cmd(cmd)
254+
else:
255+
self.mark_current_step_skipped()
250256

251257
self.step(30)
252258
logging.info("Test will now wait for 5 seconds")
253259
time.sleep(5)
254260

255-
self.step(31)
256-
if supports_hs and not supports_xy:
257-
cmd = cc.Commands.MoveToHue(hue=254, transitionTime=150, direction=cc.Enums.HueDirection.kShortestDistance)
258-
await self.send_single_cmd(cmd)
259-
260261
self.step(32)
261-
if supports_xy and not supports_hs:
262+
if supports_xy:
262263
cmd = cc.Commands.MoveToColor(colorX=13107, colorY=13107, transitionTime=150)
263264
await self.send_single_cmd(cmd)
265+
else:
266+
self.mark_current_step_skipped()
264267

265268
self.step(33)
266269
logging.info("Test will now wait for 20 seconds")
267270
time.sleep(20)
268271

269272
self.step(34)
270-
# TODO: Re-enable checks 34, 34, 36 when #34643 is addressed
273+
# TODO: Re-enable checks 34, 36 when #34643 is addressed
274+
logging.info(f'received reports: {sub_handler.attribute_reports[cc.Attributes.RemainingTime]}')
271275
# count = sub_handler.attribute_report_counts[cc.Attributes.RemainingTime]
272276
# asserts.assert_equal(count, 3, "Unexpected number of reports received")
273277

274278
self.step(35)
275-
# asserts.assert_equal(sub_handler.attribute_reports[cc.Attributes.RemainingTime][0].value, 100, "Unexpected first report")
279+
asserts.assert_equal(sub_handler.attribute_reports[cc.Attributes.RemainingTime][0].value, 100, "Unexpected first report")
276280

277281
self.step(36)
278282
# asserts.assert_almost_equal(

0 commit comments

Comments
 (0)