2
respostas

Teste falha

package Caelum;

import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class UsuariosSystemTest {
    private FirefoxDriver driver;

    @Before
    public void inicializa() {
        System.setProperty("webdriver.gecko.driver", "c:\\geckodriver.exe");
        driver = new FirefoxDriver();
    }

    @Test
    public void deveAdicionarUmUsuario() {
        driver.get("http://localhost:8080/usuarios");
        driver.findElement(By.linkText("Novo Usúario")).click();


        WebElement nome = driver.findElement(By.name("usuario.nome"));
        WebElement email = driver.findElement(By.name("usuario.email"));

        nome.sendKeys("Jackson Praia Brandão");
        email.sendKeys("jacksonbrandaobr@gmail.com");

        WebElement botaoSalvar = driver.findElement(By.id("btnSalvar"));
        botaoSalvar.click();

        // garantir que Ronaldo foi adicionado!
        boolean achouNome = driver.getPageSource().contains("Jackson Praia Brandão");
        boolean achouEmail = driver.getPageSource().contains("jacksonbrandaobr@gmail.com");


        assertTrue(achouNome);
        assertTrue(achouEmail);
    }

    @After
    public void finaliza() {
        driver.close();
    }
}

------------ MENSAGEM DE ERRO -----------

1510657809504    geckodriver    INFO    geckodriver 0.19.1
1510657809509    geckodriver    INFO    Listening on 127.0.0.1:31449
1510657810204    mozrunner::runner    INFO    Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\JACKSO~1.BRA\\AppData\\Local\\Temp\\rust_mozprofile.jikFCHuGa6ks"
1510657810358    addons.xpi    WARN    Error parsing extensions state: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [amIAddonManagerStartup.readStartupData]"  nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)"  location: "JS frame :: resource://gre/modules/addons/XPIProvider.jsm :: loadExtensionState :: line 1554"  data: no] Stack trace: loadExtensionState()@resource://gre/modules/addons/XPIProvider.jsm:1554 < getInstallState()@resource://gre/modules/addons/XPIProvider.jsm:1589 < checkForChanges()@resource://gre/modules/addons/XPIProvider.jsm:3109 < startup()@resource://gre/modules/addons/XPIProvider.jsm:2188 < callProvider()@resource://gre/modules/AddonManager.jsm:269 < _startProvider()@resource://gre/modules/AddonManager.jsm:739 < startup()@resource://gre/modules/AddonManager.jsm:906 < startup()@resource://gre/modules/AddonManager.jsm:3090 < observe()@jar:file:///C:/Program%20Files/Mozilla%20Firefox/omni.ja!/components/addonManager.js:65
1510657811015    Marionette    INFO    Enabled via --marionette
Unable to read VR Path Registry from C:\Users\jackson.brandao\AppData\Local\openvr\openvrpaths.vrpath
[Parent 1680] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1510657812937    Marionette    INFO    Listening on port 50365
1510657813321    Marionette    WARN    TLS certificate errors will be ignored for this session
1510657813359    Marionette    DEBUG    Register listener.js for window 4294967297
nov 14, 2017 7:10:13 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMAÇÕES: Detected dialect: W3C
1510657813413    Marionette    DEBUG    Received DOM event "beforeunload" for "about:blank"
1510657813455    Marionette    DEBUG    Received DOM event "pagehide" for "about:blank"
1510657813455    Marionette    DEBUG    Received DOM event "unload" for "about:blank"
1510657813827    Marionette    DEBUG    Received DOM event "DOMContentLoaded" for "http://localhost:8080/usuarios"
1510657814044    Marionette    DEBUG    Received DOM event "pageshow" for "http://localhost:8080/usuarios"
2 respostas

Oi Jackson, tudo bem ?

O sistema está rodando ?

Pelo erro, parece que ele não encontrou nada na página.

Tudo otimo, Sim, esta rodando. No código esta tudo certo, ele deveria encontrar.