|
|
@ -10,6 +10,7 @@ import org.junit.FixMethodOrder;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import org.junit.runners.MethodSorters;
|
|
|
|
import org.junit.runners.MethodSorters;
|
|
|
|
|
|
|
|
import org.openqa.selenium.WebElement;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
@ -24,7 +25,7 @@ import java.util.Map;
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
|
|
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
|
|
|
@SpringBootTest(classes = NgTrackerApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
|
|
|
|
@SpringBootTest(classes = NgTrackerApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
|
|
|
|
public class IndexGrantTest extends TestTemplate {
|
|
|
|
public class GrantTest extends TestTemplate {
|
|
|
|
private final Map<PageObject, List<String>> navigationHolder = ImmutableMap.of(
|
|
|
|
private final Map<PageObject, List<String>> navigationHolder = ImmutableMap.of(
|
|
|
|
new GrantsPage(), Arrays.asList("ГРАНТЫ", "/grants/grants"),
|
|
|
|
new GrantsPage(), Arrays.asList("ГРАНТЫ", "/grants/grants"),
|
|
|
|
new GrantPage(), Arrays.asList("РЕДАКТИРОВАНИЕ ГРАНТА", "/grants/grant?id=0"),
|
|
|
|
new GrantPage(), Arrays.asList("РЕДАКТИРОВАНИЕ ГРАНТА", "/grants/grant?id=0"),
|
|
|
@ -35,7 +36,7 @@ public class IndexGrantTest extends TestTemplate {
|
|
|
|
private ApplicationProperties applicationProperties;
|
|
|
|
private ApplicationProperties applicationProperties;
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void createNewGrant() {
|
|
|
|
public void aCreateNewGrant() {
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 1);
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 1);
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
GrantPage grantPage = (GrantPage) getContext().initPage(page.getKey());
|
|
|
|
GrantPage grantPage = (GrantPage) getContext().initPage(page.getKey());
|
|
|
@ -53,7 +54,7 @@ public class IndexGrantTest extends TestTemplate {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void createBlankGrant() {
|
|
|
|
public void bCreateBlankGrant() {
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 1);
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 1);
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
GrantPage grantPage = (GrantPage) getContext().initPage(page.getKey());
|
|
|
|
GrantPage grantPage = (GrantPage) getContext().initPage(page.getKey());
|
|
|
@ -64,7 +65,7 @@ public class IndexGrantTest extends TestTemplate {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void updateGrantTitle() {
|
|
|
|
public void cUpdateGrantTitle() {
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
@ -79,18 +80,7 @@ public class IndexGrantTest extends TestTemplate {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void deleteGrant() throws InterruptedException {
|
|
|
|
public void dAttachPaper() {
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer size = grantsPage.getGrantsList().size();
|
|
|
|
|
|
|
|
grantsPage.deleteFirst();
|
|
|
|
|
|
|
|
Assert.assertEquals(size - 1, grantsPage.getGrantsList().size());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void attachPaper() {
|
|
|
|
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
@ -103,7 +93,7 @@ public class IndexGrantTest extends TestTemplate {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void deletePaper() {
|
|
|
|
public void eDeletePaper() {
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
@ -119,7 +109,7 @@ public class IndexGrantTest extends TestTemplate {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void addDeadline() {
|
|
|
|
public void fAddDeadline() {
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
@ -130,8 +120,8 @@ public class IndexGrantTest extends TestTemplate {
|
|
|
|
Integer deadlineCount = grantPage.getDeadlineCount();
|
|
|
|
Integer deadlineCount = grantPage.getDeadlineCount();
|
|
|
|
|
|
|
|
|
|
|
|
String description = "deadline test";
|
|
|
|
String description = "deadline test";
|
|
|
|
String date = "09.09.2019";
|
|
|
|
String date = "08.08.2019";
|
|
|
|
String dateValue = "2019-09-09";
|
|
|
|
String dateValue = "2019-08-08";
|
|
|
|
grantPage.addDeadline();
|
|
|
|
grantPage.addDeadline();
|
|
|
|
grantPage.setDeadline(date, deadlineCount, description);
|
|
|
|
grantPage.setDeadline(date, deadlineCount, description);
|
|
|
|
grantPage.saveGrant();
|
|
|
|
grantPage.saveGrant();
|
|
|
@ -142,7 +132,7 @@ public class IndexGrantTest extends TestTemplate {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void deleteDeadline() {
|
|
|
|
public void gDeleteDeadline() {
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
@ -152,21 +142,84 @@ public class IndexGrantTest extends TestTemplate {
|
|
|
|
String grantId = grantPage.getId();
|
|
|
|
String grantId = grantPage.getId();
|
|
|
|
Integer deadlineCount = grantPage.getDeadlineCount();
|
|
|
|
Integer deadlineCount = grantPage.getDeadlineCount();
|
|
|
|
|
|
|
|
|
|
|
|
String description = "deadline test";
|
|
|
|
grantPage.deleteDeadline();
|
|
|
|
String date = "09.09.2019";
|
|
|
|
|
|
|
|
String dateValue = "2019-09-09";
|
|
|
|
|
|
|
|
grantPage.addDeadline();
|
|
|
|
|
|
|
|
grantPage.setDeadline(date, deadlineCount, description);
|
|
|
|
|
|
|
|
grantPage.saveGrant();
|
|
|
|
grantPage.saveGrant();
|
|
|
|
|
|
|
|
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/grants/grant?id=%s", grantId));
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/grants/grant?id=%s", grantId));
|
|
|
|
deadlineCount = grantPage.getDeadlineCount();
|
|
|
|
Integer newDeadlineCount = grantPage.getDeadlineCount();
|
|
|
|
|
|
|
|
Assert.assertEquals(deadlineCount - 1, (int) newDeadlineCount);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
grantPage.deleteDeadline();
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void hAddAuthor() {
|
|
|
|
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
|
|
|
|
GrantPage grantPage = (GrantPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WebElement grant = grantsPage.getFirstGrantWithoutClick();
|
|
|
|
|
|
|
|
String grantTitle = grantsPage.getGrantTitle(grant);
|
|
|
|
|
|
|
|
Integer authorsCount = grantsPage.getAuthorsCount(grant);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grantsPage.getFirstGrant();
|
|
|
|
|
|
|
|
grantPage.addAuthor();
|
|
|
|
|
|
|
|
grantPage.saveGrant();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grant = grantsPage.getGrantByTitle(grantTitle);
|
|
|
|
|
|
|
|
Integer newAuthorsCount = grantsPage.getAuthorsCount(grant);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(authorsCount + 1, (int) newAuthorsCount);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void iDeleteAuthor() {
|
|
|
|
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
|
|
|
|
GrantPage grantPage = (GrantPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WebElement grant = grantsPage.getFirstGrantWithoutClick();
|
|
|
|
|
|
|
|
String grantTitle = grantsPage.getGrantTitle(grant);
|
|
|
|
|
|
|
|
Integer authorsCount = grantsPage.getAuthorsCount(grant);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grantsPage.getFirstGrant();
|
|
|
|
|
|
|
|
grantPage.deleteAuthor();
|
|
|
|
|
|
|
|
grantPage.saveGrant();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grant = grantsPage.getGrantByTitle(grantTitle);
|
|
|
|
|
|
|
|
Integer newAuthorsCount = grantsPage.getAuthorsCount(grant);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
authorsCount = (authorsCount == 0) ? 0 : authorsCount - 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals((int) authorsCount, (int) newAuthorsCount);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void jUpdateGrantDescription() {
|
|
|
|
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
|
|
|
|
GrantPage grantPage = (GrantPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String description = "newDescriptionForGrant";
|
|
|
|
|
|
|
|
grantsPage.getFirstGrant();
|
|
|
|
|
|
|
|
String grantId = grantPage.getId();
|
|
|
|
|
|
|
|
grantPage.setDescription(description);
|
|
|
|
grantPage.saveGrant();
|
|
|
|
grantPage.saveGrant();
|
|
|
|
|
|
|
|
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/grants/grant?id=%s", grantId));
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/grants/grant?id=%s", grantId));
|
|
|
|
Integer newDeadlineCount = grantPage.getDeadlineCount();
|
|
|
|
|
|
|
|
Assert.assertEquals(deadlineCount - 1, (int) newDeadlineCount);
|
|
|
|
Assert.assertTrue(description.equals(grantPage.getDescription()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void kDeleteGrant() throws InterruptedException {
|
|
|
|
|
|
|
|
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
|
|
|
|
|
|
|
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
|
|
|
|
|
|
|
GrantsPage grantsPage = (GrantsPage) getContext().initPage(page.getKey());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer size = grantsPage.getGrantsList().size();
|
|
|
|
|
|
|
|
grantsPage.deleteFirst();
|
|
|
|
|
|
|
|
Assert.assertEquals(size - 1, grantsPage.getGrantsList().size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|