Last active
August 29, 2015 14:01
-
-
Save keesun/312579c18d73354e7173 to your computer and use it in GitHub Desktop.
Geb test with Spock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pages | |
import geb.Page | |
/** | |
* @author Keeun Baik | |
*/ | |
class LoginPage extends Page { | |
static url = "/users/loginform" | |
static at = { title == "로그인" } | |
static content = { | |
idInput { $("#loginId") } | |
passwordInput { $("#password") } | |
loginBtn { $(".login-form-wrap button") } | |
} | |
def loginAsTester() { | |
idInput = "yobitest" | |
passwordInput = "yobitest" | |
loginBtn.click() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pages | |
import geb.Page | |
/** | |
* @author Keeun Baik | |
*/ | |
class NewIssuePage extends Page { | |
static url = "/yobitest/hehe/issueform" | |
static at = { title == "새 이슈 (hehe)" } | |
static content = { | |
bodyTextarea { $("#body") } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geb.spock.GebSpec | |
import org.openqa.selenium.Keys | |
import pages.HomePage | |
import pages.LoginPage | |
import pages.NewIssuePage | |
/** | |
* @author Keeun Baik | |
*/ | |
class NewIssueSpec extends GebSpec { | |
def "이슈 본문 입력 할 때 '@채'를 입력해서 doortts 멘션하기"() { | |
when: "로그인 페이지로 이동해서 테스트 계정으로 로그인한다." | |
to LoginPage | |
loginAsTester() | |
then: "로그인을 마치고 홈페이지로 이동했는지 확인한다." | |
assert at(HomePage) | |
when: "새 이슈 작성 폼으로 이동한다." | |
to NewIssuePage | |
then: "새 이슈 작성 폼으로 이동했는지 확인한다." | |
assert at(NewIssuePage) | |
when: "'@'을 입력한다." | |
bodyTextarea << "@" | |
then: "맨션 목록에 2개의 항목이 들어있는지 확인한다. 첫번째 항목은 '채수원'이고 두번쨰 항목은 '백기선'인지 확인한다." | |
assert $("ul.atwho-view-ul li").size() == 2 | |
assert $("ul.atwho-view-ul li")[0].text().contains("채수원") | |
assert $("ul.atwho-view-ul li")[1].text().contains("백기선") | |
when: "'@'에 이어서 '채'를 입력한다." | |
bodyTextarea << "채" | |
then: "이번에는 멘션 목록에 항목이 1개여야 하며, '채수원'이어야 한다." | |
assert $("ul.atwho-view-ul li").size() == 1 | |
assert $("ul.atwho-view-ul li")[0].text().contains("채수원") | |
when: "리턴을 입력한다." | |
bodyTextarea << Keys.chord(Keys.RETURN) | |
then: "이슈 본문에 '@doortts'가 자동완성 되었는지 확인한다." | |
assert bodyTextarea.value().contains("@doortts") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment