Skip to content

Commit ff31d23

Browse files
committed
still not working this MF !! lol
1 parent 5f51608 commit ff31d23

File tree

8 files changed

+32
-11
lines changed

8 files changed

+32
-11
lines changed

CreatePostsTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public void CanCreateBasicPost()
2222
LoginPage.LoginAs("scopethesound").WithPassword("niplifeow").Login();
2323

2424
NewPostPage.Goto();
25-
NewPostPage.CreatePost("This is a Test post title").WithBody("Hi,this is the body").Publish();
26-
NewPostPage.GoToNewPost();
25+
NewPostPage.CreatePost("This is a Test post title").Publish();
26+
// NewPostPage.GoToNewPost();
2727
Assert.AreEqual(PostPage.Title, "This is a Test post title","The title post did not match");
2828

2929

LoginPage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ public static void GoTo()
1616

1717

1818
Driver.Instance.Navigate().GoToUrl("https://wordpress.com/log-in?redirect_to=https%3A%2F%2Fwordpress.com%2F");
19-
var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));
19+
var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(6));
2020
wait.Until(d => d.SwitchTo().ActiveElement().GetAttribute("id") == "usernameOrEmail");
21+
2122
}
2223
public static LoginCommand LoginAs(string userName)
2324
{

NewPostPage.cs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using OpenQA.Selenium;
2+
using OpenQA.Selenium.Support.UI;
23
using System;
34
using System.Threading;
45

@@ -22,11 +23,16 @@ public static CreatePostCommand CreatePost(string title)
2223

2324
}
2425

25-
public static void GoToNewPost()
26+
static void GoToNewPost()
2627
{
27-
var message = Driver.Instance.FindElement(By.ClassName("notice__text"));
28-
var newPostLink = Driver.Instance.FindElement(By.XPath("//a[@href='https://ideastechno.wordpress.com/2018/06/22/es/']"));
29-
newPostLink.Click();
28+
29+
30+
var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(6));
31+
wait.Until(d => d.SwitchTo().ActiveElement().GetAttribute("ClassName") == "entry-title");
32+
Driver.Instance.FindElement(By.ClassName("entry-title")).Click();
33+
34+
//var newPostLink = Driver.Instance.FindElement(By.XPath("//a[@href='https://ideastechno.wordpress.com/2018/06/22/es/']"));
35+
//newPostLink.Click();
3036
}
3137

3238
}
@@ -46,13 +52,27 @@ public CreatePostCommand WithBody(string body)
4652
return this;
4753
}
4854

55+
/// <summary>
56+
///
57+
/// </summary>
4958
public void Publish()
5059
{
51-
Driver.Instance.FindElement(By.CssSelector("textarea-autosize editor-title__input")).SendKeys(title);
52-
Driver.Instance.FindElement(By.CssSelector(".mce-content-body p")).SendKeys(body);
60+
61+
var title1 = Driver.Instance.FindElement(By.CssSelector(".textarea-autosize.editor-title__input"));
62+
63+
title1.Click();
64+
title1.SendKeys(title);
65+
var body1 = Driver.Instance.FindElement(By.Id("mceu_1-open"));
66+
body1.Click();
67+
Driver.Instance.FindElement(By.Id("mceu_58-text")).Click();
68+
69+
//Driver.Instance.SwitchTo().Frame(Driver.Instance.FindElement(By.Id("tinymce")));
70+
//Driver.Instance.FindElement(By.CssSelector("tinymce-1_ifr")).SendKeys(body);
71+
5372
Thread.Sleep(1000);
5473
Driver.Instance.FindElement(By.ClassName("editor-ground-control__publish-button")).Click();
55-
Driver.Instance.FindElement(By.ClassName("editor-confirmation-sidebar__actionbutton")).Click();
74+
Driver.Instance.FindElement(By.CssSelector(".editor-confirmation-sidebar__action > button:nth-child(1)")).Click();
75+
5676

5777

5878
}

PostPage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static string Title
88
{
99
get
1010
{
11-
var title = Driver.Instance.FindElement(By.ClassName("entry-title"));
11+
var title = Driver.Instance.FindElement(By.LinkText("This is a Test post title"));
1212
if (title != null)
1313
return title.Text;
1414
return "";

bin/Debug/UnitTestProject1.dll

0 Bytes
Binary file not shown.

bin/Debug/UnitTestProject1.pdb

0 Bytes
Binary file not shown.

obj/Debug/UnitTestProject1.dll

0 Bytes
Binary file not shown.

obj/Debug/UnitTestProject1.pdb

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)