Skip to content

Commit 034d568

Browse files
authored
ci(wifi): Add scan to wifi test (espressif#9805)
1 parent 2928654 commit 034d568

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Diff for: tests/validation/wifi/test_wifi.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
def test_wifi(dut):
2+
dut.expect_exact("Scan start")
3+
dut.expect_exact("Scan done")
4+
dut.expect_exact("Wokwi-GUEST")
25
dut.expect_exact("WiFi connected")
36
dut.expect_exact("IP address:")

Diff for: tests/validation/wifi/wifi.ino

+22
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,28 @@ void setup() {
112112
Serial.println(eventID);
113113
// WiFi.removeEvent(eventID);
114114

115+
Serial.println("Scan start");
116+
117+
// WiFi.scanNetworks will return the number of networks found.
118+
int n = WiFi.scanNetworks();
119+
Serial.println("Scan done");
120+
if (n == 0) {
121+
Serial.println("no networks found");
122+
} else {
123+
Serial.print(n);
124+
Serial.println(" networks found");
125+
for (int i = 0; i < n; ++i) {
126+
// Print SSID for each network found
127+
Serial.printf("%s\n", WiFi.SSID(i).c_str());
128+
Serial.println();
129+
delay(10);
130+
}
131+
}
132+
Serial.println("");
133+
134+
// Delete the scan result to free memory for code below.
135+
WiFi.scanDelete();
136+
115137
WiFi.begin(ssid, password);
116138

117139
Serial.println();

0 commit comments

Comments
 (0)