mirror of
https://dev.azure.com/Foster-X/CMP329%20CW2/_git/CMP329%20CW2
synced 2025-07-27 05:03:31 +00:00
Verify the post has been made
This commit is contained in:
parent
0b79e17915
commit
ed7d898e99
1 changed files with 12 additions and 1 deletions
|
@ -22,10 +22,12 @@ public class TestPoster {
|
||||||
private static final String POST_BUTTON_NAV_ID = "wp-admin-bar-new-content";
|
private static final String POST_BUTTON_NAV_ID = "wp-admin-bar-new-content";
|
||||||
private static final String POST_EDITOR_SWITCH_ID = "content-html";
|
private static final String POST_EDITOR_SWITCH_ID = "content-html";
|
||||||
private static final String PUBLISH_BUTTON_ID = "publish";
|
private static final String PUBLISH_BUTTON_ID = "publish";
|
||||||
|
private static final String DELETE_BUTTON_ID = "delete-action";
|
||||||
private static final String LOGGGEDIN_URL = "https://"+domain+"/wp-admin/";
|
private static final String LOGGGEDIN_URL = "https://"+domain+"/wp-admin/";
|
||||||
private static final String NEW_POST_URL = "https://"+domain+"/wp-admin/post-new.php";
|
private static final String NEW_POST_URL = "https://"+domain+"/wp-admin/post-new.php";
|
||||||
private static final String POST_CONTENT_TEXT = "Lorem ipsum dolor amet";
|
private static final String POST_CONTENT_TEXT = "Lorem ipsum dolor amet";
|
||||||
private static final String POST_TITLE_TEXT = "Lipsum4u";
|
private static final String POST_TITLE_TEXT = "lipsum4u";
|
||||||
|
private static final String POST_URL = "https://"+domain+"/"+POST_TITLE_TEXT+"/";
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@CsvFileSource(resources = "/csv/built/credentials_permissions.csv", numLinesToSkip = 0)
|
@CsvFileSource(resources = "/csv/built/credentials_permissions.csv", numLinesToSkip = 0)
|
||||||
|
|
||||||
|
@ -69,6 +71,15 @@ public class TestPoster {
|
||||||
title.sendKeys(POST_TITLE_TEXT);
|
title.sendKeys(POST_TITLE_TEXT);
|
||||||
content.sendKeys(POST_CONTENT_TEXT);
|
content.sendKeys(POST_CONTENT_TEXT);
|
||||||
publishButton.click();
|
publishButton.click();
|
||||||
|
|
||||||
|
//now to verify the post exists
|
||||||
|
String editURL = driver.getCurrentUrl();
|
||||||
|
driver.get(POST_URL);
|
||||||
|
String postedTitle = driver.getTitle();
|
||||||
|
assertFalse(postedTitle.startsWith("Page not found"));
|
||||||
|
|
||||||
|
|
||||||
|
//assertTrue(driver.getCurrentUrl().equals());
|
||||||
} else { //if there's no permission to post
|
} else { //if there's no permission to post
|
||||||
assertTrue(postAccessible == false);
|
assertTrue(postAccessible == false);
|
||||||
assertFalse(driver.getCurrentUrl().equals(NEW_POST_URL));
|
assertFalse(driver.getCurrentUrl().equals(NEW_POST_URL));
|
||||||
|
|
Loading…
Add table
Reference in a new issue