[3478] | 1 | /** |
---|
| 2 | * Autor : Alexandre Correia - alexandrecorreia@celepar.pr.gov.br |
---|
| 3 | * Data : 00/00/0000 |
---|
| 4 | * Caso de Teste : EL-941 : Adicionar compromisso Com Alarme |
---|
| 5 | * |
---|
| 6 | * Descrição do Processo de Teste Cadastro no TestLink - http://testlink.expressolivre.org/ |
---|
| 7 | * |
---|
| 8 | * AÇÕES DO PASSO |
---|
| 9 | * P01. Usuário informa um título para o compromisso; |
---|
| 10 | * P02. Usuário seleciona na opção alarme, o tempo que deseja ser avisado previamente da ocorrência do compromisso |
---|
| 11 | * P03. Usuário clica na opção para salvar o compromisso; |
---|
| 12 | * P04. Sistema salva o compromisso e retorna para a tela da agenda de compromissos utilizando a visualização padrão configurada nas preferências do Usuário |
---|
| 13 | * P05. Sistema exibe o compromisso no dia selecionado pelo usuário mostrando o horário inicial e final, o título do compromisso, descrição e local além de um símbolos indicando que esse compromisso é evento único, que tem apenas um participante e que esse compromisso foi configurado para disparar um alarme |
---|
| 14 | * P06. Sistema irá mandar uma mensagem para o Usuário sobre o início do compromisso, quando o momento informado em P02 chegar |
---|
| 15 | */ |
---|
| 16 | |
---|
| 17 | package br.gov.serpro.cte.agenda.casoteste; |
---|
| 18 | |
---|
| 19 | import java.util.GregorianCalendar; |
---|
| 20 | |
---|
| 21 | import org.junit.After; |
---|
| 22 | import org.junit.Before; |
---|
| 23 | import org.junit.Test; |
---|
| 24 | |
---|
| 25 | import br.gov.serpro.cte.agenda.Objetos.AdicionarCompromissoEL941.Campo; |
---|
| 26 | import br.gov.serpro.cte.agenda.Objetos.AdicionarCompromissoEL941.Valor; |
---|
| 27 | import br.gov.serpro.cte.connection.DAOSelenium; |
---|
| 28 | import br.gov.serpro.cte.connection.LoginExpresso; |
---|
| 29 | |
---|
| 30 | import com.thoughtworks.selenium.SeleneseTestCase; |
---|
| 31 | |
---|
| 32 | public class Test_EL_941_AdicionarCompromissoComAlarme extends SeleneseTestCase |
---|
| 33 | { |
---|
| 34 | @Before |
---|
| 35 | public void setUp() throws Exception |
---|
| 36 | { |
---|
| 37 | String url = "https://cte.serpro.gov.br"; |
---|
| 38 | DAOSelenium conn = new DAOSelenium( "localhost", 4444, "*pifirefox", url); |
---|
| 39 | selenium = conn.newConnection(); |
---|
| 40 | } |
---|
| 41 | @Test |
---|
| 42 | public void testa() |
---|
| 43 | { |
---|
| 44 | // Logando No Expresso |
---|
| 45 | selenium.open("/login.php"); |
---|
| 46 | selenium.type("user", LoginExpresso.USER_EXPRESSO.getValue()); |
---|
| 47 | selenium.type("passwd", LoginExpresso.PASSWORD_EXPRESSO.getValue()); |
---|
| 48 | selenium.click("submitit"); |
---|
| 49 | selenium.waitForPageToLoad("30000"); |
---|
| 50 | selenium.click("//html/body/div[@id='toolbar']/table/tbody/tr/td[2]/table/tbody/tr/td[3]/a/img[@id='calendarid']"); |
---|
| 51 | |
---|
| 52 | // Data |
---|
| 53 | GregorianCalendar gc = new GregorianCalendar(); |
---|
| 54 | String Dia = String.valueOf( gc.get( gc.DAY_OF_MONTH ) ); |
---|
| 55 | Dia = ( Dia.length() > 1 ) ? Dia : "0"+Dia; |
---|
| 56 | |
---|
| 57 | String Mes = String.valueOf( gc.get( gc.MONTH ) + 1 ); |
---|
| 58 | |
---|
| 59 | String Ano = String.valueOf( gc.get( gc.YEAR ) ); |
---|
| 60 | |
---|
| 61 | //Adicionando um Evento |
---|
| 62 | selenium.open("/index.php?date=" + Ano + Mes + Dia + "&menuaction=calendar.uicalendar.week"); |
---|
| 63 | selenium.click("//img[@title='Nova Entrada']"); |
---|
| 64 | selenium.waitForPageToLoad("30000"); |
---|
| 65 | |
---|
| 66 | for( Campo cmp : Campo.values() ) |
---|
| 67 | { |
---|
| 68 | String cmpName = cmp.name(); |
---|
| 69 | |
---|
| 70 | if( cmp.getValue().indexOf("addSelection:") > -1 ) |
---|
| 71 | { |
---|
| 72 | AddSelection( cmp.getValue(), getValor( cmp.name() ) ); |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | if( cmp.getValue().indexOf("click:") > -1 ) |
---|
| 76 | { |
---|
| 77 | Click( cmp.getValue() ); |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | if( cmp.getValue().indexOf("select:") > -1 ) |
---|
| 81 | { |
---|
| 82 | Select( cmp.getValue(), getValor( cmp.name() ) ); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | if( cmp.getValue().indexOf("type:") > -1 ) |
---|
| 86 | { |
---|
| 87 | Type( cmp.getValue(), getValor( cmp.name() ) ); |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | selenium.waitForPageToLoad("15000"); |
---|
| 92 | |
---|
| 93 | // Verifica a hora Inicial e final do Compromisso |
---|
| 94 | assertTrue( selenium.isTextPresent(Valor.HORA_INICIO.getValue() + ":" + Valor.MINUTO_INICIO.getValue() + |
---|
| 95 | "-" + Valor.HORA_FINAL.getValue() + ":" + Valor.MINUTO_FINAL.getValue())); |
---|
| 96 | |
---|
| 97 | // Verifica o Titulo do Compromisso |
---|
| 98 | assertTrue( selenium.isTextPresent(Valor.TITULO.getValue()) ); |
---|
| 99 | |
---|
| 100 | // Verifica a Descricao do Compromisso |
---|
| 101 | assertTrue( selenium.isTextPresent(Valor.DESCRICAO.getValue()) ); |
---|
| 102 | |
---|
| 103 | // Verifica Alarme |
---|
| 104 | assertTrue( selenium.getHtmlSource().contains("/calendar/templates/default/images/alarm.png")); |
---|
| 105 | |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | public String getValor(String cmpName) |
---|
| 109 | { |
---|
| 110 | String _return = ""; |
---|
| 111 | |
---|
| 112 | for( Valor vlr : Valor.values() ) |
---|
| 113 | { |
---|
| 114 | String vlrName = vlr.name(); |
---|
| 115 | |
---|
| 116 | if( vlrName.equals( cmpName ) ) |
---|
| 117 | { |
---|
| 118 | _return = vlr.getValue(); |
---|
| 119 | } |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | return _return; |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | public void AddSelection( String locator, String optionLocator ) |
---|
| 126 | { |
---|
| 127 | selenium.addSelection( locator.substring( 13 , locator.length() ), optionLocator ); |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | public void Click( String locator ) |
---|
| 131 | { |
---|
| 132 | selenium.click( locator.substring( 6 , locator.length() ) ); |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | public void Select( String selectLocator, String optionLocator ) |
---|
| 136 | { |
---|
| 137 | selenium.select( selectLocator.substring( 7 , selectLocator.length() ), optionLocator ); |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | public void Type( String locator, String value ) |
---|
| 141 | { |
---|
| 142 | selenium.type( locator.substring( 5 , locator.length() ), value ); |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | @After |
---|
| 146 | public void tearDown() throws Exception |
---|
| 147 | { |
---|
| 148 | selenium.close(); |
---|
| 149 | } |
---|
| 150 | } |
---|