-
Notifications
You must be signed in to change notification settings - Fork 188
/
LoginTest.java
99 lines (78 loc) · 2.58 KB
/
LoginTest.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package com.evolveum.midpoint.testing.selenide.tests.basictests;
import com.evolveum.midpoint.testing.selenide.tests.AbstractSelenideTest;
import org.openqa.selenium.By;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.testng.annotations.Test;
import static com.codeborne.selenide.Selectors.by;
import static com.codeborne.selenide.Selectors.byText;
import static com.codeborne.selenide.Selenide.*;
import static com.codeborne.selenide.Condition.*;
/**
* Created by Kate on 07.08.2015.
*/
//@Component
public class LoginTest extends AbstractSelenideTest {
/**
* Log in to system as administrator/5ecr3t
*/
@Test
public void test001loginWithCorrectCredentialsTest(){
open(SITE_URL);
//perform login
login(SITE_URL, ADMIN_LOGIN, ADMIN_PASSWORD);
//check if welcome message appears after user logged in
$(byText("welcome to midPoint")).shouldBe(visible);
//check if Superuser role is displayed in My Assignments on Dashboard
$(byText("Superuser"));
close();
}
/**
* Log in to system with incorrect username
*/
@Test
public void test002loginWithIncorrectUsernameTest(){
open(SITE_URL);
//perform login
login(SITE_URL, "incorrectUserName", ADMIN_PASSWORD);
//check if error message appears
$(byText("Invalid username and/or password.")).shouldBe(visible);
close();
}
/**
* Log in to system without username
*/
@Test
public void test003loginWithoutUsernameTest(){
open(SITE_URL);
//perform login
login(SITE_URL, "", ADMIN_PASSWORD);
//check if error message appears
$(By.className("messages-error")).find(by("title", "Partial error")).shouldBe(visible);
close();
}
/**
* Log in to system with incorrect password
*/
@Test
public void test004loginWithIncorrectPasswordTest(){
open(SITE_URL);
//perform login
login(SITE_URL, ADMIN_LOGIN, "incorrectPassword");
//check if error message appears
$(byText("Invalid username and/or password.")).shouldBe(visible);
close();
}
/**
* Log in to system without password
*/
@Test
public void test005loginWithoutPasswordTest(){
open(SITE_URL);
//perform login
login(SITE_URL, ADMIN_LOGIN, "");
//check if error message appears
$(By.className("messages-error")).find(by("title", "Partial error")).shouldBe(visible);
close();
}
}