Skip to content

Conversation

@MaxCode2023
Copy link
Owner

No description provided.

func code(from url: URL) -> String?
}

class AuthHelper: AuthHelperProtocol {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь стоит указать его как final

if segue.identifier == segueID {
guard
let webViewViewController = segue.destination as? WebViewViewController
else { fatalError("Failed to prepare for \(segueID)") }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По своему опыту хотел бы отметить, что в продакшене не используют fatalError, советую заменить на assertionFailure.

}

func logout(completion: @escaping () -> Void) {
authToken?.removeAll()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Данный вызов не удаляет токен, он присваивает authToken пустую строку, которая записывается в значениие токена, затем в SplashScreene у тебя идет проверка на nil, а пустая строка != nil.
Здесь стоит присваивать nil, в результате чего удалиться значение токена

// func configure(_ presenter: WebViewPresenterProtocol) {
// self.presenter = presenter
// self.presenter?.view = self
// }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рекомендую удалить в проекте лишний закомментированный код

webView.navigationDelegate = self
webView.accessibilityActivate()
// configure(WebViewPresenter(authHelper: AuthHelper()))
presenter?.viewDidLoad()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для того, чтобы заработал ProgressBar здесь нужно присвоить значение estimatedProgressObservation:
estimatedProgressObservation = webView.observe(
.estimatedProgress,
options: [],
changeHandler: { [weak self] _ , _ in
guard let self else { return }
self.presenter?.didUpdateProgressValue(self.webView.estimatedProgress)
})

}

override func viewWillAppear(_ animated: Bool) {
// rescaleAndCenterImageInScrollView(image: imageView.image!)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не используется

UIBlockingProgressHUD.show()
} else {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let authViewController = storyboard.instantiateViewController(withIdentifier: "AuthViewController") as! AuthViewController

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рекомендую сделать проверку через guard let

}

private func switchToTabBarController() {
guard let window = UIApplication.shared.windows.first else { fatalError("Invalid Configuration") }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рекомендую заменить на assertionFailure

let loginTextField = webView.descendants(matching: .textField).element
XCTAssertTrue(loginTextField.waitForExistence(timeout: 5))
loginTextField.tap()
loginTextField.typeText("course.ios@artsofte.ru")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рекомендую вынести в константы логины, пароли и оставить пустым

}

func testProfile() throws {
app.tabBars.buttons.element(boundBy: 1).tap()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рекомендую делать поиск по идентификатору

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants