mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-08 03:34:13 -04:00
Create UI tests for iPad
This commit is contained in:
parent
120802b629
commit
4f62e315f5
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -79,6 +79,10 @@ jobs:
|
|||||||
if: matrix.platform == 'iOS'
|
if: matrix.platform == 'iOS'
|
||||||
run: xcodebuild test -scheme UITests_iPhone -destination 'platform=iOS Simulator,name=iPhone 16 Pro'
|
run: xcodebuild test -scheme UITests_iPhone -destination 'platform=iOS Simulator,name=iPhone 16 Pro'
|
||||||
|
|
||||||
|
- name: Run UI Tests on iPhone
|
||||||
|
if: matrix.platform == 'iOS'
|
||||||
|
run: xcodebuild test -scheme UITests_iPad -destination 'platform=iOS Simulator,name=iPad Pro 13-inch'
|
||||||
|
|
||||||
- name: Run UI Tests on macOS
|
- name: Run UI Tests on macOS
|
||||||
if: matrix.platform == 'macOS'
|
if: matrix.platform == 'macOS'
|
||||||
run: xcodebuild test -scheme UITests_macOS -destination 'platform=macOS'
|
run: xcodebuild test -scheme UITests_macOS -destination 'platform=macOS'
|
||||||
|
@ -72,6 +72,7 @@ final class SidebarViewController: UICollectionViewController, NSFetchedResultsC
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
super.init(collectionViewLayout: UICollectionViewLayout())
|
super.init(collectionViewLayout: UICollectionViewLayout())
|
||||||
|
collectionView.accessibilityIdentifier = "sidebar_collection_view"
|
||||||
collectionView.collectionViewLayout = UICollectionViewCompositionalLayout { _, layoutEnvironment in
|
collectionView.collectionViewLayout = UICollectionViewCompositionalLayout { _, layoutEnvironment in
|
||||||
var config = UICollectionLayoutListConfiguration(appearance: .sidebar)
|
var config = UICollectionLayoutListConfiguration(appearance: .sidebar)
|
||||||
config.headerMode = .supplementary
|
config.headerMode = .supplementary
|
||||||
@ -244,6 +245,7 @@ final class SidebarViewController: UICollectionViewController, NSFetchedResultsC
|
|||||||
config.image = UIImage(systemName: item.icon)
|
config.image = UIImage(systemName: item.icon)
|
||||||
config.imageProperties.tintColor = item.iconForegroundColor
|
config.imageProperties.tintColor = item.iconForegroundColor
|
||||||
cell.contentConfiguration = config
|
cell.contentConfiguration = config
|
||||||
|
cell.accessibilityIdentifier = item.accessibilityIdentifier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,6 +290,27 @@ enum MenuItem: Hashable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var accessibilityIdentifier: String {
|
||||||
|
switch self {
|
||||||
|
case .tab:
|
||||||
|
"tab"
|
||||||
|
case .bookmarks:
|
||||||
|
"bookmarks"
|
||||||
|
case .opened:
|
||||||
|
"opened"
|
||||||
|
case .categories:
|
||||||
|
"categories"
|
||||||
|
case .new:
|
||||||
|
"new"
|
||||||
|
case .downloads:
|
||||||
|
"downloads"
|
||||||
|
case .settings:
|
||||||
|
"settings"
|
||||||
|
case .donation:
|
||||||
|
"donation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var icon: String {
|
var icon: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .bookmarks:
|
case .bookmarks:
|
||||||
|
45
UITests_iPad/LoadingUI_iPad_Test.swift
Normal file
45
UITests_iPad/LoadingUI_iPad_Test.swift
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// This file is part of Kiwix for iOS & macOS.
|
||||||
|
//
|
||||||
|
// Kiwix is free software; you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 3 of the License, or
|
||||||
|
// any later version.
|
||||||
|
//
|
||||||
|
// Kiwix is distributed in the hope that it will be useful, but
|
||||||
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Kiwix; If not, see https://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
import XCTest
|
||||||
|
|
||||||
|
final class LoadingUI_iPad_Test: XCTestCase {
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
func testLaunchingApp_on_iPad() throws {
|
||||||
|
|
||||||
|
if !XCUIDevice.shared.orientation.isLandscape {
|
||||||
|
XCUIDevice.shared.orientation = .landscapeLeft
|
||||||
|
}
|
||||||
|
|
||||||
|
let app = XCUIApplication()
|
||||||
|
app.launchArguments = ["ui_testing"]
|
||||||
|
app.activate()
|
||||||
|
|
||||||
|
app.buttons.matching(identifier: "ToggleSidebar").element.tap()
|
||||||
|
|
||||||
|
let sidebar = app.collectionViews["sidebar_collection_view"]
|
||||||
|
|
||||||
|
XCTAssert(sidebar.cells["New Tab"].isSelected)
|
||||||
|
|
||||||
|
sidebar.cells["bookmarks"].tap()
|
||||||
|
sidebar.cells["opened"].tap()
|
||||||
|
sidebar.cells["categories"].tap()
|
||||||
|
sidebar.cells["downloads"].tap()
|
||||||
|
sidebar.cells["new"].tap()
|
||||||
|
sidebar.cells["settings"].tap()
|
||||||
|
sidebar.cells["donation"].tap()
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,7 @@ final class LoadingUI_macOS_Test: XCTestCase {
|
|||||||
func testSideBarItems() throws {
|
func testSideBarItems() throws {
|
||||||
// UI tests must launch the application that they test.
|
// UI tests must launch the application that they test.
|
||||||
let app = XCUIApplication()
|
let app = XCUIApplication()
|
||||||
|
app.launchArguments = ["ui_testing"]
|
||||||
app.activate()
|
app.activate()
|
||||||
app/*@START_MENU_TOKEN@*/.staticTexts["Bookmarks"]/*[[".cells.staticTexts[\"Bookmarks\"]",".staticTexts[\"Bookmarks\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.click()
|
app/*@START_MENU_TOKEN@*/.staticTexts["Bookmarks"]/*[[".cells.staticTexts[\"Bookmarks\"]",".staticTexts[\"Bookmarks\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.click()
|
||||||
|
|
||||||
|
23
project.yml
23
project.yml
@ -167,6 +167,20 @@ targets:
|
|||||||
dependencies:
|
dependencies:
|
||||||
- target: Kiwix
|
- target: Kiwix
|
||||||
|
|
||||||
|
UITests_iPad:
|
||||||
|
type: bundle.ui-testing
|
||||||
|
supportedDestinations: [iOS]
|
||||||
|
settings:
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER: org.kiwix.UITests
|
||||||
|
# TEST_HOST: $(BUILT_PRODUCTS_DIR)/Kiwix.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Kiwix
|
||||||
|
BUNDLE_LOADER: $(TEST_HOST)
|
||||||
|
entitlements:
|
||||||
|
path: Support/Kiwix-unitTest.entitlements
|
||||||
|
sources:
|
||||||
|
- path: UITests_iPad
|
||||||
|
dependencies:
|
||||||
|
- target: Kiwix
|
||||||
|
|
||||||
schemes:
|
schemes:
|
||||||
Kiwix:
|
Kiwix:
|
||||||
build:
|
build:
|
||||||
@ -198,3 +212,12 @@ schemes:
|
|||||||
- UITests_iPhone
|
- UITests_iPhone
|
||||||
commandLineArguments:
|
commandLineArguments:
|
||||||
testing: true
|
testing: true
|
||||||
|
UITests_iPad:
|
||||||
|
build:
|
||||||
|
targets:
|
||||||
|
Kiwix: all
|
||||||
|
test:
|
||||||
|
targets:
|
||||||
|
- UITests_iPad
|
||||||
|
commandLineArguments:
|
||||||
|
testing: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user