@@ -0,0 +1,3051 @@
+package ru.stqa.training.selenium;%0A%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.openqa.selenium.By;%0Aimport org.openqa.selenium.WebDriver;%0Aimport org.openqa.selenium.WebElement;%0Aimport org.openqa.selenium.chrome.ChromeDriver;%0Aimport org.openqa.selenium.chrome.ChromeOptions;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.concurrent.TimeUnit;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0A/**%0A * Created by ilya on 04/02/2017.%0A */%0Apublic class SortingOfCountriesAndGeozones %7B%0A    private WebDriver driver;%0A%0A    @Before%0A    public void before()%0A    %7B%0A        ChromeOptions chromeOptions = new ChromeOptions();%0A        chromeOptions.addArguments(%22start-fullscreen%22);%0A        driver = new ChromeDriver(chromeOptions);%0A        driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);%0A    %7D%0A%0A    @Test%0A    public void countriesAndGeozonesShouldBeSorted() %7B%0A        driver.get(%22http://localhost/litecart/admin/?app=countries&doc=countries%22);%0A        driver.findElement(By.name(%22username%22)).sendKeys(%22admin%22);%0A        driver.findElement(By.name(%22password%22)).sendKeys(%22admin%22);%0A        driver.findElement(By.name(%22login%22)).click();%0A%0A        List%3CWebElement%3E countryRows = driver.findElements(By.cssSelector(%22tr.row%22));%0A        List%3CString%3E checkCountrySort = new ArrayList%3C%3E();%0A        List%3CString%3E sortedCountries = new ArrayList%3C%3E();%0A        List%3CString%3E haveZones = new ArrayList%3C%3E();%0A%0A//        check country names are sorted%0A        for (WebElement row : countryRows) %7B%0A            WebElement countryName = row.findElement(By.cssSelector(%22td:nth-of-type(5) a%22));%0A            checkCountrySort.add(countryName.getText());%0A%0A            if (!row.findElement(By.cssSelector(%22td:nth-of-type(6)%22)).getText().equals(%220%22))%7B%0A                haveZones.add(countryName.getAttribute(%22href%22));%0A            %7D%0A        %7D%0A        sortedCountries.addAll(checkCountrySort);%0A        Collections.sort(sortedCountries);%0A%0A        for (int i = 0; i %3C checkCountrySort.size(); i++) %7B%0A            assertTrue(checkCountrySort.get(i).equals(sortedCountries.get(i)));%0A        %7D%0A%0A//        check zone names are sorted%0A        for (String url : haveZones) %7B%0A            driver.get(url);%0A            List%3CWebElement%3E zoneRows = driver.findElements(By.cssSelector(%22#table-zones tr:not(.header)%22));%0A            List%3CString%3E checkZonesSort = new ArrayList%3C%3E();%0A            List%3CString%3E sortedZones = new ArrayList%3C%3E();%0A            for (WebElement row : zoneRows) %7B%0A                checkZonesSort.add(row.findElement(By.cssSelector(%22td:nth-of-type(3)%22)).getText());%0A            %7D%0A%0A            checkZonesSort.remove(checkZonesSort.size()-1);%0A            sortedZones.addAll(checkZonesSort);%0A            Collections.sort(sortedZones);%0A%0A            for (int i = 0; i %3C checkZonesSort.size(); i++) %7B%0A                assertTrue(checkZonesSort.get(i).equals(sortedZones.get(i)));%0A            %7D%0A        %7D%0A%0A    %7D%0A%0A    @After%0A    public void after()%7B%0A        driver.quit();%0A        driver = null;%0A    %7D%0A%7D%0A

add test countriesAndGeozonesShouldBeSorted