Fix register detection on resman.pl (CRUSTS 19.9.0.7949)

This commit is contained in:
Mikołaj Pich 2019-10-06 22:38:47 +02:00
parent a5a0e838a6
commit ed663aacac
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA
4 changed files with 68 additions and 1 deletions

View file

@ -89,7 +89,7 @@ class RegisterRepository(
when {
it.select(".LogOnBoard input[type=submit]").isNotEmpty() -> Api.LoginType.STANDARD
it.select("form[name=form1] #SubmitButton").isNotEmpty() -> Api.LoginType.ADFS
it.select("form #SubmitButton").isNotEmpty() -> {
it.select(".submit-button, form #SubmitButton").isNotEmpty() -> {
it.selectFirst("form").attr("action").run {
when {
startsWith("/LoginPage.aspx") -> Api.LoginType.ADFSLight

View file

@ -310,6 +310,7 @@ class ApiRemoteTest : BaseTest() {
val stats = api.getGradesStatistics(321, false)
val statsObserver = TestObserver<List<GradeStatistics>>()
stats.subscribe(statsObserver)
statsObserver.assertComplete()
val values = statsObserver.values()[0]

View file

@ -294,6 +294,26 @@ class RegisterTest : BaseLocalTest() {
assertEquals(Api.LoginType.ADFSLight, res[0].loginType)
}
@Test
fun loginType_adfsLight_resman() {
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("ADFSLight-form-resman.html").readText()))
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-cufs.html").readText()))
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-uonet.html").readText()))
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Login-success.html").readText()))
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("ADFSLight-form-1.html").readText())) //
server.enqueue(MockResponse().setBody(RegisterTest::class.java.getResource("WitrynaUczniaIRodzica.html").readText()))
server.enqueue(MockResponse().setBody(GradesTest::class.java.getResource("OcenyWszystkie-details.html").readText()))
// 4x symbol
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-brak-dostepu.html").readText()))
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-brak-dostepu.html").readText()))
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-brak-dostepu.html").readText()))
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("Logowanie-brak-dostepu.html").readText()))
server.start(3000)
val res = registerSnp.getStudents().blockingGet()
assertEquals(Api.LoginType.ADFSLight, res[0].loginType)
}
@Test
fun loginType_adfsLightScoped() {
server.enqueue(MockResponse().setBody(LoginTest::class.java.getResource("ADFSLightScoped-form-1.html").readText()))

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<title>Logowanie do systemu</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
</head>
<body>
<div class="panel" id="panel">
<div class="content" id="content">
<form action="/LoginPage.aspx?ReturnUrl=%2f%3fwa" method="post">
<div class="label">Zaloguj się</div>
<div class="box" id="box">
<div class="box-h">Proszę podać nazwę użytkownika i hasło</div>
<div class="box-p">
<label class="box-line" for="Username">Nazwa użytkownika:</label>
<input class="box-line" id="Username" name="Username" type="text" value=""/>
<span class="field-validation-valid box-line"></span>
</div>
<div class="box-p">
<label class="box-line" for="Password">Hasło:</label>
<input class="box-line" id="Password" name="Password" type="password"/>
<span class="field-validation-valid box-line"></span>
</div>
<div class="box-p box-right">
<button type="submit" class="submit-button box-line">Zaloguj się</button>
</div>
<div>
<a class="box-line box-link" id="aUnlock" href="/AccountManage/UnlockAccountRequest" title="Pierwsze logowanie lub odzyskiwanie hasła">Przywracanie dostępu do konta</a>
</div>
<div class="box-p"></div>
<div class="box-p box-right box-small" style="display:none">
<a href="#" id="hpReturnHyperlink">Powrót</a>
</div>
</div>
</form>
</div>
<div class="footer">
<img id="logo" src="/Resources/Rzeszow/footer.png" alt="Stopka strony"/>
<div>&copy; VULCAN sp. z o.o. 2011-2019</div>
<div>CRUSTS 19.9.0.7949</div>
</div>
</div>
</body>
</html>