Summer Lee is one of four candidates endorsed by Democratic Socialists of America who won state legislative races in Pennsylvania on Tuesday. Photograph by Jeremy Edwards / Summer for PA

Over the past six months, three women running in Pennsylvania’s Democratic primaries have grown to be close friends. Summer Lee, Sara Innamorato, and Elizabeth Fiedler, all candidates for the State House, are endorsed by the Democratic Socialists of America, the hard-left organization founded in 1982 and revitalized by Bernie Sanders. Like many millennial Democrats, they’ve been drawn to the D.S.A. in response to what they view as their party’s failure to address the needs of people like them.

Lee, who is thirty years old, was jobless when she graduated from Howard University Law School, in 2015, and moved home to live with her mom and find work as a political organizer. Innamorato, who is thirty-two, feared that she wouldn’t be able to afford college, after her mother left her father, who was suffering from an opioid addiction, but she graduated from the University of Pittsburgh and went to work at Apple. Fiedler, who is thirty-seven and the mother of an eleven-month-old and a three-year-old, struggled to find health care last summer when she left her job in Philadelphia public radio to run for office.

Their races, each in districts of roughly sixty thousand people, were small, but the outcomes were to serve as a nationwide referendum on which direction the Democrats should go. “Conventional wisdom is that you have to govern near the middle,” Joseph Sabino Mistick, a law professor at Duquesne University and a Pennsylvania political analyst, said of the Democrats, last night, as he awaited returns. This is what the Party had recently done in Trump country, with moderates like Conor Lamb. “That’s the struggle for the soul of the Democratic Party: Should it go left, to its F.D.R. roots, or to the center, which is more advantageous? It’s playing out on a national level, but here on a local level, too.”

These candidates were risking running against popular Democratic old-timers—Lee and Innamorato were taking on two cousins, Paul and Dom Costa, members of a powerful Pittsburgh political family—on platforms calling for radical change to the status quo. None of them were fighting for Trump country; all three lived in deep-blue districts, where labor unions had helped keep the Democratic Party strong. If they won the primary, they were assured a seat. But in many ways Pittsburgh is socially conservative. For all of the D.S.A.’s aspirational, left-wing, populist platform—universal health care, a clean environment, a fair living wage—no one knew whether that messaging would yield votes.

Lee, Innamorato, and Fiedler met, last winter, at a conference for progressive candidates, in the state capital of Harrisburg. Soon, they were holding joint fund-raisers, and their campaign managers were sharing tactics on regular phone calls. “Running for office is lonely,” Fiedler said. “It helped a lot on cold winter days, when everyone else was home with their families, to text one another and say, ‘Hey, I’m going out to knock on doors.’ ” One of the D.S.A.’s tactics has been to target small races in order to build local power, in a way that Republicans have traditionally done better than Democrats: deploying armies of volunteers to knock on tens of thousand of doors, over months rather than weeks; crunching numbers to forge specific goals; and breaking down demographic data to reach specific voters. These methods allowed three political unknowns to wage a remarkably sophisticated insurgency within their own party.

They entered the virtual world of campaigning in a manner that far outpaced their older opponents. Last October, after the actress Alyssa Milano revived the #MeToo hashtag, and women started sharing their stories on Twitter by the millions, Innamorato posted the story of her own sexual assault, which occurred when she was nine years old, on Medium, explaining how that experience had inspired her support for #MeToo. “If women aren’t at the table, they’re on the menu,” she wrote. The experience of posting something so personal was nerve-racking. But soon female voters were responding online and in person, thanking Innamorato for her vulnerability. “That’s what politics is,” she said. “Establishing trust.” Candidates now must react to issues in real time, and in a very public way. “Win or lose, politicians around here will certainly take notice of the kinds of campaigns they’ve run,” Mistick told me last night. According to Doug Shields, a longtime Pittsburgh Democrat and a former member of the city council, these new campaigns posed an existential threat to the status quo by their methods alone. “The Democratic Party leadership now understands that they are at risk,” he said.

