add FirefoxKtTest.kt
This commit is contained in:
parent
e428287790
commit
8767716908
2 changed files with 32 additions and 6 deletions
|
@ -1,20 +1,23 @@
|
|||
package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
||||
|
||||
import org.domaindrivenarchitecture.provs.framework.core.Prov
|
||||
import org.domaindrivenarchitecture.provs.framework.core.writeToFile
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.addTextToFile
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstallFromPpa
|
||||
import java.io.File
|
||||
|
||||
|
||||
fun Prov.installFirefox(
|
||||
/**
|
||||
* Installs non-snap firefox, removing a firefox snap-installation if existing
|
||||
*/
|
||||
fun Prov.installFirefox() = task {
|
||||
|
||||
) = task {
|
||||
// inspired by: https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04
|
||||
|
||||
if (chk("snap list | grep firefox")) {
|
||||
cmd("snap remove firefox", sudo = true)
|
||||
}
|
||||
aptInstall("software-properties-common")
|
||||
cmd("sudo add-apt-repository -y ppa:mozillateam/ppa")
|
||||
cmd("add-apt-repository -y ppa:mozillateam/ppa", sudo = true)
|
||||
|
||||
addTextToFile(
|
||||
"\nPackage: *\n" +
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
||||
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
|
||||
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
||||
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class FirefoxKtTest {
|
||||
|
||||
@Test
|
||||
@ExtensiveContainerTest
|
||||
fun installFirefox() {
|
||||
// when
|
||||
val res = defaultTestContainer().installFirefox()
|
||||
|
||||
// then
|
||||
assertTrue(res.success)
|
||||
|
||||
val ffIsInstalled = defaultTestContainer().isPackageInstalled("firefox")
|
||||
assertTrue(ffIsInstalled)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue