-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from picortex/master-dev-anderson
Added testing for add business form
- Loading branch information
Showing
30 changed files
with
223 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...lient/browser/react/src/jsMain/kotlin/pimonitor/evaluation/business/InviteBusinessPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package pimonitor.evaluation.business | ||
|
||
import pimonitor.PiMonitorService | ||
import react.RBuilder | ||
|
||
fun RBuilder.InviteBusiness(service: PiMonitorService, uid: String?) = AddBusiness(service, uid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...pi-monitor-client/browser/react/src/jvmTest/kotlin/acceptance/monitors/AddBusinessTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package acceptance.monitors | ||
|
||
import acceptance.utils.AcceptanceTest | ||
import kotlinx.coroutines.delay | ||
import org.junit.jupiter.api.TestInstance | ||
import org.testcontainers.junit.jupiter.Testcontainers | ||
import pimonitor.authentication.signup.SignUpParams | ||
import pimonitor.monitored.CreateMonitoredBusinessParams | ||
import pimonitor.test | ||
import kotlin.test.Test | ||
|
||
@Testcontainers | ||
@TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
class AddBusinessTest : AcceptanceTest() { | ||
@Test | ||
fun should_be_able_to_add_a_business() = application.test { | ||
val params = SignUpParams.Individual( | ||
name = "Jane Doe", email = "[email protected]", password = "janedoe" | ||
) | ||
val dashboard = openSignUpScreen().signUp(params).expectToBeSigningUp() | ||
val details = CreateMonitoredBusinessParams( | ||
businessName = "PiCortex", | ||
contactName = "Mohammed Majapa", | ||
contactEmail = "[email protected]" | ||
) | ||
val businesses = dashboard.selectBusinesses() | ||
businesses.clickCreateButton().apply { | ||
enter(details) | ||
submitByPressingEnter() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...nitor-client/test/src/commonMain/kotlin/pimonitor/screens/authentication/SignUpProcess.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package pimonitor.screens.authentication | ||
|
||
import pimonitor.screens.dashboard.DashboardScreen | ||
|
||
interface SignUpProcess { | ||
fun expectToBeSigningUp() : DashboardScreen | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...-monitor-client/test/src/commonMain/kotlin/pimonitor/screens/dashboard/AddBusinessForm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package pimonitor.screens.dashboard | ||
|
||
import pimonitor.monitored.CreateMonitoredBusinessParams | ||
|
||
interface AddBusinessForm { | ||
suspend fun enter(details: CreateMonitoredBusinessParams) | ||
suspend fun submitByPressingEnter() | ||
suspend fun submitByClicking() | ||
} |
5 changes: 5 additions & 0 deletions
5
...monitor-client/test/src/commonMain/kotlin/pimonitor/screens/dashboard/BusinessesScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package pimonitor.screens.dashboard | ||
|
||
interface BusinessesScreen { | ||
fun clickCreateButton(): AddBusinessForm | ||
} |
7 changes: 7 additions & 0 deletions
7
...-monitor-client/test/src/commonMain/kotlin/pimonitor/screens/dashboard/DashboardScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package pimonitor.screens.dashboard | ||
|
||
import pimonitor.screens.api.Screen | ||
|
||
interface DashboardScreen : Screen { | ||
suspend fun selectBusinesses(): BusinessesScreen | ||
} |
19 changes: 19 additions & 0 deletions
19
pi-monitor/pi-monitor-client/test/src/jvmMain/kotlin/pimonitor/screens/DashboardScreenWeb.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package pimonitor.screens | ||
|
||
import com.codeborne.selenide.Selectors.withText | ||
import pimonitor.screens.dashboard.BusinessesScreen | ||
import pimonitor.screens.dashboard.BusinessesScreenWeb | ||
import pimonitor.screens.dashboard.DashboardScreen | ||
import pimonitor.utils.isVisible | ||
import com.codeborne.selenide.Selenide.`$` as S | ||
|
||
class DashboardScreenWeb : DashboardScreen { | ||
override suspend fun isVisible(): Boolean { | ||
return S(withText("Dashboard")).isVisible() | ||
} | ||
|
||
override suspend fun selectBusinesses(): BusinessesScreen { | ||
S(withText("Business")).click() | ||
return BusinessesScreenWeb() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
pi-monitor/pi-monitor-client/test/src/jvmMain/kotlin/pimonitor/screens/SignUpProcessWeb.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package pimonitor.screens | ||
|
||
import com.codeborne.selenide.Selectors.withText | ||
import pimonitor.screens.authentication.SignUpProcess | ||
import pimonitor.screens.dashboard.DashboardScreen | ||
import pimonitor.utils.isVisible | ||
import com.codeborne.selenide.Selenide.`$` as S | ||
|
||
class SignUpProcessWeb : SignUpProcess { | ||
override fun expectToBeSigningUp(): DashboardScreen { | ||
S(withText("Creating your account, please wait . . .")).isVisible() | ||
S(withText("Success. Signing you in, please wait . . .")).isVisible() | ||
S(withText("Dashboard")).isVisible() | ||
return DashboardScreenWeb() | ||
} | ||
} |
Oops, something went wrong.