Last active
September 18, 2020 06:57
-
-
Save subdan/c5698fac4ce102b8d72ce8a79f86895d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
final class LoginAnalyticsTests: TestBase { | |
private let auth = LoginScreen() | |
private let onboarding = OnboardingScreen() | |
// Открытие экрана авторизации | |
func testOpenAuthMetricEvent() { | |
launchApp(with: .init(skipAuth: false, sendMetricsToPasteboard: true)) | |
waitForElement(onboarding.continueButton) | |
onboarding.continueButton.tap() | |
waitForElement(auth.helpButton) | |
analytics.assertContains(name: "open_auth") | |
} | |
// Успешная авторизация | |
func testAuthMetricEvent() { | |
launchApp(with: .init(skipAuth: false, sendMetricsToPasteboard: true)) | |
waitForElement(onboarding.continueButton) | |
onboarding.continueButton.tap() | |
waitForElement(auth.helpButton) | |
auth.fillLogin(login: "login@log.in") | |
auth.fillPassword(password: "password") | |
auth.loginButton.tap() | |
analytics.assertContains("authorization", ["response_type": "success"]) | |
} | |
// Не удалось авторизоваться | |
func testAuthErrorMetricEvent() { | |
addMock(LoginMock.auth_401_invalid_credentials) | |
launchApp(with: .init(skipAuth: false, sendMetricsToPasteboard: true)) | |
waitForElement(onboarding.continueButton) | |
onboarding.continueButton.tap() | |
waitForElement(auth.helpButton) | |
auth.fillLogin(login: "login@log.in") | |
auth.fillPassword(password: "password") | |
auth.loginButton.tap() | |
waitForElement(auth.snackText) | |
analytics.assertContains("authorization", ["response_type": "error"]) | |
} | |
// Помощь по входу | |
func testAuthHelpMetricEvent() { | |
launchApp(with: .init(skipAuth: false, sendMetricsToPasteboard: true)) | |
waitForElement(onboarding.continueButton) | |
onboarding.continueButton.tap() | |
waitForElement(auth.helpButton) | |
auth.helpButton.tap() | |
analytics.assertContains(name: "auth_help") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment