const testBtn = () => this.page.getByTestId("test"); const isChecked = await testBtn().isChecked(); if (!isChecked) { await testBtn().click(); }