cn.aozhi.songify.functional.gui.RegisterFT.java Source code

Java tutorial

Introduction

Here is the source code for cn.aozhi.songify.functional.gui.RegisterFT.java

Source

/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package cn.aozhi.songify.functional.gui;

import static org.assertj.core.api.Assertions.*;

import org.junit.Test;
import org.openqa.selenium.By;
import cn.aozhi.songify.functional.BaseSeleniumTestCase;

public class RegisterFT extends BaseSeleniumTestCase {

    @Test
    public void register() {
        // 
        s.open("/logout");
        s.click(By.linkText(""));

        s.type(By.id("loginName"), "user2");
        s.type(By.id("name"), "Kevin");
        s.type(By.id("plainPassword"), "user2");
        s.type(By.id("confirmPassword"), "user2");

        s.click(By.id("submit_btn"));

        // 
        s.waitForTitleContains("");
        assertThat(s.getValue(By.name("username"))).isEqualTo("user2");

        s.type(By.name("password"), "user2");
        s.click(By.id("submit_btn"));

        // ?
        s.waitForTitleContains("?");

        // 
        s.open("/logout");
    }

    @Test
    public void inputInValidateValue() {
        s.open("/register");
        s.click(By.id("submit_btn"));

        assertThat(s.getText(By.xpath("//fieldset/div/div/span"))).isEqualTo("");
    }

}