Changeset 4344
- Timestamp:
- 05/11/11 15:25:35 (13 years ago)
- Location:
- devel/testlink/automation2.0
- Files:
-
- 12 added
- 26 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
devel/testlink/automation2.0/.classpath
r3663 r4344 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <classpath> 3 <classpathentry kind="src" output="target/test-classes" path="src/test/java"/> 4 <classpathentry including="**" kind="src" output="target/test-classes" path="src/test/resources"/> 3 5 <classpathentry kind="src" output="target/classes" path="src/main/java"/> 4 6 <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/> 5 <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>6 <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>7 7 <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> 8 8 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> -
devel/testlink/automation2.0/.settings/org.eclipse.jdt.core.prefs
r3663 r4344 1 # Fri Nov 26 10:04:47 BRST 20101 #Tue Apr 19 15:24:55 BRT 2011 2 2 eclipse.preferences.version=1 3 3 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 4 4 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 5 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 6 org.eclipse.jdt.core.compiler.compliance=1.6 7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 org.eclipse.jdt.core.compiler.debug.sourceFile=generate 6 10 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 7 11 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -
devel/testlink/automation2.0/[FUN02.1] - ComporMensagem.xml
r3853 r4344 15 15 <classes> 16 16 <class name="org.expressolivre.cte.email.compor.EnviarEmailTestCase" /> 17 <class name="org.expressolivre.cte.email.compor.EnviarEmailCorpo100TestCase" /> 17 18 <class name="org.expressolivre.cte.email.compor.EnviarEmailAnexoTestCase" /> 19 <class name="org.expressolivre.cte.email.compor.RemoverAnexoTestCase" /> 18 20 <class name="org.expressolivre.cte.email.compor.EnviarEmailConfirmacaoLeituraTestCase" /> 19 21 <class name="org.expressolivre.cte.email.compor.EnviarEmailCopiaOcultaTestCase" /> … … 46 48 </classes> 47 49 </test> 48 50 49 51 <test name="Apagar rascunhos" preserve-order="true"> 50 52 <parameter name="folder" value="lINBOX/Draftstree_folders"/> -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/common/Config.java
r4057 r4344 18 18 private Properties valores; 19 19 private Properties emailPreferences; 20 private Properties emailAdminPreferences; 20 21 21 22 private Config() { … … 25 26 this.valores = this.load("valores.properties"); 26 27 this.emailPreferences = this.load(getConfig("config.email")); 28 this.emailAdminPreferences = this 29 .load(getConfig("config.email.admin")); 27 30 } catch (Exception e) { 28 31 e.printStackTrace(); … … 59 62 } 60 63 64 public String getEmailAdminPreference(String key) { 65 return this.emailAdminPreferences.getProperty(key); 66 } 67 61 68 private Properties load(String propsName) throws Exception { 62 69 Properties props = new Properties(); -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/common/Constants.java
r3853 r4344 14 14 public static final String URL_PREFERENCES_EMAIL = URL_PREFERENCES 15 15 + "/preferences.php?appname=expressoMail1_2"; 16 public static final String URL_DEFAULT_PREFERENCES_EMAIL = URL_PREFERENCES 17 + "/preferences.php?appname=expressoMail1_2&type=default"; 18 public static final String URL_FORCED_PREFERENCES_EMAIL = URL_PREFERENCES 19 + "/preferences.php?appname=expressoMail1_2&type=forced"; 16 20 public static final String USER = Config.getInstance().getConfig("user"); 17 21 public static final String PASS = Config.getInstance().getConfig("passwd"); … … 27 31 public static final String EMAIL_ASSUNTO = Config.getInstance().getValor( 28 32 "assunto"); 33 public static final String EMAIL_ASSUNTO_TEXTO_100k = Config.getInstance() 34 .getValor("assunto.100k"); 29 35 public static final String EMAIL_ASSUNTO_IMPORTANTE = Config.getInstance() 30 36 .getValor("assunto.importante"); -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/common/PreferencesTestCase.java
r3789 r4344 1 1 package org.expressolivre.cte.common; 2 2 3 import org.expressolivre.cte.pages.email.ExpressoMailAdminPreferencesPage; 3 4 import org.expressolivre.cte.pages.email.ExpressoMailPreferencesPage; 4 5 import org.openqa.selenium.support.PageFactory; … … 23 24 } 24 25 26 /** 27 * Abre pagina de preferencias administrativas do modulo ExpressoMail. 28 * 29 * @return 30 */ 31 public ExpressoMailAdminPreferencesPage openEmailAdminPreferencesPage() { 32 driver.get(URL_PREFERENCES_EMAIL); 33 return PageFactory.initElements(driver, 34 ExpressoMailAdminPreferencesPage.class); 35 } 36 37 /** 38 * Abre pagina de preferencias administrativas do modulo ExpressoMail. 39 * 40 * @return 41 */ 42 public ExpressoMailAdminPreferencesPage openEmailAdminDefaultPreferencesPage() { 43 driver.get(URL_DEFAULT_PREFERENCES_EMAIL); 44 return PageFactory.initElements(driver, 45 ExpressoMailAdminPreferencesPage.class); 46 } 47 48 /** 49 * Abre pagina de preferencias administrativas do modulo ExpressoMail. 50 * 51 * @return 52 */ 53 public ExpressoMailAdminPreferencesPage openEmailAdminForcedPreferencesPage() { 54 driver.get(URL_FORCED_PREFERENCES_EMAIL); 55 return PageFactory.initElements(driver, 56 ExpressoMailAdminPreferencesPage.class); 57 } 58 25 59 } -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/DescartarEmailTestCase.java
r3853 r4344 24 24 * testcase&id=EL-1240 25 25 * 26 * TODO NAO RODAR! Pendente unificacao com comunidade (09-Mai-11) 27 * 26 28 * @author L.F.Estivalet (Serpro) 27 29 * 28 30 * Created on Feb 23, 2011 at 3:10:58 PM 29 *30 31 */ 31 32 public class DescartarEmailTestCase extends BaseEmailTestCase { … … 34 35 * Executa o teste. Testa os botoes Cancelar e Descartar nova mensagem. 35 36 */ 36 @Test 37 @Test(enabled = false) 37 38 public void testCancelDiscard() { 38 39 mp.composeEmail(EMAIL_TESTE_1, EMAIL_ASSUNTO, EMAIL_TEXTO); … … 43 44 } 44 45 45 @Test 46 @Test(enabled = false) 46 47 public void testSalvar() { 47 48 mp.composeEmail(EMAIL_TESTE_1, EMAIL_ASSUNTO_SALVAR, EMAIL_TEXTO_SALVAR); -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailAnexoTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 22 23 /** 23 24 * Executa o teste. Envia mensagem para email, assunto, texto e anexo 24 * pre-definidos no arquivo de configuracao. 25 * pre-definidos no arquivo de configuracao. Apos envio, verifica se o email 26 * foi movido para a pasta de emails enviados. 25 27 */ 26 28 @Test … … 30 32 mp.sendMail(); 31 33 mp.assertMessage(MSG_EMAIL_ENVIADO); 34 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 35 EMAIL_ASSUNTO_ANEXO)); 36 32 37 } 33 38 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailConfirmacaoLeituraTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 22 23 /** 23 24 * Executa o teste. Envia mensagem para email, assunto e texto pre-definidos 24 * no arquivo de configuracao com confirmacao de leitura. 25 * no arquivo de configuracao com confirmacao de leitura. Apos envio, 26 * verifica se o email foi movido para a pasta de emails enviados. 25 27 */ 26 28 @Test … … 31 33 mp.sendMail(); 32 34 mp.assertMessage(MSG_EMAIL_ENVIADO); 35 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 36 EMAIL_ASSUNTO_LEITURA)); 33 37 } 34 38 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailCopiaOcultaTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 12 13 * Link: http://testlink.expressolivre.org/linkto.php?tprojectPrefix=EL&item= 13 14 * testcase&id=EL-526 14 15 * 15 16 * @author L.F.Estivalet (Serpro) 16 17 * … … 22 23 /** 23 24 * Executa o teste. Envia mensagem para email, assunto e texto pre-definidos 24 * no arquivo de configuracao com copia oculta. 25 * no arquivo de configuracao com copia oculta. Apos envio, verifica se o 26 * email foi movido para a pasta de emails enviados. 25 27 */ 26 28 @Test 27 29 public void test() { 28 30 mp.composeEmail(EMAIL_TESTE_1, EMAIL_ASSUNTO_COPIA_OCULTA, 29 EMAIL_ TEXTO_COPIA_OCULTA);31 EMAIL_ASSUNTO_COPIA_OCULTA); 30 32 mp.setBlindCarbonCopy(EMAIL_TESTE_2); 31 33 mp.sendMail(); 32 34 mp.assertMessage(MSG_EMAIL_ENVIADO); 35 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 36 EMAIL_ASSUNTO_COPIA_OCULTA)); 33 37 } 34 38 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailCopiaTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 22 23 /** 23 24 * Executa o teste. Envia mensagem para email, assunto e texto pre-definidos 24 * no arquivo de configuracao com copia. 25 * no arquivo de configuracao com copia. Apos envio, verifica se o email foi 26 * movido para a pasta de emails enviados. 25 27 */ 26 28 @Test … … 30 32 mp.sendMail(); 31 33 mp.assertMessage(MSG_EMAIL_ENVIADO); 34 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 35 EMAIL_ASSUNTO_COPIA)); 32 36 } 33 37 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailDestinatarioInvalidoTestCase.java
r3782 r4344 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 4 import org.testng.annotations.Test; 5 6 5 7 6 /** … … 12 11 * Link: http://testlink.expressolivre.org/linkto.php?tprojectPrefix=EL&item= 13 12 * testcase&id=EL-534 13 * 14 * TODO NAO RODAR! Pendente unificacao com comunidade (09-Mai-11) 14 15 * 15 16 * @author L.F.Estivalet (Serpro) … … 23 24 * Executa o teste. Tentativa de enviar mensagem para email invalido. 24 25 */ 25 @Test 26 @Test(enabled = false) 26 27 public void test() { 27 28 mp.composeEmail(EMAIL_INVALIDO, EMAIL_ASSUNTO, EMAIL_TEXTO); -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailImportanteTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 21 22 22 23 /** 23 * Executa o teste. Envia um email importante. 24 * Executa o teste. Envia um email importante. Apos envio, verifica se o 25 * email foi movido para a pasta de emails enviados. 24 26 */ 25 27 @Test … … 30 32 mp.sendMail(); 31 33 mp.assertMessage(MSG_EMAIL_ENVIADO); 34 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 35 EMAIL_ASSUNTO_IMPORTANTE)); 32 36 } 33 37 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailMultiplosAnexosTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 12 13 * Link: http://testlink.expressolivre.org/linkto.php?tprojectPrefix=EL&item= 13 14 * testcase&id=EL-530 14 15 * 15 16 * @author L.F.Estivalet (Serpro) 16 17 * … … 21 22 22 23 /** 23 * Executa o teste. Envia um email com multiplos anexos. 24 * Executa o teste. Envia um email com multiplos anexos. Apos envio, 25 * verifica se o email foi movido para a pasta de emails enviados. 24 26 */ 25 27 @Test … … 31 33 mp.sendMail(); 32 34 mp.assertMessage(MSG_EMAIL_ENVIADO); 35 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 36 EMAIL_ASSUNTO_MULTIPLOS_ANEXOS)); 33 37 } 34 38 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailMultiplosDestinatariosTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 22 23 23 24 /** 24 * Executa o teste. Envia um email para multiplos destinatarios. 25 * Executa o teste. Envia um email para multiplos destinatarios. Apos envio, 26 * verifica se o email foi movido para a pasta de emails enviados. 25 27 */ 26 28 @Test … … 31 33 mp.sendMail(); 32 34 mp.assertMessage(MSG_EMAIL_ENVIADO); 35 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 36 EMAIL_ASSUNTO_MULTIPLOS_DESTINATARIOS)); 37 33 38 } 34 39 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailRascunhoTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 23 24 24 25 /** 25 * Esse caso de teste eh dependente do SalvarEmailTestCase 26 * Esse caso de teste eh dependente do SalvarEmailTestCase. Apos envio, 27 * verifica se o email foi movido para a pasta de emails enviados. 26 28 */ 27 29 @Test … … 32 34 mp.sendMail(id); 33 35 mp.assertMessage(MSG_EMAIL_ENVIADO); 36 mp.closeMail(id + "_r", false); 37 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 38 EMAIL_ASSUNTO_SALVAR)); 34 39 } 35 40 } -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailSemDestinatarioTestCase.java
r3782 r4344 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 4 import org.testng.annotations.Test; 5 6 5 7 6 /** … … 12 11 * Link: http://testlink.expressolivre.org/linkto.php?tprojectPrefix=EL&item= 13 12 * testcase&id=EL-535 13 * 14 * TODO NAO RODAR! Pendente unificacao com comunidade (09-Mai-11) 14 15 * 15 16 * @author L.F.Estivalet (Serpro) … … 23 24 * Executa teste. 24 25 */ 25 @Test 26 @Test(enabled = false) 26 27 public void test() { 27 28 mp.composeEmail("", EMAIL_ASSUNTO, EMAIL_TEXTO); -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailSomenteCopiaOcultaTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 22 23 23 24 /** 24 * Executa o teste. 25 * Executa o teste. Apos envio, verifica se o email foi movido para a pasta 26 * de emails enviados. 25 27 */ 26 28 @Test … … 32 34 mp.sendMail(); 33 35 mp.assertMessage(MSG_EMAIL_ENVIADO); 36 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 37 EMAIL_ASSUNTO_SOMENTE_COPIA_OCULTA)); 34 38 } 35 39 } -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailSomenteCopiaTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 31 32 mp.sendMail(); 32 33 mp.assertMessage(MSG_EMAIL_ENVIADO); 34 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 35 EMAIL_ASSUNTO_SOMENTE_COPIA)); 36 33 37 } 34 38 } -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/EnviarEmailTestCase.java
r3782 r4344 2 2 3 3 import org.expressolivre.cte.common.BaseEmailTestCase; 4 import org.expressolivre.cte.pages.email.MailPage; 5 import org.testng.Assert; 4 6 import org.testng.annotations.Test; 5 6 7 7 8 /** … … 22 23 /** 23 24 * Executa o teste. Envia mensagem para email, assunto e texto pre-definidos 24 * no arquivo de configuracao. 25 * no arquivo de configuracao. Apos envio, verifica se o email foi movido 26 * para a pasta de emails enviados. 25 27 */ 26 28 @Test … … 29 31 mp.sendMail(); 30 32 mp.assertMessage(MSG_EMAIL_ENVIADO); 33 Assert.assertNotNull(mp.findEmailIdBySubject(MailPage.SENT_FOLDER, 34 EMAIL_ASSUNTO)); 31 35 } 32 36 } -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/SalvarEmailSomenteCopiaOcultaTestCase.java
r3853 r4344 48 48 int spanOpen = body.indexOf("<span>") + 7; 49 49 int spanClose = body.lastIndexOf("</span>") - 1; 50 body = body.substring(spanOpen, spanClose) ;50 body = body.substring(spanOpen, spanClose).trim(); 51 51 Assert.assertEquals(EMAIL_TEXTO_SALVAR_SOMENTE_COPIA_OCULTA, body); 52 52 53 mp.closeMail(id );53 mp.closeMail(id, false); 54 54 } 55 55 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/email/compor/SalvarEmailSomenteCopiaTestCase.java
r3853 r4344 47 47 int spanOpen = body.indexOf("<span>") + 7; 48 48 int spanClose = body.lastIndexOf("</span>") - 1; 49 body = body.substring(spanOpen, spanClose); 49 body = body.substring(spanOpen, spanClose).trim(); 50 50 51 Assert.assertEquals(EMAIL_TEXTO_SALVAR_SOMENTE_COPIA, body); 51 52 52 mp.closeMail(id );53 mp.closeMail(id, false); 53 54 } 54 55 -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/common/Page.java
r3782 r4344 86 86 } 87 87 88 public boolean isNotDisplayed(RenderedWebElement e) { 89 // Up to 10 times 90 for (int i = 0; i < 10; i++) { 91 // Check whether our element is visible yet 92 if (!e.isDisplayed()) { 93 return true; 94 } 95 96 try { 97 Thread.sleep(1000); 98 } catch (InterruptedException ex) { 99 // Try again 100 } 101 } 102 return false; 103 } 104 88 105 /** 89 106 * @param id -
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/email/MailPage.java
r3853 r4344 19 19 public class MailPage extends Page { 20 20 21 /** Botao para criar novo email. */ 21 22 @FindBy(xpath = "//table[@id='folders_tbl']/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span") 22 23 private WebElement newEmail; 23 24 25 /** Campo "Para:". */ 24 26 @FindBy(id = "to_1") 25 27 private WebElement to; 26 28 29 /** Campo "Assunto:". */ 27 30 @FindBy(id = "subject_1") 28 31 private WebElement subject; 29 32 33 /** Botao para enviar email. */ 30 34 @FindBy(id = "send_button_1") 31 35 private WebElement send; 32 36 37 /** Flag de importante no momento de compor um email. */ 33 38 @FindBy(id = "important_message_1") 34 /** Flag de importante no momento de compor um email. */35 39 private WebElement important; 36 40 41 /** Flag de importante de um email aberto. */ 37 42 @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[1]/td[2]/span[3]") 38 /** Flag de importante de um email aberto. */39 43 private WebElement importantFlag; 40 44 45 /** Filtra emails importantes. */ 41 46 @FindBy(id = "span_flag_FLAGGED") 42 /** Filtra emails importantes. */43 47 private WebElement importantFilter; 44 48 49 /** Flag normal de um email aberto. */ 45 50 @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[1]/td[2]/span[3]") 46 51 private WebElement normalFlag; 47 52 53 /** Flag nao lido de um email aberto. */ 48 54 @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[1]/td[2]/span[2]") 49 55 private WebElement notReadFlag; 50 56 57 /** Checkbox de confirmacao de leitura. */ 51 58 @FindBy(id = "return_receipt_1") 52 59 private WebElement returnReceipt; 53 60 61 /** Link para acionar exibicao do campo copia oculta Cco. */ 54 62 @FindBy(id = "a_cco_link_1") 55 63 private WebElement blindCarbonCopyLink; 56 64 65 /** Campo copia oculta "Cco:". */ 57 66 @FindBy(id = "cco_1") 58 67 private WebElement blindCarbonCopy; 59 68 69 /** Link para acionar exibicao do campo copia Cc. */ 60 70 @FindBy(id = "a_cc_link_1") 61 71 private WebElement carbonCopyLink; 62 72 73 /** Campo copia "Cc:". */ 63 74 @FindBy(id = "cc_1") 64 75 private WebElement carbonCopy; 65 76 77 /** Link para salvar email. */ 66 78 @FindBy(id = "save_message_options_1") 67 79 private WebElement saveEmail; 68 80 81 /** Link para adicionar anexos ao email. */ 69 82 @FindBy(linkText = "Anexos: adicionar+") 70 83 private WebElement attachmentLink; 71 84 85 /** Link para adicionar 1o anexo. */ 72 86 @FindBy(id = "inputFile_1_1") 73 87 private WebElement attachment; 74 88 89 /** Link para adicionar 2o anexo. */ 75 90 @FindBy(id = "inputFile_1_2") 76 91 private WebElement attachment2; 77 92 93 /** Link para remover anexo. */ 94 @FindBy(id = "linkFile_1_1") 95 private WebElement removeAttachmentLink; 96 97 /** Link para apagar email quando este estiver aberto. */ 78 98 @FindBy(xpath = "//div[@id='footer_menu']/table[@id='footer_box']/tbody/tr[@id='table_message']/td[@id='span_options']/span[1]/span") 79 99 private WebElement deleteEmailLink; 80 100 101 /** Link para pasta lixeira. */ 81 102 @FindBy(id = "lINBOX/Trashtree_folders") 82 103 private WebElement trashFolder; 83 104 105 /** Link para limpar lixeira. */ 84 106 @FindBy(id = "empty_trash") 85 107 private WebElement emptyTrashLink; … … 88 110 private WebElement emailsListDiv; 89 111 112 /** Campo contendo total de emails de uma pasta. */ 90 113 @FindBy(id = "tot_m") 91 114 private WebElement totalEmails; … … 94 117 private WebElement emailTab; 95 118 119 /** Checkbox para selecao de todos emails de uma pasta. */ 96 120 @FindBy(id = "chk_box_select_all_messages") 97 121 private WebElement selectAllEmails; 98 122 123 /** Link para acionar o menu Ferramentas. */ 99 124 @FindBy(xpath = "//td[@id='link_tools']/div/span") 100 125 private WebElement toolsMenu; … … 116 141 private WebElement moveEmailButton; 117 142 143 /** Link para encaminhar em email aberto. */ 118 144 @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[1]/td[3]/span[3]") 119 145 private WebElement forwardEmail; 120 146 147 /** Link para responder em email aberto. */ 121 148 @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[1]/td[3]/span[5]") 122 149 private WebElement replyEmail; 123 150 151 /** Link para responder a todos em email aberto. */ 124 152 @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span[1]") 125 153 private WebElement replyAllEmail; 126 154 155 /** Link para responder sem historico em email aberto. */ 127 156 @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span[2]") 128 157 private WebElement replyEmailWithoutHistory; 129 158 159 /** Link para responder a todos sem historico em email aberto. */ 130 160 @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr[2]/td/div/span[3]") 131 161 private WebElement replyAllEmailWithoutHistory; 132 162 163 /** Link para editar email na pasta de rascunhos. */ 133 164 @FindBy(xpath = "//div[@id='exmail_main_body']/div[2]/table/tbody/tr[1]/td/table/tbody/tr/td[2]/span[2]/span[1]") 134 165 private WebElement editEmail; … … 140 171 private WebElement discardNewEmail; 141 172 173 /** 174 * Esse botao eh no alerta ao fechar uma mensagem nao salva e nao o botao 175 * salvar para rascunhos. 176 */ 142 177 @FindBy(xpath = "//div[@id='lertContainer']/div[@id='lertWindow']/div[@id='lertButtons']/a[3]") 143 /** Esse botao eh no alerta ao fechar uma mensagem nao salva e nao o botao salvar para rascunhos. */144 178 private WebElement saveNewEmail; 179 180 /** Nome da pasta "Caixa de Entrada". */ 181 public static final String INBOX_FOLDER = "lINBOXtree_folders"; 182 183 /** Nome da pasta "Enviados". */ 184 public static final String SENT_FOLDER = "lINBOX/Senttree_folders"; 145 185 146 186 /** … … 151 191 } 152 192 193 /** 194 * Cria um novo email. 195 */ 153 196 public void createNewEmail() { 154 197 this.newEmail.click(); … … 156 199 } 157 200 201 /** 202 * Cancela criacao de novo email. 203 */ 158 204 public void cancelNewEmail() { 159 205 this.cancelNewEmail.click(); 160 206 } 161 207 208 /** 209 * Descarta criacao de novo email. 210 */ 162 211 public void discardNewEmail() { 163 212 this.discardNewEmail.click(); 164 213 } 165 214 215 /** 216 * Salva email na pasta rascunhos. 217 */ 166 218 public void saveNewEmail() { 167 219 this.saveNewEmail.click(); 168 220 } 169 221 222 /** 223 * Preenche campo assunto. 224 * 225 * @param subject 226 * Assunto a ser preenchido. 227 */ 170 228 public void setSubject(String subject) { 171 229 this.subject.sendKeys(subject != null ? subject : ""); 172 230 } 173 231 232 /** 233 * Preenche corpo (texto) do email. 234 * 235 * @param body 236 * Texto a ser preenchido. 237 */ 174 238 public void setBody(String body) { 175 239 // Foi o unico jeito que consegui pegar o richtexteditor... 176 240 if (body != null) { 241 // Troca CR&|LF por <br> 242 body = body.replaceAll("(\r\n|\r|\n|\n\r)", "<br>"); 177 243 ((JavascriptExecutor) driver) 178 244 .executeScript("document.getElementById('body_1').contentWindow.document.body.innerHTML='" … … 195 261 public String readEmail(String subject) { 196 262 // waitForElementByXpath("//div[@id='exmail_main_body']/table[1]/tbody[@id='border_tbody']/tr[1]/td[2]/table/tbody/tr/td[1]"); 197 String id = findEmailIdBySu ject(subject);263 String id = findEmailIdBySubject(subject); 198 264 id = id.substring(id.lastIndexOf("_") + 1); 199 265 clickElement(By.id("td_who_" + id)); … … 302 368 public void openFolder(String folder) { 303 369 clickElement(By.id(folder)); 370 // Espera pelo "Carregando..." aparecer. 371 waitForElement(By.id("divProgressBar")); 304 372 waitForElement(By.id("divScrollMain_0")); 373 // Espera pelo "Carregando..." desaparecer. 374 isNotDisplayed(this 375 .waitFindElement(By.id("divProgressBar"), 5000, 1000)); 305 376 waitForElement(By 306 377 .xpath("//div[@id='divScrollMain_0']/table[@id='table_box']/tbody[@id='tbody_box']/tr[1]/td[1]/input[1]")); … … 318 389 } 319 390 391 /** 392 * Filtra somente as mensagens importantes. 393 */ 320 394 public void setImportantFilter() { 321 395 this.importantFilter.click(); … … 337 411 } 338 412 413 /** 414 * Move email para um pasta no servidor. 415 * 416 * @param folderName 417 * Nome da pasta pre-existente no servidor. 418 */ 339 419 public void moveEmail(String folderName) { 340 420 this.moveEmailLink.click(); … … 343 423 } 344 424 425 /** 426 * Edita nome de pasta. 427 */ 345 428 public void editFolder() { 346 429 this.toolsMenu.click(); … … 350 433 } 351 434 435 /** 436 * Cria nova pasta. 437 * 438 * @param folderName 439 * Nome da pasta a ser criada. 440 */ 352 441 public void createNewFolder(String folderName) { 353 442 this.editFolder(); … … 359 448 } 360 449 450 /** 451 * Exclui pasta. 452 * 453 * @param folderName 454 * Nome da pasta a ser excluida. 455 */ 361 456 public void deleteFolder(String folderName) { 362 457 this.editFolder(); … … 377 472 } 378 473 474 /** 475 * Marca email como importante apos ler. 476 */ 379 477 public void setImportantFlag() { 380 478 this.waitForElement(By … … 383 481 } 384 482 483 /** 484 * Marca email como normal apos ler. 485 */ 385 486 public void setNormalFlag() { 386 487 this.waitForElement(By … … 389 490 } 390 491 492 /** 493 * Marca email como nao lido apos ler. 494 */ 391 495 public void setNotReadFlag() { 392 496 this.waitForElement(By … … 419 523 } 420 524 525 /** 526 * Seleciona todos emails da pasta corrente. 527 */ 421 528 public void selectAllEmails() { 422 529 this.selectAllEmails.click(); … … 456 563 } 457 564 565 /** 566 * Remove anexo do email sendo composto. 567 */ 568 public void removeAttachment() { 569 this.removeAttachmentLink.click(); 570 } 571 458 572 public void addAttachment2(String attachment) { 459 573 this.attachmentLink.click(); … … 476 590 477 591 /** 478 * @param checkAlert479 */ 480 public void closeMail(boolean checkAlert) {592 * @param discardEmail 593 */ 594 public void closeMail(boolean discardEmail) { 481 595 482 596 // Na versao Serpro: … … 489 603 super.clickElement(By.xpath("//td[@id='border_id_1']//img")); 490 604 491 if (checkAlert) { 492 Alert closeAlert = driver.switchTo().alert(); 493 closeAlert.accept(); 605 // if (checkAlert) { 606 // Alert closeAlert = driver.switchTo().alert(); 607 // closeAlert.accept(); 608 // } 609 610 // Clica em descartar. 611 if (discardEmail) { 612 super.clickElement(By 613 .xpath("//div[@id='lertWindow']/div[@id='lertButtons']/a[2]")); 494 614 } 495 615 } 496 616 497 public void closeMail(String id ) {617 public void closeMail(String id, boolean discardEmail) { 498 618 super.clickElement(By.xpath("//td[@id='border_id_" + id + "']//img")); 499 } 500 619 // Clica em cancelar 620 if (discardEmail) { 621 super.clickElement(By 622 .xpath("//div[@id='lertWindow']/div[@id='lertButtons']/a[2]")); 623 } 624 } 625 626 /** 627 * Envia email. 628 * 629 * @param id 630 * Id do email a ser enviado. 631 */ 501 632 public void sendMail(String id) { 502 633 super.findAndClickElement("send_button_" + id); … … 525 656 * @param select 526 657 * Se email encontrado, deseja seleciona-lo? 527 * @return "id" do email .658 * @return "id" do email se encontrar, <code>null</code> se nao encontrar. 528 659 */ 529 660 public String findEmailIdBySuject(String subject, boolean select) { 661 System.out.println("searching for --------->" + subject); 530 662 String html = driver.getPageSource(); 531 String part1 = StringUtils.substringBefore(html, subject); 532 int start = StringUtils.lastIndexOf(part1, "id=\"") + 4; 533 int last = StringUtils.indexOf(part1, "\"", start); 534 String id = StringUtils.substring(part1, start, last); 535 536 if (select) { 537 // Marca checkbox correspondente ao id da mensagem. 538 clickElement(By.id("check_box" + id.substring(1))); 663 // System.out.println(html.indexOf(subject)); 664 // System.out.println(html); 665 if (html.indexOf(subject) >= 0) { 666 String part1 = StringUtils.substringBefore(html, subject); 667 int start = StringUtils.lastIndexOf(part1, "id=\"") + 4; 668 int last = StringUtils.indexOf(part1, "\"", start); 669 String id = StringUtils.substring(part1, start, last); 670 System.out.println("******************"); 671 System.out.println("******************"); 672 System.out.println("******************"); 673 System.out.println("******************"); 674 System.out.println("******************"); 675 System.out.println("******************"); 676 System.out.println(id); 677 if (select) { 678 // Marca checkbox correspondente ao id da mensagem. 679 clickElement(By.id("check_box" + id.substring(1))); 680 } 681 return id; 539 682 } 540 return id;683 return null; 541 684 } 542 685 … … 570 713 } 571 714 572 public String findEmailIdBySuject(String subject) { 715 /** 716 * Procura email baseado no assunto na pasta corrente. 717 * 718 * @param subject 719 * Assunto a ser pesquisado. 720 * @return Id do email encontrado. 721 */ 722 public String findEmailIdBySubject(String subject) { 723 return findEmailIdBySuject(subject, false); 724 } 725 726 /** 727 * Procura email baseado no assunto em uma pasta especifica. 728 * 729 * @param folder 730 * Pasta de pesquisa. 731 * @param subject 732 * Assunto a ser pesquisado. 733 * @return Id do email encontrado. 734 */ 735 public String findEmailIdBySubject(String folder, String subject) { 736 this.openFolder(folder); 573 737 return findEmailIdBySuject(subject, false); 574 738 } … … 619 783 } 620 784 785 /** 786 * @param id 787 * Id do email. 788 * @return Texto do email. 789 */ 621 790 public Object getBody(String id) { 622 791 waitForElement(By.id("body_" + id)); -
devel/testlink/automation2.0/src/test/resources/config.properties
r4058 r4344 1 url=https://10.30.202.2052 user=teste1.mp3 passwd=teste1 #url=https://10.30.202.205 2 #user=teste1.mp 3 #passwd=teste 4 4 5 # Usuario normal 5 6 #url=https://cte.serpro.gov.br 6 7 #user=luiz-fernando.estivalet 7 8 #passwd=senha 8 9 9 config.email=email.preferences_mp.properties 10 # Usuario admin 11 url=https://cte.serpro.gov.br 12 user=expresso-admin 13 passwd=cte@comunidade 14 15 # Arquivo de configuracao a ser utilizado dependendo do servidor (url) acima 16 #config.email=email.preferences_mp.properties 17 config.email=email.preferences_comunidade_cte.properties 18 config.email.admin=email.admin.preferences.properties -
devel/testlink/automation2.0/src/test/resources/valores.properties
r4058 r4344 19 19 anexo.2=/home/luiz/Desktop/arquivo2.txt 20 20 assunto=[SELENIUM] Teste envio mensagem 21 assunto.100k=[SELENIUM] Teste envio mensagem corpo + 100k 21 22 assunto.salvar=[SELENIUM] Teste salvar mensagem 22 23 assunto.salvar.somente.copia=[SELENIUM] Teste salvar somente cópia … … 30 31 assunto.confirmacao.leitura=[SELENIUM] Teste com confirmação de leitura 31 32 assunto.copia=[SELENIUM] Teste envio mensagem com cópia 32 assunto.copia.oculta=[SELENIUM] Teste envio mensagem com cópia oculta 33 assunto.copia.oculta=[SELENIUM] Teste envio mensagem com cópia oculta 33 34 assunto.somente.copia=[SELENIUM] Teste envio mensagem somente cópia 34 35 assunto.somente.copia.oculta=[SELENIUM] Teste mensagem somente cópia oculta
Note: See TracChangeset
for help on using the changeset viewer.