Exemplo n.º 1
0
		public void LoginToSite()
		{
			XDocument doc = XDocument.Load(DataFileLocation);

			XElement settings = doc.Document.Element("Tests").Element("settings");
			XElement testSettings = doc.Document.Element("Tests").Element("journal");

			_driver = StartBrowser(settings.Attribute("browser").Value);
			_baseUrl = settings.Attribute("baseURL").Value;

			string testName = testSettings.Attribute("name").Value;

			_userNameNumberOne = testSettings.Attribute("userNameNumberOne").Value;
			_userNameNumberTwo = testSettings.Attribute("userNameNumberTwo").Value;
			_userNameNumberThree = testSettings.Attribute("userNameNumberThree").Value;
			_userDisplayNameNumberOne = testSettings.Attribute("userDisplayNameNumberOne").Value;
			_userDisplayNameNumberTwo = testSettings.Attribute("userDisplayNameNumberTwo").Value;
			_userDisplayNameNumberThree = testSettings.Attribute("userDisplayNameNumberThree").Value;
			_password = testSettings.Attribute("password").Value;
			_subject = testSettings.Attribute("subject").Value;
			_comment = testSettings.Attribute("comment").Value;
			_fileNameToAttach = testSettings.Attribute("fileNameToAttach").Value;
			_pictureNameToAttach = testSettings.Attribute("pictureNameToAttach").Value;
			_pageName = testSettings.Attribute("pageName").Value;

			Trace.WriteLine(BasePage.RunningTestKeyWord + "'" + testName + "'");
			Trace.WriteLine(BasePage.PreconditionsKeyWord);

			OpenMainPageAndLoginAsHost();

			var manageUsersPage = new ManageUsersPage(_driver);
			manageUsersPage.OpenUsingControlPanel(_baseUrl);
			manageUsersPage.AddNewUser(_userNameNumberOne, _userDisplayNameNumberOne, "*****@*****.**", _password);
			manageUsersPage.AddNewUser(_userNameNumberTwo, _userDisplayNameNumberTwo, "*****@*****.**", _password);
			manageUsersPage.AddNewUser(_userNameNumberThree, _userDisplayNameNumberThree, "*****@*****.**", _password);

			CreatePageAndSetViewPermission(_pageName, "All Users", "allow");

			AddModule(_pageName, Modules.CommonModulesDescription, "JournalModule", "ContentPane");

			var loginPage = new LoginPage(_driver);
			loginPage.LoginUsingDirectUrl(_baseUrl, _userNameNumberTwo, _password);

			var userAccountPage = new UserAccountPage(_driver);
			userAccountPage.OpenActivityFeedLink(_baseUrl);

			var module = new JournalModule(_driver);
			module.AddNewPostWithVisibilityPermission(_subject + " Community Members", "Community Members");
			module.AddNewPostWithVisibilityPermission(_subject + " Private", "Private");
			module.AddNewPostWithVisibilityPermission(_subject + " Everyone", "Everyone");

			OpenMainPageAndLoginAsHost();

			_logContent = LogContent(); 
		}
Exemplo n.º 2
0
		public void Test009_UserAttachesFileFromWebsiteToPost()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'The authorized User can attach the picture to the message :'");

			var loginPage = new LoginPage(_driver);
			loginPage.LoginUsingDirectUrl(_baseUrl, _userNameNumberThree, _password);

			var userAccountPage = new UserAccountPage(_driver);
			userAccountPage.OpenActivityFeedLink(_baseUrl);

			var module = new JournalModule(_driver);
			module.AddNewPostWithAttachedWebsitePicture(_subject, _pictureNameToAttach);

			Trace.WriteLine("ASSERT the picture displayed correctly:");
			Assert.IsTrue(module.ElementPresent(By.XPath("//div[@id = 'journalItems']/div[1]/div[@class = 'journalitem']/div/img[contains(@src, '" + _pictureNameToAttach + "')]")),
						"Message text is not displayed correctly");
		}
Exemplo n.º 3
0
		public void Test006_UserDeletesMessage()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'The authorized User can delete the message :'");

			var loginPage = new LoginPage(_driver);
			loginPage.LoginUsingDirectUrl(_baseUrl, _userNameNumberThree, _password);

			var userAccountPage = new UserAccountPage(_driver);
			userAccountPage.OpenActivityFeedLink(_baseUrl);

			var module = new JournalModule(_driver);
			module.DeletePost(_subject);

			Trace.WriteLine("ASSERT the posts are NOT displayed:");
			Assert.That(module.FindElements(By.XPath("//div[@id = 'journalItems']/child::*")).Count,
						Is.EqualTo(0),
						"The posts are still displayed");
		}
Exemplo n.º 4
0
		public void Test005_UserCommentsPost()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'The authorized User can comment the message :'");

			var loginPage = new LoginPage(_driver);
			loginPage.LoginUsingDirectUrl(_baseUrl, _userNameNumberThree, _password);

			var userAccountPage = new UserAccountPage(_driver);
			userAccountPage.OpenActivityFeedLink(_baseUrl);

			var module = new JournalModule(_driver);
			module.CommentPost(_subject, _comment);

			Trace.WriteLine("ASSERT the original message is displayed:");
			Assert.That(module.WaitForElement(By.XPath("//div[@class = 'journalitem']/p[1]")).Text,
						Is.EqualTo(_userDisplayNameNumberThree + _subject),
						"Message text is stiil displayed");

			Trace.WriteLine("ASSERT the comment message is displayed:");
			Assert.That(module.WaitForElement(By.XPath("//div[p[@class = 'journalfooter']]//li/p")).Text,
						Is.StringContaining(_userDisplayNameNumberThree + _comment),
						"Message text is stiil displayed");
		}
Exemplo n.º 5
0
		public void Test004_UserPostsMessage()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'The authorized User can post the message :'");

			var loginPage = new LoginPage(_driver);
			loginPage.LoginUsingDirectUrl(_baseUrl, _userNameNumberThree, _password);

			var userAccountPage = new UserAccountPage(_driver);
			userAccountPage.OpenActivityFeedLink(_baseUrl);

			var module = new JournalModule(_driver);
			module.AddNewPost(_subject);

			Trace.WriteLine("ASSERT the author displayed correctly:");
			Assert.That(module.WaitForElement(By.XPath("//span[@class = 'authorname']/a")).Text,
						Is.EqualTo(_userDisplayNameNumberThree),
						"Message author is not found");

			Trace.WriteLine("ASSERT the message displayed correctly:");
			Assert.That(module.WaitForElement(By.XPath("//div[@class = 'journalitem']/p[1]")).Text,
						Is.StringContaining(_userDisplayNameNumberThree + _subject),
						"Message text is not displayed correctly");
		}
Exemplo n.º 6
0
		public void Test003_PrivatePostOwnerAccessToJournal()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Authorized User Access To Journal'");

			var loginPage = new LoginPage(_driver);
			loginPage.LoginUsingDirectUrl(_baseUrl, _userNameNumberTwo, _password);

			var blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, _pageName);

			var module = new JournalModule(_driver);
			module.FindElement(By.XPath("//div[@id = 'journalItems']/div[last()]")).Info();

			Trace.WriteLine("ASSERT the number of Messages are correct :");
			Assert.That(module.FindElements(By.XPath("//div[@id = 'journalItems']/div")).Count, Is.EqualTo(3), "The number of Messages are incorrect");

			Trace.WriteLine("ASSERT the visibility is correct :");
			Assert.That(module.WaitForElement(By.XPath("//div[@id = 'journalItems']/div[1]//p[1]")).Text, Is.StringContaining("Everyone"),
					 "The wrong message is shown");
			Assert.That(module.WaitForElement(By.XPath("//div[@id = 'journalItems']/div[2]//p[1]")).Text, Is.StringContaining("Private"),
								 "The wrong message is shown");
			Assert.That(module.WaitForElement(By.XPath("//div[@id = 'journalItems']/div[3]//p[1]")).Text, Is.StringContaining("Community"),
						   "The wrong message is shown");
		}
Exemplo n.º 7
0
		public void Test001_AnonymousAccessToJournal()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Anonymous User Access To Jounal'");

			var loginPage = new LoginPage(_driver);
			loginPage.LetMeOut();

			var blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, _pageName);

			var module = new JournalModule(_driver);
			module.FindElement(By.XPath("//div[@id = 'journalItems']/div[last()]")).Info();

			Trace.WriteLine("ASSERT the number of Messages are correct :");
			Assert.That(module.FindElements(By.XPath("//div[@id = 'journalItems']/div")).Count, Is.EqualTo(1), "The number of Messages are incorrect");

			Trace.WriteLine("ASSERT the visibility is correct :");
			Assert.That(module.WaitForElement(By.XPath("//div[@id = 'journalItems']/div[1]//p[1]")).Text, Is.StringContaining("Everyone"),
					 "The wrong message is shown");
			Assert.IsFalse(module.ElementPresent(By.XPath("//div[@id = 'journalItems']/div[2]//p[1]")),
								 "Visibility permission is not respected for this message");
			Assert.IsFalse(module.ElementPresent(By.XPath("//div[@id = 'journalItems']/div[3]//p[1]")),
								 "Visibility permission is not respected for this message");
		}