Adiciona Plano Bíblia em 180 Dias com lembrete diário e ícone do app
- Leitor bíblico consumindo a API NBV (bible.falehandix.com.br): lista de livros por testamento e leitura de capítulos - Plano de 180 dias com três trilhas diárias (História, Sabedoria e Profetas, Novo Testamento) geradas deterministicamente sobre o cânon embutido (1.189 capítulos, cobertura testada) - Lembrete diário via notificação local recorrente (UNCalendarNotificationTrigger, identificador fixo, sem duplicatas), com pedido de autorização em contexto, configurações de horário/som, e deep link da notificação para a Leitura de Hoje - Estado do plano em SwiftData: progresso, pausa/retomada, reinício e conclusão preservando preferências do lembrete - 15 testes unitários (Testing) e 2 testes de UI (XCUIAutomation) - Ícone do app a partir do logo biblia.png Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,34 +10,70 @@ import XCTest
|
||||
final class Bible_WeekUITests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
|
||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
||||
continueAfterFailure = false
|
||||
|
||||
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
/// Fluxo da aba Bíblia: lista de livros -> Gênesis -> leitura do capítulo 1.
|
||||
@MainActor
|
||||
func testExample() throws {
|
||||
// UI tests must launch the application that they test.
|
||||
func testNavigateToGenesisChapter1() throws {
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
// XCUIAutomation Documentation
|
||||
// https://developer.apple.com/documentation/xcuiautomation
|
||||
// Espera a lista de livros carregar da API.
|
||||
let genesis = app.staticTexts["Gênesis"]
|
||||
XCTAssertTrue(genesis.waitForExistence(timeout: 15), "Lista de livros não carregou")
|
||||
genesis.tap()
|
||||
|
||||
// Espera o texto do capítulo 1 aparecer (Gn 1:1).
|
||||
let firstVerse = app.staticTexts.containing(
|
||||
NSPredicate(format: "label CONTAINS[cd] 'princípio'")
|
||||
).firstMatch
|
||||
XCTAssertTrue(firstVerse.waitForExistence(timeout: 15), "Capítulo 1 de Gênesis não carregou")
|
||||
|
||||
// Pausa para inspeção visual/screenshot externo.
|
||||
sleep(4)
|
||||
}
|
||||
|
||||
/// Fluxo do plano: começar o Plano de 180 Dias, ativar o lembrete diário
|
||||
/// (aceitando a permissão do iOS) e verificar o chip e a Leitura de Hoje.
|
||||
@MainActor
|
||||
func testLaunchPerformance() throws {
|
||||
// This measures how long it takes to launch your application.
|
||||
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
||||
XCUIApplication().launch()
|
||||
func testStartPlanAndEnableDailyReminder() throws {
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments += ["--reset-plan"]
|
||||
app.launch()
|
||||
|
||||
// Vai para a aba Plano.
|
||||
let planTab = app.tabBars.buttons["Plano"]
|
||||
XCTAssertTrue(planTab.waitForExistence(timeout: 10), "Aba Plano não encontrada")
|
||||
planTab.tap()
|
||||
|
||||
// Inicia o plano.
|
||||
let startButton = app.buttons["Começar plano"]
|
||||
XCTAssertTrue(startButton.waitForExistence(timeout: 10), "Botão de começar o plano não apareceu")
|
||||
startButton.tap()
|
||||
|
||||
// Prompt contextual do lembrete.
|
||||
let activateButton = app.buttons["Ativar lembrete"]
|
||||
XCTAssertTrue(activateButton.waitForExistence(timeout: 5), "Prompt do lembrete não apareceu")
|
||||
activateButton.tap()
|
||||
|
||||
// Alerta de permissão do iOS (só aparece na primeira autorização).
|
||||
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
|
||||
let allowButton = springboard.buttons["Allow"].exists
|
||||
? springboard.buttons["Allow"]
|
||||
: springboard.buttons["Permitir"]
|
||||
if allowButton.waitForExistence(timeout: 5) {
|
||||
allowButton.tap()
|
||||
}
|
||||
|
||||
// De volta ao plano: chip do lembrete e Leitura de Hoje visíveis.
|
||||
let chip = app.staticTexts["Lembrete às 20:00"]
|
||||
XCTAssertTrue(chip.waitForExistence(timeout: 10), "Chip do lembrete não apareceu")
|
||||
|
||||
XCTAssertTrue(app.staticTexts["Dia 1 de 180"].exists, "Cabeçalho do dia não apareceu")
|
||||
XCTAssertTrue(app.staticTexts["Novo Testamento"].waitForExistence(timeout: 5), "Trilhas da Leitura de Hoje não apareceram")
|
||||
|
||||
// Pausa para inspeção visual/screenshot externo.
|
||||
sleep(4)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user