Skip to content

Commit 60cc073

Browse files
committed
Some more login tests
1 parent 121bc6c commit 60cc073

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

src/Server/Coderr.Server.Web.Tests/Pages/LoginPage.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,35 @@ public HomePage LoginWithValidCredentials()
3737
return new HomePage(WebDriver);
3838
}
3939

40+
public LoginPage LoginWithNonExistingUserWithoutPasswordSpecified()
41+
{
42+
NavigateToPage();
43+
44+
UserNameField.Clear();
45+
UserNameField.SendKeys("NonExistingUsername");
46+
47+
PasswordField.Clear();
48+
49+
SignInButton.Click();
50+
51+
return this;
52+
}
53+
54+
public LoginPage LoginWithNonExistingUserWithPasswordSpecified()
55+
{
56+
NavigateToPage();
57+
58+
UserNameField.Clear();
59+
UserNameField.SendKeys("NonExistingUsername");
60+
61+
PasswordField.Clear();
62+
PasswordField.SendKeys(Password);
63+
64+
SignInButton.Click();
65+
66+
return this;
67+
}
68+
4069
public LoginPage LoginWithNoUserNameSpecified()
4170
{
4271
NavigateToPage();
@@ -51,6 +80,19 @@ public LoginPage LoginWithNoUserNameSpecified()
5180
return this;
5281
}
5382

83+
public LoginPage LoginWithNoUserNameAndNoPasswordSpecified()
84+
{
85+
NavigateToPage();
86+
87+
UserNameField.Clear();
88+
89+
PasswordField.Clear();
90+
91+
SignInButton.Click();
92+
93+
return this;
94+
}
95+
5496
public LoginPage LoginWithNoPasswordSpecified()
5597
{
5698
NavigateToPage();

src/Server/Coderr.Server.Web.Tests/Tests/LoginPageTests.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,45 @@ public void Should_not_be_able_to_login_with_empty_password()
3232
});
3333
}
3434

35+
[Fact]
36+
public void Should_not_be_able_to_login_with_empty_username_and_empty_password()
37+
{
38+
UITest(() =>
39+
{
40+
var sut = new LoginPage(WebDriver)
41+
.LoginWithNoUserNameAndNoPasswordSpecified();
42+
43+
Assert.IsType<LoginPage>(sut);
44+
sut.VerifyIsCurrentPage();
45+
});
46+
}
47+
48+
[Fact]
49+
public void Should_not_be_able_to_login_with_non_existing_user()
50+
{
51+
UITest(() =>
52+
{
53+
var sut = new LoginPage(WebDriver)
54+
.LoginWithNonExistingUserWithPasswordSpecified();
55+
56+
Assert.IsType<LoginPage>(sut);
57+
sut.VerifyIsCurrentPage();
58+
});
59+
}
60+
61+
[Fact]
62+
public void Should_not_be_able_to_login_with_non_existing_user_with_empty_password()
63+
{
64+
UITest(() =>
65+
{
66+
var sut = new LoginPage(WebDriver)
67+
.LoginWithNonExistingUserWithoutPasswordSpecified();
68+
69+
Assert.IsType<LoginPage>(sut);
70+
sut.VerifyIsCurrentPage();
71+
});
72+
}
73+
3574
[Fact]
3675
public void Should_not_be_able_to_login_with_wrong_password()
3776
{

0 commit comments

Comments
 (0)