Encapsulation
As you may have noticed, either private or protected are always used in the code examples:
Use data-testid attributes
Using common CSS selectors to find elements in automation testing is not the best approach.
Avoid shared variables
Avoiding sharing mutable variables across different tests can be achieved by using a setup() (or init() or testSetup()) function instead of using beforeEach to initialize variables that will be used in tests.