After your brief adventure with the Weighted Companion Cube, you reach Test Chamber 18.
Go Up
Up ahead, there is a poison pit. Make a portal on the ceiling across the pit, then make a portal of the other color nearby and walk through it.
Look up at the ceiling above the next ledge and make a portal on it, then make a portal of the other color on the wall above the next poison pit and fall into it. You will land on a ledge with a symbol on the floor with two dots on it.
Look for a symbol with three dots on it and make a portal on the ceiling above it. Then make a portal of the other color on the floor and fall in, and you will land where the three-dot symbol is.
Now look for the symbol with four dots, and make a portal on the piece of wall that sticks out near the ceiling in that area. Make a portal on that piece of wall, then make a portal of the other color on the floor and fall in. If you fall off of the ledge, you should land on a piece of floor where you can just make a portal of the same color beneath you, and you will land on the four-dot ledge again.
From the ledge with four dots, look down at the small piece of floor and make a portal of the other color (not the color on the piece of wall sticking out above you). Fall into that floor portal and the momentum should send you to the red button.
Pellets
Ignore the red button for now, and go through the door. There is a small button here, and it will make the wall push outward, but there are turrets beyond that wall. After you press the small button, hide behind the piece of wall and make a portal on one of the dark marks on the wall where a pellet has been hitting it, and make a portal of the other color where a turret laser is hitting the wall. This will make pellets hit the turrets in the room and disable them. There are four turrets.
After you disable all of the turrets, go into the room where the turrets were. To the left, there is a small chamber with a pellet containment machine in it, and a small red button nearby. To push the button, you can put a portal on the piece of wall near the button, and portal of the other color that you can walk partway through. But you also need to make a pellet go toward the pellet containment machine. There is a portal on the far wall, across from the pellet containment machine, so put a portal on it, then put a portal of the other color onto one of the dark marks on the wall where the pellet is hitting it. Then as soon as the pellet comes out of the portal toward the containment machine, quickly make a portal on the piece of wall near the small red button, and a portal of the other color that you can walk partway through, and push the red button to open the door, allowing the pellet to reach the containment machine.
Get a Cube
The platform in the middle will now be moving. Ride it and fall down to the lower ledge where there is another small red button. If you press it, the wall panel on the opposite side of the room will open. It is the same wall panel that you came through when you were disabling the four turrets. You will need to go through that piece of wall, so make a portal here near the small red button, and make a portal of the other color near (but not on) that piece of wall that opens. Then press the red button and jump up the short steps to go through the portal that you made here, so you end up near the wall panel that opened. Go through the wall panel, crouching if necessary (check the menu if you can't remember how to crouch).
After the wall panel closes, push the red button again and turn to face the piece of wall that is opening. When it stops moving, put a portal on it, then go to the edge of this ledge that is farthest from the pellet containment machine and make a portal of the other color on the floor there. Fall into it and you should have enough momentum to end up on the upper ledge across the room that has a cube on it.
Take the cube and jump onto the moving platform and ride it across. On the other side, put down the cube, and make a portal on the wall next to the piece of wall that opens when you press the small red button. (Make sure the portal is not on the piece of wall itself, because the portal will disappear when the wall starts moving.) Then ride the platform across the room and fall down to the small red button there. Put a portal of the other color on a nearby wall and press the small red button, then jump up the short flight of stairs to go through your portal. Take the cube through the piece of wall that opened.
Go to the big red button and put the cube on it. This opens the door across the way. Make a portal next to the door that opened, and a portal of the other color on the ledge with the three-dot symbol on it, and fall through to reach the door that you opened. Go through that door.
Go Up Again
There is a small platform sticking up out of the poison pit. Put a portal on it, and a portal of the other color into the deep pit at the side of this area. Fall into the pit portal and you will be launched upward. As you go up, look for the next-highest ledge, and put a portal of the color that you are not about to fall into, and you will be launched up from the next platform. Continue doing this to go farther up, until you see an angled piece of wall. Shoot a portal onto that (again, a portal not the color that you are about to fall into), and you will reach the elevator to Test Chamber 19.