On Election Day, polls opened at 7 a.m. After voting, Lee—who was running against the incumbent, Paul Costa, a more centrist Democrat who had held office in Pittsburgh for the past nineteen years—texted her fellow-candidates a note of support: “Good morning ladies. You’re awesome. It’s been an honor to run alongside you both. Now let’s run it home. #showtime.” From Philadelphia, Fiedler responded, “It was a pleasure to share this election with you both. That’s true no matter what today’s results. Since the beginning, we knew we needed to outwork them. Let’s show them how it’s done.” To which Innamorato, in Pittsburgh, added, “Love you both.” Then each set out for a final day of campaigning.

Fiedler, who has often campaigned with her two small children, had risen at 5 a.m. and headed for the basement office that she’d rented from a medical practice, where volunteers sat at doctors’ examination tables. By late morning, she encountered a group of twenty male Teamsters wearing her blue campaign T-shirts in a supermarket parking lot. She spent most of the day travelling between voting precincts in a car driven by one of her supporters, a Teamster named Vinnie. She took along a midwife friend, and her friend’s young daughter, who was wearing pink sunglasses. From the road, Fiedler tweeted a photo of her team, saying, “My Election Day crew: A toddler & a Teamster (& Andrea).” Around 5 p.m., Fiedler went on foot from subway stop to subway stop, reminding people to vote. She was still campaigning at 6 p.m., when the next text came in on the thread, from Innamorato: “How you feeling?!?”

Innamorato carries the kind of professional affability that has allowed her to move easily between jobs at Apple, where she spent two years in leadership training, and then on to SheRuns, an organization that she co-founded with a friend to encourage women to run for office. Strolling around the district, she’d spent her day much as Fiedler had, travelling between polling stations and eating bags of chips. Now she’d stopped off at Tupelo Honey Teas, a vegan café in her district, before ending the day at Hitchhiker Brewing Co., the local bar where she hoped she’d be hosting a victory party.

“High turnout here,” Fiedler replied. “Both in my strong locations and elsewhere. Fingers crossed. Will be close.” The turnout in each of their districts was indeed high. (State races like this typically turn out about eighteen per cent of voters; Lee, Innamorato, and Fiedler’s races each drew more than thirty per cent.)

“Always close,” Innamorato replied.

When the polls closed, at 8 p.m., Lee went to her campaign office, which is in a hair salon. Her data team was already at work filling out Google spreadsheets, as supporters called and texted returns from each precinct. By eight-forty-five, Lee knew the results in sixty per cent of her district. She’d won by a landslide: sixty-eight per cent (6,892 votes) to thirty-two per cent (3,274). She had to push people out of the office in order to get to the nearby bar where she’d been prepared to “celebrate or mourn.” She was in the car when the phone rang. It was her opponent, Paul Costa, calling to congratulate her. “He told me I kicked his ass,” she said.

At another bar, across town, Innamorato received no such call from her opponent, who happened to be Costa’s cousin, Dom. She, too, had won in a rout: sixty-four per cent to thirty-five per cent. There were five total D.S.A.-backed candidates in Pennsylvania: the other two were Kristin Seale, who won, outside of Philadelphia, and Kareem Kandil, who lost his race. By midnight, Innamorato left the bar and drove to Lee’s district to find her. Lee had already gone home to bed, but she came back out to meet Innamorato in a nearby bar. They toasted each other until 2 a.m., and decided to carpool for trips to the state capital. “I’ll be shotgun,” Lee told Innamorato. “It’s a long ride.”

Three hundred miles away, in Philadelphia, torrents of rain were pouring from the sky. Fiedler’s campaign supporters scrambled to gather the live results that were posted on the doors of precincts before they got too wet to read. Just after nine, as she awaited the final results, Fiedler texted her friends for the last time that evening. “With you all in spirit over here,” she wrote. Minutes later, she won by a dozen points.