All skills
fugazi avatar

/webapp-selenium-testing

@ef704d5

Author and maintain versioned Selenium WebDriver tests with Java and JUnit 5. Use for creating, debugging, or running Selenium specs, implementing Page Objects, handling explicit waits, capturing screenshots, or setting up Maven test projects. Supports Chrome, Firefox, and Edge. Keywords: Selenium WebDriver, Java, JUnit 5, Page Object Model, explicit waits, Maven, screenshots.

Use this Skill: https://skilld.dev/gh/fugazi/test-automation-skills-agents/webapp-selenium-testing

This session only. Nothing lands on disk.

referencespage-object-model-best-practices.md

≈516 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Page Object Model Best Practices

Part of the webapp-selenium-testing skill. See SKILL.md for full context.

Related: this file was split from the original page-object-model.md. See the other related files in this folder.

Best Practices Summary

DO [ok]

// Keep locators in constructor as private final
private final By submitButton = By.id("submit");

// Return 'this' for chaining
public LoginPage enterEmail(String email) {
    type(emailInput, email);
    return this;
}

// Return next page on navigation
public DashboardPage login() {
    click(loginButton);
    return new DashboardPage(driver);
}

// Add @Step annotations for Allure
@Step("Enter email: {email}")
public LoginPage enterEmail(String email) { ... }

// Use descriptive method names
public LoginPage checkRememberMe() { ... }

DON'T [no]

// Don't put assertions in Page Objects
public void clickLogin() {
    click(loginButton);
    assertThat(driver.getCurrentUrl()).contains("/dashboard");  // [no] Wrong!
}

// Don't create locators in methods
public void enterEmail(String email) {
    driver.findElement(By.id("email")).sendKeys(email);  // [no] Wrong!
}

// Don't expose WebDriver publicly
public WebDriver getDriver() { return driver; }  // [no] Wrong!

// Don't use Thread.sleep
public void waitForPage() {
    Thread.sleep(2000);  // [no] Never!
}

Quick Reference

Pattern When to Use
return this Action stays on same page
return new NextPage(driver) Action navigates to new page
Component Object Reusable UI part (header, modal)
@Step Document actions in Allure reports
SoftAssertions Multiple assertions in one test
waitForVisible() Before interacting with element
waitForInvisible() After dismissing modal/loader

Source: SKILL.md on GitHub

1 warning14d4 checks · Risk SAFE
  • Gen Agent Trust Hub14d

    The skill provides templates and scripts for Selenium WebDriver testing in Java. It is categorized as low risk due to potential indirect prompt injection vulnerabilities inherent in browser automation and the use of JavaScript execution in the browser context.

  • Socket14d

    No alerts

  • Snyk14d

    Risk: LOW · No issues

  • Runlayer6mo

    1/6 files flagged

Signed by skilld at ef704d5. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated 2 months ago

README badge

README badge for fugazi/test-automation-skills-agents/webapp-selenium-testing