-
Notifications
You must be signed in to change notification settings - Fork 188
/
ImportResourceTest.java
67 lines (46 loc) · 2.19 KB
/
ImportResourceTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.evolveum.midpoint.testing.selenide.tests.resource;
import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.testing.selenide.tests.BaseTest;
import org.openqa.selenium.By;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.testng.annotations.Test;
import java.io.File;
import static com.codeborne.selenide.Condition.*;
import static com.codeborne.selenide.Selenide.$;
/**
* Created by Kate on 09.08.2015.
*/
@Component
public class ImportResourceTest extends BaseTest{
@Autowired
BaseTest baseTest;
@Autowired
ResourceUtil resourceUtil;
/**
* Import OpenDJ resource test (file "opendj-localhost-resource-sync-no-extension-advanced.xml" is used)
*/
@Test
public void importOpendjResourceTest(){
//click Configuration menu
$(By.xpath("/html/body/div[3]/div/div[2]/ul[1]/li[8]/a"))
.shouldHave(text("Configuration")).click();
//click Import object menu item
$(By.linkText("Import object")).click();
//select Overwrite existing object check box
$(By.name("importOptions:overwriteExistingObject")).setSelected(true);
//Specify the file to be uploaded
File test = new File("../../samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml");
$(By.name("input:inputFile:fileInput")).uploadFile(test);
//click Import object button
$(By.xpath("/html/body/div[4]/div/form/div[6]/a")).shouldHave(text("Import object")).click();
//check if Success message appears after resource importing
$(By.xpath("/html/body/div[4]/div/div[2]/div[1]/ul/li/div/div[1]/div[1]/span")).shouldHave(text("Success"));
//open Resources -> List Resources
$(By.xpath("/html/body/div[3]/div/div[2]/ul[1]/li[4]/a")).shouldHave(text("Resources")).click();
$(By.linkText("List resources")).click();
//search for OpenDJ resource in resources list
resourceUtil.searchForOpendjResource(resourceUtil.getTestResourceName(), "/html/body/div[4]/div/form[2]/div[2]/table/tbody/tr/td[2]/div/a/span")
.shouldBe(visible);
}
}