1 | package br.gov.serpro.cte.email.listar; |
---|
2 | |
---|
3 | import org.junit.Test; |
---|
4 | |
---|
5 | import br.gov.serpro.cte.common.ExpressoMailTestCase; |
---|
6 | |
---|
7 | /** |
---|
8 | * @author L.F.Estivalet (Serpro) |
---|
9 | * |
---|
10 | * Created on Nov 16, 2010 at 2:57:35 PM |
---|
11 | * |
---|
12 | */ |
---|
13 | public class ListarEmailsImportantesTestCase extends ExpressoMailTestCase { |
---|
14 | |
---|
15 | /** |
---|
16 | * Teste quando nao tem nenhum mensagem importante na pasta. |
---|
17 | * |
---|
18 | * @throws Exception |
---|
19 | */ |
---|
20 | @Test |
---|
21 | public void testaLerEmailsImportantesSemEmail() throws Exception { |
---|
22 | super.enterExpressoMail(); |
---|
23 | // Abre uma pasta onde nao existam emails marcados como importante. |
---|
24 | super.openFolder("lINBOX/Seleniumtree_folders"); |
---|
25 | selenium.click("span_flag_FLAGGED"); |
---|
26 | super.waitForElement("msg_info"); |
---|
27 | assertTrue(Mensagem.PASTA_VAZIA.getValue().equals( |
---|
28 | selenium.getText("msg_info"))); |
---|
29 | |
---|
30 | } |
---|
31 | |
---|
32 | @Test |
---|
33 | public void testaLerEmailsImportantes() throws Exception { |
---|
34 | super.enterExpressoMail(); |
---|
35 | selenium.click("span_flag_FLAGGED"); |
---|
36 | super.waitForElement("//div[@id='divScrollMain_0']/table[@id='table_box']/tbody[@id='tbody_box']/tr[1]/td[1]/input[1]"); |
---|
37 | |
---|
38 | // TODO Deve ter um jeito melhor de fazer isso, mas nao consegui pegar o |
---|
39 | // numero total de mensagens apos filtrar pelas mensagens importantes. |
---|
40 | // Se nao colocar o comando abaixo, ele continua pegando o numero de |
---|
41 | // mensagens totais e nao apenas as importantes. |
---|
42 | super.dummyWait(); |
---|
43 | |
---|
44 | // Busca todos os IDs dos emails apos aplicar o filtro "Importante". |
---|
45 | String[] t = super.getEmailIds(); |
---|
46 | |
---|
47 | boolean ok = true; |
---|
48 | // Verifica se todas as mensagens estao marcadas como "Importante". |
---|
49 | for (int i = 0; i < t.length; i++) { |
---|
50 | if (!super.isImportant(t[i])) { |
---|
51 | ok = false; |
---|
52 | break; |
---|
53 | } |
---|
54 | |
---|
55 | } |
---|
56 | assertTrue(ok); |
---|
57 | } |
---|
58 | } |
---|