package Ġorg . v accine impact . order ly web . custom Config Tests Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Test Ċ import Ġorg . openqa . selenium . By Ċ import Ġorg . openqa . selenium . support . ui . Expected Conditions Ċ import Ġorg . v accine impact . order ly web . db . AppConfig Ċ import Ġorg . v accine impact . order ly web . models . Scope Ċ import Ġorg . v accine impact . order ly web . models . permissions . Re ified Permission Ċ Ċ class ĠMont ag u Authentication Tests Ġ: ĠSelen ium Test () Ċ { ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` user Ġis Ġdirected Ġto Ġlogin Ġwith ĠMont ag u `() ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġstart App (" auth . provider = mont ag u ") ĊĠĠĠĠĠĠĠ Ġadd User With Permissions ( listOf ( Re ified Permission (" reports . read ", ĠScope . Global ()))) ĊĊĠĠĠĠĠĠĠ Ġlogin With Mont ag u () ĊĊĠĠĠĠĠĠĠ Ġval Ġheader Ġ= Ġdriver . findElement ( By . css Selector (" h 1 ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( header . text ). isEqualTo (" Find Ġa Ġreport ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` user Ġcan Ġlogout `() ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġstart App (" auth . provider = mont ag u ") ĊĊĠĠĠĠĠĠĠ Ġlogin With Mont ag u () ĊĊĠĠĠĠĠĠĠ Ġ// Confirm Ġthat Ġmont ag u Ġtokens Ġare Ġset ĊĠĠĠĠĠĠĠ Ġval Ġlogged In Cookies Ġ= Ġdriver . manage (). cookies ĊĠĠĠĠĠĠĠ ĠassertThat ( logged In Cookies . first { Ġit . name Ġ== Ġ" jwt _ token " Ġ}. value ). isNotEmpty () ĊĠĠĠĠĠĠĠ ĠassertThat ( logged In Cookies . first { Ġit . name Ġ== Ġ" mont ag u _ jwt _ token " Ġ}. value ). isNotEmpty () ĊĊĠĠĠĠĠĠĠ Ġdriver . findElement ( By . css Selector (". nav - right Ġ. dropdown - toggle ")). click () ĊĠĠĠĠĠĠĠ Ġdriver . findElement ( By . id (" logout - link ")). click () ĊĊĠĠĠĠĠĠĠ Ġ// This Ġshould Ġlog Ġout Ġof Ġthe Ġmont ag u Ġapi Ġthen Ġredirect Ġto Ġmont ag u ĊĠĠĠĠĠĠĠ Ġwait . until ( Expected Conditions . title Is (" V accine ĠImp act ĠMode lling ĠCon sort ium Ġ- ĠMont ag u ")) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( driver . current Url ). contains ( AppConfig ()[" mont ag u . url "]) ĊĊĠĠĠĠĠĠĠ Ġ// Check Ġthat Ġmont ag u Ġtoken Ġcookies Ġwere Ġcleared Ġto Ġlogout Ġof ĠMont ag u Ġas Ġwell Ġas ĠOrder ly Web ĊĠĠĠĠĠĠĠ Ġval Ġlogged Out Cookies Ġ= Ġdriver . manage (). cookies ĊĠĠĠĠĠĠĠ ĠassertThat ( logged Out Cookies . first { Ġit . name Ġ== Ġ" jwt _ token " Ġ}. value ). isEmpty () ĊĠĠĠĠĠĠĠ ĠassertThat ( logged Out Cookies . first { Ġit . name Ġ== Ġ" mont ag u _ jwt _ token " Ġ}. value ). isEmpty () ĊĊĠĠĠĠĠĠĠ Ġ// We Ġshould Ġnow Ġbe Ġon Ġthe ĠMont ag u Ġlogin Ġpage , Ġlogged Ġout Ġ- Ġgive Ġthe Ġproxy Ġtime Ġto Ġcheck Ġuser Ġstatus Ġwith Ġthe Ġapi ĊĠĠĠĠĠĠĠ Ġwait . until ( Expected Conditions . presence Of Element Loc ated ( By . id (" login - button "))) ĊĠĠĠ Ġ} Ċ } Ċ