fix: remove redundant existence check, use cy.within() for scoped selector (#84)

Addresses Gemini review feedback on PR #50 line 23: the .should('exist')
check was redundant since the if-condition already confirms element presence.
Refactored to use cy.within() to scope the .deactivate a check, eliminating
selector repetition and improving readability.

Closes #79
This commit is contained in:
2026-03-17 20:29:00 +00:00
committed by GitHub
parent e1ee99ac9c
commit 79f78882a6

View File

@@ -20,8 +20,9 @@ describe('WordPress Playground Single Site Tests', () => {
cy.get('body', { timeout: 15000 }).then(($body) => {
// Verify the starter template plugin exists and is activated.
if ($body.find('tr[data-slug="wp-plugin-starter-template-for-ai-coding"]').length) {
cy.get('tr[data-slug="wp-plugin-starter-template-for-ai-coding"]').should('exist');
cy.get('tr[data-slug="wp-plugin-starter-template-for-ai-coding"] .deactivate a').should('exist');
cy.get('tr[data-slug="wp-plugin-starter-template-for-ai-coding"]').within(() => {
cy.get('.deactivate a').should('exist');
});
} else {
cy.log('Starter template plugin not found by slug, skipping check');
}