Skip to content

Commit

Permalink
Implement test for login with incorrect credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasberglund committed Jan 11, 2024
1 parent 695178d commit a2ade8a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
18 changes: 18 additions & 0 deletions ios/MullvadVPNUITests/AccountTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,22 @@ final class AccountTests: XCTestCase {
.verifySuccessIconShown()
.verifyDeviceLabelShown()
}

func testLoginWithIncorrectAccountNumber() throws {
let app = XCUIApplication()
app.launch()

TermsOfServicePage(app)
.tapAgree()

Alert(app)
.tapOkay()

LoginPage(app)
.tapAccountNumberTextField()
.enterText("1234123412341234")
.tapAccountNumberSubmitButton()
.verifyFailIconShown()
.waitForPageToBeShown() // Verify still on login page
}
}
2 changes: 1 addition & 1 deletion ios/MullvadVPNUITests/Pages/Alert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import XCTest
Generic alert "page".
*/
class Alert: Page {
override init(_ app: XCUIApplication) {
@discardableResult override init(_ app: XCUIApplication) {
super.init(app)

self.pageAccessibilityIdentifier = .alertContainerView
Expand Down
7 changes: 6 additions & 1 deletion ios/MullvadVPNUITests/Pages/LoginPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import XCTest

class LoginPage: Page {
override init(_ app: XCUIApplication) {
@discardableResult override init(_ app: XCUIApplication) {
super.init(app)

self.pageAccessibilityIdentifier = .loginView
Expand All @@ -36,4 +36,9 @@ class LoginPage: Page {
app.images.element(matching: .image, identifier: "IconSuccess")
return self
}

@discardableResult public func verifyFailIconShown() -> Self {
app.images.element(matching: .image, identifier: "IconFail")
return self
}
}
2 changes: 1 addition & 1 deletion ios/MullvadVPNUITests/Pages/TermsOfServicePage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import XCTest

class TermsOfServicePage: Page {
override init(_ app: XCUIApplication) {
@discardableResult override init(_ app: XCUIApplication) {
super.init(app)

self.pageAccessibilityIdentifier = .termsOfServiceView
Expand Down

0 comments on commit a2ade8a

Please sign in to comment.