How to use L10N class of com.qaprosoft.carina.core.foundation.utils.resources package

Best Carina code snippet using com.qaprosoft.carina.core.foundation.utils.resources.L10N

Source:WebLocalizationSample.java Github

copy

Full Screen

...16package com.qaprosoft.carina.demo;17import com.qaprosoft.carina.core.foundation.AbstractTest;18import com.qaprosoft.carina.core.foundation.utils.Configuration;19import com.qaprosoft.carina.core.foundation.utils.ownership.MethodOwner;20import com.qaprosoft.carina.core.foundation.utils.resources.L10N;21import com.qaprosoft.carina.core.foundation.utils.resources.L10Nparser;22import com.qaprosoft.carina.demo.gui.pages.localizationSample.WikipediaHomePage;23import com.qaprosoft.carina.demo.gui.pages.localizationSample.WikipediaLocalePage;24import com.zebrunner.agent.core.annotation.TestLabel;25import org.slf4j.Logger;26import org.slf4j.LoggerFactory;27import org.testng.annotations.Test;28import org.testng.asserts.SoftAssert;29import java.lang.invoke.MethodHandles;30import java.util.Locale;31/**32 * This sample shows how create Web Localization test with Resource Bundle.33 *34 * @author qpsdemo35 */36public class WebLocalizationSample extends AbstractTest {37 private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());38 @Test39 @MethodOwner(owner = "qpsdemo")40 @TestLabel(name = "feature", value = "l10n")41 public void testLanguages() {42 WikipediaHomePage wikipediaHomePage = new WikipediaHomePage(getDriver());43 wikipediaHomePage.open();44 SoftAssert softAssert = new SoftAssert();45 WikipediaLocalePage wikipediaLocalePage = wikipediaHomePage.goToWikipediaLocalePage(getDriver());46 String welcomeText = wikipediaLocalePage.getWelcomeText();47 String expectedWelcomeText = L10N.getText("HomePage.welcomeText");48 softAssert.assertEquals(welcomeText, expectedWelcomeText.trim(), "Wikipedia welcome text was not the expected.");49 wikipediaLocalePage.clickDiscussionBtn();50 String expectedDiscussionText = L10N.getText("discussionElem");51 String discussionText = wikipediaLocalePage.getDiscussionText();52 softAssert.assertEquals(discussionText,expectedDiscussionText.trim(),"Wikipedia discussion text was not the expected");53 softAssert.assertAll();54 }55 @Test56 @MethodOwner(owner = "qpsdemo")57 @TestLabel(name = "feature", value = "l10n")58 /**59 * _config.properties should be filled correctly.60 * For example: for Japan language you should use:61 * locale=ja_JP62 *63 * add_new_localization=true - for creation and false for checking.64 * add_new_localization_path=./src/main/resources/L10N/ - path for newly created l10n file65 * add_new_localization_encoding=UTF-8 (use ISO-2022-JP if you can't have UTF-8 property file or there are issues with comparison or interaction)66 * add_new_localization_property_name=new_locale_ - name of l10n file. Copy all required values in your existing locale_ja_JP.properties67 * Read more details in com.qaprosoft.carina.core.foundation.utils.resources.L10Nparser68 */69 public void testAddNewLanguages() {70 WikipediaHomePage wikipediaHomePage = new WikipediaHomePage(getDriver());71 wikipediaHomePage.open();72 WikipediaLocalePage wikipediaLocalePage = wikipediaHomePage.goToWikipediaLocalePage(getDriver());73 String expectedWelcomeText = L10N.getText("HomePage.welcomeText");74 String welcomeText = wikipediaLocalePage.getWelcomeText();75 SoftAssert sa = new SoftAssert();76 sa.assertEquals(welcomeText, expectedWelcomeText.trim(), "Wikipedia welcome text was not the expected.");77 // To set correct locale for creating new localization text.78 // Can be changed dynamically during test execution.79 L10Nparser.setActualLocale(Configuration.get(Configuration.Parameter.LOCALE));80 Locale actualLocale = L10Nparser.getActualLocale();81 LOGGER.info(actualLocale.toString());82 sa.assertTrue(wikipediaLocalePage.checkMultipleLocalization(), "Localization error: " + L10Nparser.getAssertErrorMsg());83 L10Nparser.saveLocalization();84 sa.assertAll();85 }86}...

Full Screen

Full Screen

L10N

Using AI Code Generation

copy

Full Screen

1import org.testng.annotations.Test;2import org.testng.Assert;3import com.qaprosoft.carina.core.foundation.utils.resources.L10N;4public class L10NTest {5 public void testL10N() {6 String value = L10N.getMessage("key");7 Assert.assertEquals(value, "value");8 }9}10import org.testng.annotations.Test;11import org.testng.Assert;12import com.qaprosoft.carina.core.foundation.utils.resources.L10N;13public class L10NTest {14 public void testL10N() {15 String value = L10N.getMessage("key");16 Assert.assertEquals(value, "value");17 }18}19import org.testng.annotations.Test;20import org.testng.Assert;21import com.qaprosoft.carina.core.foundation.utils.resources.L10N;22public class L10NTest {23 public void testL10N() {24 String value = L10N.getMessage("key");25 Assert.assertEquals(value, "value");26 }27}28import org.testng.annotations.Test;29import org.testng.Assert;30import com.qaprosoft.carina.core.foundation.utils.resources.L10N;31public class L10NTest {32 public void testL10N() {33 String value = L10N.getMessage("key");34 Assert.assertEquals(value, "value");35 }36}37import org.testng.annotations.Test;38import org.testng.Assert;39import com.qaprosoft.carina.core.foundation.utils.resources.L10N;40public class L10NTest {41 public void testL10N() {42 String value = L10N.getMessage("key");43 Assert.assertEquals(value, "value");44 }45}46import org.testng

Full Screen

Full Screen

L10N

Using AI Code Generation

copy

Full Screen

1L10N l10n = L10N.getL10N("en", "US");2System.out.println(l10n.get("login_email"));3System.out.println(l10n.get("login_password"));4System.out.println(l10n.get("login_button"));5L10NFactory l10nFactory = new L10NFactory();6L10N l10n = l10nFactory.getL10N("en", "US");7System.out.println(l10n.get("login_email"));8System.out.println(l10n.get("login_password"));9System.out.println(l10n.get("login_button"));10L10NFactory l10nFactory = new L10NFactory();11L10N l10n_en_us = l10nFactory.getL10N("en", "US");12System.out.println(l10n_en_us.get("login_email"));13System.out.println(l10n_en_us.get("login_password"));14System.out.println(l10n_en_us.get("login_button"));15L10N l10n_de_de = l10nFactory.getL10N("de", "DE");16System.out.println(l10n_de_de.get("login_email"));17System.out.println(l10n_de_de.get("login_password"));18System.out.println(l10n_de_de.get("login_button"));19L10N l10n_es_es = l10nFactory.getL10N("es", "ES");20System.out.println(l10n_es_es.get("login_email"));21System.out.println(l10n_es_es.get("login_password"));22System.out.println(l10n_es_es.get("login_button"));23L10N l10n_fr_fr = l10nFactory.getL10N("fr", "FR");24System.out.println(l10n_fr_fr.get("login_email"));25System.out.println(l10n_fr_fr.get("login_password"));26System.out.println(l10n_fr_fr.get("login_button"));27L10N l10n_it_it = l10nFactory.getL10N("it", "IT

Full Screen

Full Screen

L10N

Using AI Code Generation

copy

Full Screen

1public class LocalizationExampleTest extends AbstractTest {2 @Test(description = "JIRA#DEMO-0001")3 public void testLocalization() {4 }5}6public class LocalizationExampleTest extends AbstractTest {7 @Test(description = "JIRA#DEMO-0001")8 public void testLocalization() {9 }10}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Carina automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful