forked from woocommerce/woocommerce-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoginTests.swift
More file actions
54 lines (44 loc) · 2 KB
/
LoginTests.swift
File metadata and controls
54 lines (44 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import UITestsFoundation
import XCTest
final class LoginTests: XCTestCase {
override func setUp() {
continueAfterFailure = false
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launchArguments = ["logout-at-launch", "disable-animations", "mocked-wpcom-api", "-ui_testing"]
app.launch()
}
// Login with Store Address and log out.
func testSiteAddressLoginLogout() throws {
let prologue = try PrologueScreen().selectSiteAddress()
.proceedWith(siteUrl: TestCredentials.siteUrl)
.proceedWith(email: TestCredentials.emailAddress)
.proceedWith(password: TestCredentials.password)
.verifyEpilogueDisplays(displayName: TestCredentials.displayName, siteUrl: TestCredentials.siteUrl)
.continueWithSelectedSite()
// Log out
.openSettingsPane()
.verifySelectedStoreDisplays(storeName: TestCredentials.storeName, siteUrl: TestCredentials.siteUrl)
.logOut()
XCTAssert(prologue.isLoaded)
}
//Login with WordPress.com account and log out
func testWordPressLoginLogout() throws {
let prologue = try PrologueScreen().selectContinueWithWordPress()
.proceedWith(email: TestCredentials.emailAddress)
.proceedWith(password: TestCredentials.password)
.verifyEpilogueDisplays(displayName: TestCredentials.displayName, siteUrl: TestCredentials.siteUrl)
.continueWithSelectedSite()
// Log out
.openSettingsPane()
.verifySelectedStoreDisplays(storeName: TestCredentials.storeName, siteUrl: TestCredentials.siteUrl)
.logOut()
XCTAssert(prologue.isLoaded)
}
func testWordPressUnsuccessfullLogin() throws {
_ = try PrologueScreen().selectContinueWithWordPress()
.proceedWith(email: TestCredentials.emailAddress)
.tryProceed(password: "invalidPswd")
.verifyLoginError()
}
}