This summer, as people became more relaxed about social distancing and cities began to loosen their restrictions on gatherings, demand for COVID-19 tests increased dramatically.

Matthew Maiorino, a managing partner at Merion Health Partners, which operates several American Family Care (AFC) urgent care centers in Philadelphia and Montgomery Counties, saw that demand peak over the Fourth of July holiday.

At the time, AFC urgent care centers in the area were primarily using LabCorp for their testing needs, but the lab quickly grew strained. The wait for results increased from around two days to 10, Maiorino said. And as public health experts raised the possibility of a fall surge in coronavirus cases, Maiorino and his team knew they needed to plan for shortages and delays.

“We needed to prepare for that. Waiting two, three, or four days for results doesn’t help with the spread of the virus,” he said. “It doesn’t matter how much you tell someone they need to quarantine until their results are back. A lot of these folks don’t take it seriously and they wait until that result comes back before they change their lifestyle.”

In recent months, the cracks that still exist in the country’s COVID-19 testing system have been exposed as case numbers have surged. Over the Thanksgiving holiday, many Philadelphians waited for hours to get tested. Some didn’t receive their test results for weeks. Pennsylvania is ranked 51st among U.S. states and territories in the number of tests conducted per 100,000 people as of Dec. 16, according to data compiled by the Johns Hopkins University of Medicine.

» READ MORE: COVID-19 vaccine gives Philly health-care workers a glimpse of pandemic hope. Then it’s back to work.

Health officials attributed these complications to a shortage of testing supplies. In a survey of 47 states and territories conducted by the Government Accountability Office in October, 24 states reported shortages of rapid point-of-care tests, 21 reported shortages of reagents, and 16 reported shortages in testing instruments. The shortages have affected other areas of medical testing as well, such as for sexually transmitted infections and pneumonia.

“The laboratory industry as a whole is experiencing increasing constraints on supplies, including test kits and reagents on high-end platforms as well as pipettes and other goods needed to provide testing,” Kimberly Gorode, a Quest spokesperson, said through an email. “We are in constant contact with our suppliers, which are working to produce these goods to meet increasing global demand.”

Peter Hotz, president and CEO of Vybe Urgent Care, described the testing shortages as “kind of a day-by-day situation.” It was one of the reasons Vybe moved to appointment-only testing, he said. Currently Vybe urgent care centers conduct 500 PCR tests a day on average.

“We don’t have enough swabs to test everyone we want to test,” Hotz said. “We’re trying to identify other partners right now, especially regional labs which are smaller but appear to have some capacity.”

» READ MORE: Yes, you still need to wear a mask after you get the COVID-19 vaccine. Here’s why.

That was the solution Maiorino and his team decided on for the urgent care centers they managed. At the end of summer they purchased tens of thousands of tests, which cost “millions of dollars,” from Abbott Laboratories. Maiorino said most of those tests are now readily accessible, and the team expects to have enough to last through the winter.

“My understanding is that there are groups fighting to get tests because there wasn’t a contract in place, and they were relying on a lab or a vendor to continue to respond when they place an order,” Maiorino said. “A lot of folks are walking in or coming through our telemedicine platform and telling us that they’ve tried to find a test, but a lot of places either don’t have appointments or don’t have tests.”

On Tuesday, the Food and Drug Administration authorized the first rapid coronavirus test that can be taken at home. Patients do not need a prescription for the test, which will cost approximately $30. Because these samples do not need to be sent to a lab, health officials hope the technology will take some of the strain off the testing system.

“We know there’s more demand [for tests],” Hotz said. “Everyone is working as hard as they can to get through this, but it’s just a challenging situation.”