Skip to content

Commit

Permalink
rename vars for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
jostnes committed Jul 12, 2023
1 parent 77e9d12 commit 57879d5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions WordPress/UITests/Flows/LoginFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class LoginFlow {

// Login with WP site via Site Address.
@discardableResult
static func login(siteUrl: String, email: String, password: String, title: String? = nil) throws -> MySiteScreen {
static func login(siteUrl: String, email: String, password: String, selectedSiteTitle: String? = nil) throws -> MySiteScreen {
return try PrologueScreen()
.selectSiteAddress()
.proceedWithWP(siteUrl: siteUrl)
.proceedWith(email: email)
.proceedWithValidPassword()
.continueWithSelectedSite(title: title)
.continueWithSelectedSite(title: selectedSiteTitle)
}

// Login with self-hosted site via Site Address.
Expand Down
40 changes: 20 additions & 20 deletions WordPress/UITests/Tests/EditorGutenbergTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,48 @@ class EditorGutenbergTests: XCTestCase {
takeScreenshotOfFailedTest()
}

let title = "Rich post title"
let content = "Some text, and more text"
let postTitle = "Rich post title"
let postContent = "Some text, and more text"
let videoUrlPath = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
let audioUrlPath = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4"

func testTextPostPublish() throws {

try BlockEditorScreen()
.enterTextInTitle(text: title)
.addParagraphBlock(withText: content)
.verifyContentStructure(blocks: 1, words: content.components(separatedBy: " ").count, characters: content.count)
.enterTextInTitle(text: postTitle)
.addParagraphBlock(withText: postContent)
.verifyContentStructure(blocks: 1, words: postContent.components(separatedBy: " ").count, characters: postContent.count)
.publish()
.viewPublishedPost(withTitle: title)
.verifyEpilogueDisplays(postTitle: title, siteAddress: WPUITestCredentials.testWPcomSitePrimaryAddress)
.done()
.viewPublishedPost(withTitle: postTitle)
.verifyEpilogueDisplays(postTitle: postTitle, siteAddress: WPUITestCredentials.testWPcomSitePrimaryAddress)
.tapDone()
}

func testBasicPostPublishWithCategoryAndTag() throws {

let category = getCategory()
let tag = getTag()
try BlockEditorScreen()
.enterTextInTitle(text: title)
.addParagraphBlock(withText: content)
.enterTextInTitle(text: postTitle)
.addParagraphBlock(withText: postContent)
.addImage()
.verifyContentStructure(blocks: 2, words: content.components(separatedBy: " ").count, characters: content.count)
.verifyContentStructure(blocks: 2, words: postContent.components(separatedBy: " ").count, characters: postContent.count)
.openPostSettings()
.selectCategory(name: category)
.addTag(name: tag)
.closePostSettings()
.publish()
.viewPublishedPost(withTitle: title)
.verifyEpilogueDisplays(postTitle: title, siteAddress: WPUITestCredentials.testWPcomSitePrimaryAddress)
.done()
.viewPublishedPost(withTitle: postTitle)
.verifyEpilogueDisplays(postTitle: postTitle, siteAddress: WPUITestCredentials.testWPcomSitePrimaryAddress)
.tapDone()
}

func testAddRemoveFeaturedImage() throws {

try BlockEditorScreen()
.enterTextInTitle(text: title)
.addParagraphBlock(withText: content)
.verifyContentStructure(blocks: 1, words: content.components(separatedBy: " ").count, characters: content.count)
.enterTextInTitle(text: postTitle)
.addParagraphBlock(withText: postContent)
.verifyContentStructure(blocks: 1, words: postContent.components(separatedBy: " ").count, characters: postContent.count)
.openPostSettings()
.setFeaturedImage()
.verifyPostSettings(hasImage: true)
Expand All @@ -73,10 +73,10 @@ class EditorGutenbergTests: XCTestCase {

func testAddGalleryBlock() throws {
try BlockEditorScreen()
.enterTextInTitle(text: title)
.addParagraphBlock(withText: content)
.enterTextInTitle(text: postTitle)
.addParagraphBlock(withText: postContent)
.addImageGallery()
.verifyContentStructure(blocks: 2, words: content.components(separatedBy: " ").count, characters: content.count)
.verifyContentStructure(blocks: 2, words: postContent.components(separatedBy: " ").count, characters: postContent.count)
}

func testAddMediaBlocks() throws {
Expand Down
14 changes: 7 additions & 7 deletions WordPress/UITests/Tests/PostTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PostTests: XCTestCase {
siteUrl: WPUITestCredentials.testWPcomSiteAddress,
email: WPUITestCredentials.testWPcomUserEmail,
password: WPUITestCredentials.testWPcomPassword,
title: WPUITestCredentials.testWPcomSiteForScheduledPost
selectedSiteTitle: WPUITestCredentials.testWPcomSiteForScheduledPost
)

try TabNavComponent()
Expand All @@ -22,18 +22,18 @@ class PostTests: XCTestCase {
takeScreenshotOfFailedTest()
}

let title = "Scheduled Post"
let postTitle = "Scheduled Post"

func testCreateScheduledPost() throws {
try BlockEditorScreen()
.enterTextInTitle(text: title)
.enterTextInTitle(text: postTitle)
.openPostSettings()
.updatePublishDate()
.updatePublishDateToFutureDate()
.closePublishDateSelector()
.closePostSettings()
.schedulePost()
.viewPublishedPost(withTitle: title)
.verifyEpilogueDisplays(postTitle: title, siteAddress: WPUITestCredentials.testWPcomSiteForScheduledPost)
.done()
.viewPublishedPost(withTitle: postTitle)
.verifyEpilogueDisplays(postTitle: postTitle, siteAddress: WPUITestCredentials.testWPcomSiteForScheduledPost)
.tapDone()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class EditorPublishEpilogueScreen: ScreenObject {
}

/// - Note: Returns `Void` since the return screen depends on which screen we started from.
public func done() {
public func tapDone() {
doneButton.tap()
}

Expand Down

0 comments on commit 57879d5

Please sign in to comment.