mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
✅ Localization support for in test files
This commit is contained in:
@ -16,13 +16,6 @@ final class StartupTest: UITestCase {
|
||||
|
||||
override func tearDownWithError() throws {}
|
||||
|
||||
func testApplicationCanLaunchWithTestConfigurationAndIdles() throws {
|
||||
let app = XCPMApplication()
|
||||
app.withConfiguration(TestableConfigurations.working)
|
||||
app.launch()
|
||||
sleep(5)
|
||||
}
|
||||
|
||||
func testApplicationCanLaunchWithTestConfigurationAndThrowsAlert() throws {
|
||||
var configuration = TestableConfigurations.working
|
||||
configuration.filesystem["/opt/homebrew/bin/php"] = nil // PHP binary must be missing
|
||||
@ -33,25 +26,52 @@ final class StartupTest: UITestCase {
|
||||
|
||||
// Dialog 1: "PHP is not correctly installed"
|
||||
assertAllExist([
|
||||
app.dialogs["Notice"],
|
||||
app.staticTexts["PHP is not correctly installed"],
|
||||
app.buttons["OK"],
|
||||
app.dialogs["generic.notice".localized],
|
||||
app.staticTexts["startup.errors.php_binary.title".localized],
|
||||
app.buttons["generic.ok".localized],
|
||||
])
|
||||
click(app.buttons["OK"])
|
||||
click(app.buttons["generic.ok".localized])
|
||||
|
||||
// Dialog 2: PHP Monitor failed to start
|
||||
assertAllExist([
|
||||
app.dialogs["Notice"],
|
||||
app.staticTexts["PHP Monitor cannot start due to a problem with your system configuration"],
|
||||
app.buttons["Retry"],
|
||||
app.buttons["Quit"]
|
||||
app.dialogs["generic.notice".localized],
|
||||
app.staticTexts["alert.cannot_start.title".localized],
|
||||
app.buttons["alert.cannot_start.retry".localized],
|
||||
app.buttons["alert.cannot_start.close".localized]
|
||||
])
|
||||
click(app.buttons["Retry"])
|
||||
click(app.buttons["alert.cannot_start.retry".localized])
|
||||
|
||||
// Dialog 1 again
|
||||
assertExists(app.staticTexts["PHP is not correctly installed"])
|
||||
assertExists(app.staticTexts["startup.errors.php_binary.title".localized])
|
||||
|
||||
// At this point, we can terminate the test
|
||||
app.terminate()
|
||||
}
|
||||
|
||||
func testApplicationCanWarnAboutPhpFpmIssue() throws {
|
||||
var configuration = TestableConfigurations.working
|
||||
configuration.filesystem["/opt/homebrew/etc/php/8.1/php-fpm.d/valet-fpm.conf"] = nil
|
||||
|
||||
let app = XCPMApplication()
|
||||
app.withConfiguration(configuration)
|
||||
app.launch()
|
||||
|
||||
assertExists(app.staticTexts["alert.php_fpm_broken.title".localized], 3.0)
|
||||
click(app.buttons["generic.ok".localized])
|
||||
}
|
||||
|
||||
func testApplicationCanLaunchWithTestConfigurationAndCanClickMenuItem() throws {
|
||||
let app = XCPMApplication()
|
||||
app.withConfiguration(TestableConfigurations.working)
|
||||
app.launch()
|
||||
|
||||
// Note: If this fails here, make sure the menu bar item can be displayed
|
||||
// If you use Bartender or something like this, this item may be hidden and tests will fail
|
||||
let statusBarItem = app.statusItems.firstMatch
|
||||
statusBarItem.click()
|
||||
assertAllExist([
|
||||
app.menuItems["mi_about".localized],
|
||||
app.menuItems["mi_quit".localized]
|
||||
])
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user