Skip to content

Commit

Permalink
ci(wifi): Add scan to wifi test
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasssvaz committed Jun 7, 2024
1 parent e3fedc5 commit fe7f473
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/validation/wifi/test_wifi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
def test_wifi(dut):
dut.expect_exact("Scan start")
dut.expect_exact("Scan done")
dut.expect_exact("Wokwi-GUEST")
dut.expect_exact("WiFi connected")
dut.expect_exact("IP address:")
22 changes: 22 additions & 0 deletions tests/validation/wifi/wifi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,28 @@ void setup() {
Serial.println(eventID);
// WiFi.removeEvent(eventID);

Serial.println("Scan start");

// WiFi.scanNetworks will return the number of networks found.
int n = WiFi.scanNetworks();
Serial.println("Scan done");
if (n == 0) {
Serial.println("no networks found");
} else {
Serial.print(n);
Serial.println(" networks found");
for (int i = 0; i < n; ++i) {
// Print SSID for each network found
Serial.printf("%s\n", WiFi.SSID(i).c_str());
Serial.println();
delay(10);
}
}
Serial.println("");

// Delete the scan result to free memory for code below.
WiFi.scanDelete();

WiFi.begin(ssid, password);

Serial.println();
Expand Down

0 comments on commit fe7f473

Please sign in to comment.