Java tutorial
/******************************************************************************* * Copyright (c) 2005, 2014 springside.github.io * * Licensed under the Apache License, Version 2.0 (the "License"); *******************************************************************************/ package com.asiainfo.tfsPlatform.web.functional.gui; import static org.assertj.core.api.Assertions.*; import org.junit.Test; import org.junit.experimental.categories.Category; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import com.asiainfo.tfsPlatform.dto.TaskDto; import com.asiainfo.tfsPlatform.modules.test.category.Smoke; import com.asiainfo.tfsPlatform.web.data.TaskData; import com.asiainfo.tfsPlatform.web.functional.BaseSeleniumTestCase; /** * ?, ?JavaScript???. * * @author calvin */ public class TaskGuiFT extends BaseSeleniumTestCase { /** * ?. */ @Test @Category(Smoke.class) public void viewTaskList() { s.open("/task/"); WebElement table = s.findElement(By.id("contentTable")); assertThat(s.getTable(table, 0, 0)).isEqualTo("Release SpringSide 4.0"); } /** * //?/. */ @Test @Category(Smoke.class) public void crudTask() { s.open("/task/"); // create s.click(By.linkText("")); TaskDto task = TaskData.randomTask(); s.type(By.id("task_title"), task.getTitle()); s.click(By.id("submit_btn")); assertThat(s.isTextPresent("?")).isTrue(); // update s.click(By.linkText(task.getTitle())); assertThat(s.getValue(By.id("task_title"))).isEqualTo(task.getTitle()); String newTitle = TaskData.randomTitle(); s.type(By.id("task_title"), newTitle); s.click(By.id("submit_btn")); assertThat(s.isTextPresent("?")).isTrue(); // search s.type(By.name("search_LIKE_title"), newTitle); s.click(By.id("search_btn")); assertThat(s.getTable(By.id("contentTable"), 0, 0)).isEqualTo(newTitle); // delete s.click(By.linkText("")); assertThat(s.isTextPresent("?")).as("??").isTrue(); } @Test public void inputInValidateValue() { s.open("/task/"); s.click(By.linkText("")); s.click(By.id("submit_btn")); assertThat(s.getText(By.xpath("//fieldset/div/div/span"))).isEqualTo(""); } }