Skip to content

Commit

Permalink
Merge pull request #102 from wordpress-mobile/fix/signup-a11y-ids
Browse files Browse the repository at this point in the history
Add accessibility identifiers needed for UI tests
  • Loading branch information
rachelmcr authored Jun 17, 2019
2 parents 7a60074 + c4f6279 commit a440875
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion WordPressAuthenticator.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "WordPressAuthenticator"
s.version = "1.5.3-beta.1"
s.version = "1.5.3-beta.2"
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."

s.description = <<-DESC
Expand Down
11 changes: 7 additions & 4 deletions WordPressAuthenticator/NUX/NUXButtonViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,19 @@ open class NUXButtonViewController: UIViewController {
///
/// - Parameters:
/// - primary: Title string for primary button. Required.
/// - primaryAccessibilityId: Accessibility identifier string for primary button. Optional.
/// - secondary: Title string for secondary button. Optional.
/// - secondaryAccessibilityId: Accessibility identifier string for secondary button. Optional.
/// - tertiary: Title string for the tertiary button. Optional.
/// - tertiaryAccessibilityId: Accessibility identifier string for tertiary button. Optional.
///
public func setButtonTitles(primary: String, secondary: String? = nil, tertiary: String? = nil) {
bottomButtonConfig = NUXButtonConfig(title: primary, isPrimary: true, callback: nil)
public func setButtonTitles(primary: String, primaryAccessibilityId: String? = nil, secondary: String? = nil, secondaryAccessibilityId: String? = nil, tertiary: String? = nil, tertiaryAccessibilityId: String? = nil) {
bottomButtonConfig = NUXButtonConfig(title: primary, isPrimary: true, accessibilityIdentifier: primaryAccessibilityId, callback: nil)
if let secondaryTitle = secondary {
topButtonConfig = NUXButtonConfig(title: secondaryTitle, isPrimary: false, callback: nil)
topButtonConfig = NUXButtonConfig(title: secondaryTitle, isPrimary: false, accessibilityIdentifier: secondaryAccessibilityId, callback: nil)
}
if let tertiaryTitle = tertiary {
tertiaryButtonConfig = NUXButtonConfig(title: tertiaryTitle, isPrimary: false, callback: nil)
tertiaryButtonConfig = NUXButtonConfig(title: tertiaryTitle, isPrimary: false, accessibilityIdentifier: tertiaryAccessibilityId, callback: nil)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class LoginPrologueSignupMethodViewController: NUXViewController {

let loginTitle = NSLocalizedString("Sign up with Email", comment: "Button title. Tapping begins our normal sign up process.")
let createTitle = NSLocalizedString("Sign up with Google", comment: "Button title. Tapping begins sign up using Google.")
buttonViewController.setupTopButton(title: loginTitle, isPrimary: false) { [weak self] in
buttonViewController.setupTopButton(title: loginTitle, isPrimary: false, accessibilityIdentifier: "Sign up with Email Button") { [weak self] in
defer {
WordPressAuthenticator.track(.signupEmailButtonTapped)
}
self?.dismiss(animated: true)
self?.emailTapped?()
}

buttonViewController.setupBottomButton(title: createTitle, isPrimary: false) { [weak self] in
buttonViewController.setupBottomButton(title: createTitle, isPrimary: false, accessibilityIdentifier: "Sign up with Google Button") { [weak self] in
defer {
WordPressAuthenticator.track(.signupSocialButtonTapped)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class LoginPrologueViewController: LoginViewController {
buttonViewController.setupTopButton(title: loginTitle, isPrimary: true, accessibilityIdentifier: "Prologue Log In Button") { [weak self] in
self?.loginTapped()
}
buttonViewController.setupBottomButton(title: createTitle, isPrimary: false) { [weak self] in
buttonViewController.setupBottomButton(title: createTitle, isPrimary: false, accessibilityIdentifier: "Prologue Signup Button") { [weak self] in
self?.signupTapped()
}
if showCancel {
Expand Down

0 comments on commit a440875

Please sign in to comment.