add FirefoxKtTest.kt

merge-requests/2/head
az 2 years ago
parent e428287790
commit 8767716908

@ -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
cmd("snap remove firefox", sudo = true)
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…
Cancel
Save