-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12f7035
commit f2bfa32
Showing
13 changed files
with
141 additions
and
110 deletions.
There are no files selected for viewing
27 changes: 0 additions & 27 deletions
27
app-tests/src/test/scala/app/logorrr/MultipleFileApplicationTest.scala
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
app-tests/src/test/scala/app/logorrr/SingleFileApplicationTest.scala
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
app-tests/src/test/scala/app/logorrr/steps/CanCloseAllFiles.scala
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 app.logorrr.steps | ||
|
||
import app.logorrr.usecases.TestFxBaseApplicationTest | ||
import app.logorrr.views.LogoRRRNodes | ||
import org.testfx.api.FxRobotInterface | ||
|
||
/** | ||
* Mix in if you want to be able to close all files in your test | ||
*/ | ||
trait CanCloseAllFiles { | ||
self: TestFxBaseApplicationTest => | ||
|
||
protected def closeAllFiles(): FxRobotInterface = { | ||
clickOnNode(LogoRRRNodes.FileMenu) | ||
waitForVisibility(LogoRRRNodes.FileMenuCloseAll) | ||
clickOnNode(LogoRRRNodes.FileMenuCloseAll) | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
app-tests/src/test/scala/app/logorrr/steps/CanOpenFile.scala
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,24 @@ | ||
package app.logorrr.steps | ||
|
||
import app.logorrr.io.FileId | ||
import app.logorrr.usecases.TestFxBaseApplicationTest | ||
import app.logorrr.views.LogoRRRNodes | ||
import app.logorrr.views.logfiletab.LogFileTab | ||
|
||
import java.nio.file.Path | ||
|
||
/** | ||
* Mix in if you need to be able to open a file in your test | ||
*/ | ||
trait CanOpenFile { | ||
self: TestFxBaseApplicationTest => | ||
|
||
protected def openFile(path: Path): Unit = { | ||
waitForVisibility(LogoRRRNodes.FileMenu) | ||
clickOnNode(LogoRRRNodes.FileMenu) | ||
waitForVisibility(LogoRRRNodes.FileMenuOpenFile) | ||
clickOnNode(LogoRRRNodes.FileMenuOpenFile) | ||
waitForVisibility(LogFileTab.idFor(FileId(path))) | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
app-tests/src/test/scala/app/logorrr/steps/CanStartApplication.scala
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,22 @@ | ||
package app.logorrr.steps | ||
|
||
import app.logorrr.conf.Settings | ||
import app.logorrr.services.LogoRRRServices | ||
import app.logorrr.LogoRRRApp | ||
import app.logorrr.usecases.TestFxBaseApplicationTest | ||
import javafx.stage.Stage | ||
|
||
/** | ||
* Startup LogoRRR | ||
*/ | ||
trait CanStartApplication { | ||
self: TestFxBaseApplicationTest => | ||
|
||
def services: LogoRRRServices | ||
|
||
@throws[Exception] | ||
override def start(stage: Stage): Unit = { | ||
LogoRRRApp.start(stage, Settings.Default, services) | ||
stage.toFront() | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app-tests/src/test/scala/app/logorrr/usecases/MultipleFileApplicationTest.scala
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,24 @@ | ||
package app.logorrr.usecases | ||
|
||
import app.logorrr.services.LogoRRRServices | ||
import app.logorrr.services.fileservices.OpenMultipleFilesService | ||
import app.logorrr.services.hostservices.MockHostServices | ||
import app.logorrr.steps.{CanOpenFile, CanStartApplication} | ||
|
||
import java.nio.file.Path | ||
|
||
/** | ||
* Extend this class if you have tests which involve more than one file | ||
* | ||
* @param files files which are supported for this test | ||
*/ | ||
class MultipleFileApplicationTest(val files: Seq[Path]) | ||
extends TestFxBaseApplicationTest | ||
with CanStartApplication | ||
with CanOpenFile { | ||
|
||
val services = LogoRRRServices(new MockHostServices | ||
, new OpenMultipleFilesService(files) | ||
, isUnderTest = true) | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
app-tests/src/test/scala/app/logorrr/usecases/SingleFileApplicationTest.scala
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,24 @@ | ||
package app.logorrr.usecases | ||
|
||
import app.logorrr.services.LogoRRRServices | ||
import app.logorrr.services.fileservices.OpenSingleFileService | ||
import app.logorrr.services.hostservices.MockHostServices | ||
import app.logorrr.steps.{CanOpenFile, CanStartApplication} | ||
|
||
import java.nio.file.Path | ||
|
||
|
||
/** | ||
* Test which work with a single file can extend this test | ||
*/ | ||
class SingleFileApplicationTest(val path: Path) | ||
extends TestFxBaseApplicationTest | ||
with CanStartApplication | ||
with CanOpenFile{ | ||
|
||
val services = LogoRRRServices(new MockHostServices | ||
, new OpenSingleFileService(Option(path)) | ||
, isUnderTest = true) | ||
|
||
|
||
} |
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
21 changes: 9 additions & 12 deletions
21
...st/scala/app/logorrr/usecases/openclose/OpenAndCloseFileTestViaFileMenuCloseAllTest.scala
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