Java · TestNG
Project management with Selenium
A sprint Kanban you can drag across (or use the move menu), a create-issue modal with label chips, issue pages with sub-task progress and comments, an SVG burndown chart, and a backlog with bulk move to sprint.
App under test
🗂️ TaskBoard
- URL
- /apps/projects
- Sprint
- Sprint 14 · day 6 of 10
- Issue keys
- PA-1 … (next PA-9)
- Login
- not required
Scenarios to automate
Work top to bottom — each one adds a new technique.
- 1
Assignee avatars filter
Beginnerfilter-assignee-* toggles (aria-pressed) and only-mine narrow the board; assert board-count.
- 2
Create-issue validation
Intermediatesave-task with blanks shows task-errors and error-*; a short title is rejected.
- 3
Chips with Enter
IntermediateType in label-input and press Enter (or add-label); remove with remove-label-*.
- 4
Drag across columns
AdvancedDrag a task-card onto col-review (HTML5 DnD); or use move-task-<key>. col-count-* updates.
- 5
Sub-task progress
BeginnerAdd sub-tasks, tick subtask-0 and assert subtask-progress “1/2”.
- 6
SVG chart data
Advancedburndown-point circles carry data-day/data-points; the last point equals burndown-remaining.
- 7
Bulk move
IntermediateTick select-<key> in the backlog and move-to-sprint; the issues appear on the board.
Sample Selenium suite
A working starting point that finds elements every way Selenium can — by role, label, text, id, name, CSS, XPath and data-testid — so you practice them all. Pick your language, switch to data-testid only to compare, or try your own in the Locator Playground.
import org.testng.annotations.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import java.util.Map;
import org.openqa.selenium.support.ui.*;
import java.time.Duration;
import static org.openqa.selenium.support.ui.ExpectedConditions.*;
// Locators in this suite: By.id ×4 · By.name ×2 · By.linkText ×3 · By.xpath ×4 · By.cssSelector ×3 · data-testid ×13
public class TaskBoardSprintTest {
static final String BASE = "https://www.practiceqaautomation.com";
WebDriver driver;
WebDriverWait wait;
// Small helpers: every action takes a By and waits for its element first (no Thread.sleep).
By tid(String id) { return By.cssSelector("[data-testid='" + id + "']"); }
WebElement ready(By by) { return centre(wait.until(elementToBeClickable(by))); }
void click(By by) { ready(by).click(); }
WebElement nth(String id, int n) { return centre(wait.until(numberOfElementsToBeMoreThan(tid(id), n)).get(n)); }
void clickNth(String id, int n) { nth(id, n).click(); }
// Scroll to the middle of the screen first: Selenium only scrolls an element to the edge,
// where a sticky header or a fixed bottom bar can cover it (ElementClickInterceptedException).
WebElement centre(WebElement e) {
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'})", e);
return e;
}
void type(By by, String text) { ready(by).sendKeys(text); }
void select(By by, String value) { new Select(ready(by)).selectByValue(value); }
void check(By by) { WebElement e = ready(by); if (!e.isSelected()) e.click(); }
void expectText(By by, String text) { wait.until(textToBePresentInElementLocated(by, text)); }
void expectVisible(By by) { wait.until(visibilityOfElementLocated(by)); }
void expectNthText(String id, int n, String text) {
wait.until(d -> d.findElements(tid(id)).size() > n && d.findElements(tid(id)).get(n).getText().contains(text));
}
@BeforeMethod
public void setUp() {
ChromeOptions options = new ChromeOptions();
// Turn off Chrome's "Save password?" and "password found in a data breach" pop-ups: after a
// login they take the keyboard and mouse away from the page, so later typing and clicks are lost.
options.setExperimentalOption("prefs", Map.of(
"credentials_enable_service", false,
"profile.password_manager_enabled", false,
"profile.password_manager_leak_detection", false));
driver = new ChromeDriver(options);
wait = new WebDriverWait(driver, Duration.ofSeconds(10));
}
@AfterMethod(alwaysRun = true)
public void tearDown() { driver.quit(); }
@Test
public void createsAnIssueAndFinishesItInTheSprint() {
driver.get(BASE + "/apps/projects");
click(tid("create-task"));
type(By.id("task-title"), "Add login rate limiting");
select(By.name("task-type"), "story");
select(By.id("task-priority"), "high");
select(By.name("task-assignee"), "amir");
select(tid("task-points"), "5");
type(By.cssSelector("[placeholder='Type and press Enter']"), "security");
click(By.xpath("//button[normalize-space()='Add']"));
expectText(tid("label-chip"), "security");
click(By.xpath("//button[normalize-space()='Create']"));
expectText(tid("board-toast"), "PA-9 created");
expectText(By.cssSelector("[aria-label='To do']"), "Add login rate limiting");
click(By.linkText("Add login rate limiting"));
type(By.id("subtask-input"), "Write tests");
click(By.xpath("//button[normalize-space()='Add']"));
type(By.id("subtask-input"), "Implement limiter");
click(By.xpath("//button[normalize-space()='Add']"));
check(tid("subtask-0"));
expectText(tid("subtask-progress"), "1/2");
click(tid("back-to-board"));
select(tid("move-task-PA-9"), "done");
expectText(By.cssSelector("[aria-label='Done']"), "Add login rate limiting");
click(By.linkText("Sprint report"));
expectText(tid("burndown-total"), "26 pts");
expectText(tid("burndown-remaining"), "18 pts");
click(By.linkText("Backlog"));
check(tid("select-PA-6"));
click(tid("move-to-sprint"));
expectText(tid("backlog-count"), "2 issues");
}
}