pytest_wifi_getting_started.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: CC0-1.0
  3. import os.path
  4. from typing import Tuple
  5. import pytest
  6. from pytest_embedded_idf.dut import IdfDut
  7. # @pytest.mark.supported_targets
  8. # This test should support all targets, even between different target types
  9. # For now our CI only support multi dut with esp32
  10. # If you want to enable different target type, please use the following param
  11. # @pytest.mark.parametrize(
  12. # 'count, app_path, target', [
  13. # (2,
  14. # f'{os.path.join(os.path.dirname(__file__), "softAP")}|{os.path.join(os.path.dirname(__file__), "station")}',
  15. # 'esp32|esp32s2'),
  16. # ],
  17. # indirect=True,
  18. # )
  19. @pytest.mark.esp32
  20. @pytest.mark.wifi_two_dut
  21. @pytest.mark.parametrize(
  22. 'count, app_path', [
  23. (2,
  24. f'{os.path.join(os.path.dirname(__file__), "softAP")}|{os.path.join(os.path.dirname(__file__), "station")}'),
  25. ], indirect=True
  26. )
  27. def test_wifi_getting_started(dut: Tuple[IdfDut, IdfDut]) -> None:
  28. softap = dut[0]
  29. station = dut[1]
  30. ssid = softap.app.sdkconfig.get('ESP_WIFI_SSID')
  31. password = softap.app.sdkconfig.get('ESP_WIFI_PASSWORD')
  32. assert station.app.sdkconfig.get('ESP_WIFI_SSID') == ssid
  33. assert station.app.sdkconfig.get('ESP_WIFI_PASSWORD') == password
  34. tag = 'wifi station'
  35. station.expect(f'{tag}: got ip:', timeout=60)
  36. station.expect(f'{tag}: connected to ap SSID:{ssid} password:{password}', timeout=60)
  37. softap.expect('station .+ join, AID=', timeout=60)