Closed ken4ward closed 6 months ago
The error seems to be unrelated to rules_xcodeproj. It seems like your error message is coming from running bazel build
or bazel test
, so nothing related to the xcodeproj
rule you have defined.
implicit entry/start for main executable
happens when you don't specify an entry point to your app (read more here). I suggest adding a library to deps
your ios_application
which contains a main entry point and that should fix your issue.
I'm still very new to Bazel, and it's very promising it'll really be helpful in moving forward our complex build and test projects. all I did was to copy and paste the specified rules recommendations on this repo, and expecting it to work out of the box. My project is POC, very simple, and nothing complex. To Bazel professionals here, looking at the project, could you kindly make edits to the BUILD.bazel rules I shared above.
the project structure is not complex, it is simple ios project that has target of XCTest and XCUITest. I attached the screenshot of the structure.
This is the main file // Licensed under the Applitools SDK License, which can be found here: https://www.applitools.com/eula/sdk
import XCTest
import EyesXCUI
class iOSProUITest: XCTestCase {
let application = XCUIApplication()
let eyes = Eyes()
let validationHelper = UIValidationHelper.shared
override func setUp() {
super.setUp()
continueAfterFailure = false
application.launch()
// Initialize configuration
let config = Configuration()
config.apiKey = "R8Ab101J6kTcLav20sMJUjk3XvnYZW7BCOR100do7xXJI7U110"
config.statusBarExists = true
// Initialize the eyes SDK and set up with configuration.
eyes.configuration = config
}
func testExamples() {
let application: XCUIApplication = XCUIApplication()
application.launch()
EarlGrey.selectElement(with: grey_keyWindow()).perform(grey_tap())
}
func testClickObject(){
let radioButtonMatcher = grey_accessibilityID(Configurations.randumNumber)
validationHelper.validateElementExists(radioButtonMatcher)
validationHelper.validateElementClickable(radioButtonMatcher)
EarlGrey.selectElement(with: radioButtonMatcher).performTapAction()
validationHelper.validateRadioButtonSelected(radioButtonMatcher)
let simulateDiffMatcher = grey_accessibilityID(Configurations.simulateDiff)
validationHelper.validateElementExists(simulateDiffMatcher)
validationHelper.validateElementClickable(simulateDiffMatcher)
EarlGrey.selectElement(with: simulateDiffMatcher).performTapAction()
validationHelper.validateRadioButtonSelected(simulateDiffMatcher)
let clickMeMatcher = grey_accessibilityID(Configurations.clickMe)
validationHelper.validateElementExists(clickMeMatcher)
validationHelper.validateElementClickable(clickMeMatcher)
EarlGrey.selectElement(with: clickMeMatcher).performTapAction()
}
func testApplitoolEyes() throws {
// Start the test.
eyes.open(withApplicationName: "Hello World!", testName: "My first test using EyesXCUI SDK!")
// Visual checkpoint #1.
eyes.check(withTag: "Hello", andSettings: Target.window().timeout(inSeconds: 5))
let radioButtonMatcher = grey_accessibilityID(Configurations.clickMe)
validationHelper.validateElementExists(radioButtonMatcher)
validationHelper.validateElementClickable(radioButtonMatcher)
EarlGrey.selectElement(with: radioButtonMatcher).performTapAction()
validationHelper.validateRadioButtonSelected(radioButtonMatcher)
// Visual checkpoint #2.
eyes.check(withTag: "Click!", andSettings: Target.window())
let thumbUpOrBugImageView = application.images["ThumbUpOrBugImageView"]
// Visual checkpoint #3
eyes.check(withTag: "Thumb up", andSettings: Target.element(thumbUpOrBugImageView))
let clickRandumNumber = EarlGrey.selectElement(with: grey_accessibilityID("randumNumber"))
clickRandumNumber.assert(grey_not(grey_selected()))
clickRandumNumber.perform(grey_tap())
let clickSimpleDiff = EarlGrey.selectElement(with: grey_accessibilityID("simulateDiff"))
clickSimpleDiff.assert(grey_not(grey_selected()))
clickSimpleDiff.perform(grey_tap())
// Tap on the "Simulate diffs" checkbox.
// application.buttons["SimulateDiffsCheckbox"].tap()
// Visual checkpoint #4.
eyes.check(withTag: "Simulate Differences!", andSettings: Target.window())
// Click the "Click me!" button.
EarlGrey.selectElement(with: radioButtonMatcher).performTapAction()
// Visual checkpoint #5.
eyes.check(withTag: "Bug has been found!", andSettings: Target.window())
// Visual checkpoint #6
eyes.check(withTag: "Bug", andSettings: Target.element(thumbUpOrBugImageView))
// End the test.
try eyes.close()
}
}
As seen, I installed 2 packages from EarlGrey and Applitool Eyes. Please, someone help. All I want to do is to run the XCUITest and XCTest from Bazel. I can succssfully run it from XCode
Description
I have iOSPro as the main project, and test targets for UI and unit tests as follows: iOSProUITests, iOSProUnitTests. I have this as the BUILD.bazel
The error response
Reproduction steps
Expected behavior
It should build the test
rules_xcodeproj version
1.10.0
Xcode version
Version 14.3.1 (14E300c)
Bazel version
6.3.2
rules_apple version
No response
rules_swift version
No response
Additional information
No response