Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter branch #67

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 199 additions & 0 deletions Actions/CreateCommunity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
package Appium;

import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import PageObjects.CreateCommunityObjects;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.nativekey.AndroidKey;
import io.appium.java_client.android.nativekey.KeyEvent;

public class CreateCommunity {
public String username = "karim55";
public String password = "Karim@0107228700";
public String commName = "karim789";
public String commType = "Restricted";
public String commCategory = "Gaming";
public String boundsOfCreateCommunity = "[0,836][364,932]";

public AndroidDriver<MobileElement> driver2;

@BeforeMethod
public void beforetest() throws Exception {
System.out.println("Application inter before.......");
StartSession startSession = new StartSession();
driver2 = startSession.StartApp();
Thread.sleep(2000);
}

@Test
public void TestCase1_DisabilityCreateCommunityWithoutNaming() throws Exception {
CreateCommunityObjects createCommunityObj = new CreateCommunityObjects(driver2);
createCommunityObj.EnterUserName(username);
Thread.sleep(2000);
createCommunityObj.EnterPassword(password);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.ContinueButton();
Thread.sleep(2000);
createCommunityObj.ThreeSmallLines();
Thread.sleep(2000);
createCommunityObj.ClickOnCreateCommunity(boundsOfCreateCommunity);
Thread.sleep(2000);
createCommunityObj.DisabledCreateCommunity();
}

@Test
public void TestCase2_ChangingCommunityTypeChangingNotAppearRestrictedCreateCommunity() throws Exception {
CreateCommunityObjects createCommunityObj = new CreateCommunityObjects(driver2);
createCommunityObj.EnterUserName(username);
Thread.sleep(2000);
createCommunityObj.EnterPassword(password);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.ContinueButton();
Thread.sleep(2000);
createCommunityObj.ThreeSmallLines();
Thread.sleep(2000);
createCommunityObj.ClickOnCreateCommunity(boundsOfCreateCommunity);
Thread.sleep(2000);
createCommunityObj.CommunityName(commName);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.CommunityType();
Thread.sleep(2000);
createCommunityObj.CommunityType_Resticted();
Thread.sleep(2000);
createCommunityObj.CheckCommunityType_Resticted();
}

@Test
public void TestCase3_ChangingCommunityTypeChangingNotAppearPrivateCreateCommunity() throws Exception {
CreateCommunityObjects createCommunityObj = new CreateCommunityObjects(driver2);
createCommunityObj.EnterUserName(username);
Thread.sleep(2000);
createCommunityObj.EnterPassword(password);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.ContinueButton();
Thread.sleep(2000);
createCommunityObj.ThreeSmallLines();
Thread.sleep(2000);
createCommunityObj.ClickOnCreateCommunity(boundsOfCreateCommunity);
Thread.sleep(2000);
createCommunityObj.CommunityName(commName);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.CommunityType();
Thread.sleep(2000);
createCommunityObj.CommunityType_Private();
Thread.sleep(2000);
createCommunityObj.CheckCommunityType_Private();
}

@Test
public void TestCase4_ChangingCommunityCategoryChangingNotAppearGamingCreateCommunity() throws Exception {
CreateCommunityObjects createCommunityObj = new CreateCommunityObjects(driver2);
createCommunityObj.EnterUserName(username);
Thread.sleep(2000);
createCommunityObj.EnterPassword(password);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.ContinueButton();
Thread.sleep(2000);
createCommunityObj.ThreeSmallLines();
Thread.sleep(2000);
createCommunityObj.ClickOnCreateCommunity(boundsOfCreateCommunity);
Thread.sleep(2000);
createCommunityObj.CommunityName(commName);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.CommunityCategory(commCategory);
Thread.sleep(2000);
createCommunityObj.CommunityCategory_Gaming();

}

@Test
public void TestCase5_CreateCommunityAlreadyExist() throws Exception {
commName = "karim88";
CreateCommunityObjects createCommunityObj = new CreateCommunityObjects(driver2);
createCommunityObj.EnterUserName(username);
Thread.sleep(2000);
createCommunityObj.EnterPassword(password);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.ContinueButton();
Thread.sleep(2000);
createCommunityObj.ThreeSmallLines();
Thread.sleep(2000);
createCommunityObj.ClickOnCreateCommunity(boundsOfCreateCommunity);
Thread.sleep(2000);
createCommunityObj.CommunityName(commName);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.Community18plus();
Thread.sleep(2000);
createCommunityObj.EnablededCreateCommunity();
Thread.sleep(2000);
createCommunityObj.ClickOnCreateCommunityButton();
Thread.sleep(2000);
// error message here
createCommunityObj.FailedToCreateCommunity(commName);
}

@Test
public void TestCase6_CreateCommunityNotExistBefore() throws Exception {
commName = "karim456";
CreateCommunityObjects createCommunityObj = new CreateCommunityObjects(driver2);
createCommunityObj.EnterUserName(username);
Thread.sleep(2000);
createCommunityObj.EnterPassword(password);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.ContinueButton();
Thread.sleep(2000);
createCommunityObj.ThreeSmallLines();
Thread.sleep(2000);
createCommunityObj.ClickOnCreateCommunity(boundsOfCreateCommunity);
Thread.sleep(2000);
createCommunityObj.CommunityName(commName);
Thread.sleep(2000);
driver2.pressKey(new KeyEvent(AndroidKey.ENTER));
Thread.sleep(2000);
createCommunityObj.Community18plus();
Thread.sleep(2000);
createCommunityObj.EnablededCreateCommunity();
Thread.sleep(2000);
createCommunityObj.ClickOnCreateCommunityButton();
Thread.sleep(2000);
createCommunityObj.CheckCommunityName(commName);
Thread.sleep(2000);
createCommunityObj.CheckModToolsInSubreddit();
Thread.sleep(2000);
createCommunityObj.CheckOnHotInSubReddit();

}

@AfterMethod
public void tearDown() {
if (driver2 != null) {
driver2.quit();
System.out.println("Application not null .......");
}
System.out.println("Application after.......");
}

}
143 changes: 143 additions & 0 deletions Actions/CreatePost.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
package appiumtests;

import java.util.List;

import org.openqa.selenium.By;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import PageObjects.CreatePostObj;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;

public class CreatePost {

static AndroidDriver<MobileElement> driver2;

// @SuppressWarnings("unused")
@BeforeMethod
//public static void main(String[] args) throws Exception {
public void beforetest() throws Exception {


StartSession startSession = new StartSession();
driver2 = startSession.StartApp();
CreatePostObj createObj = new CreatePostObj(driver2);

// LoginObjects loginObj = new LoginObjects(driver2);
// loginObj.EnterUserName("Samaa_Hazem");
// loginObj.EnterPassword("cmp123456");
// driver2.executeScript("mobile:performEditorAction", ImmutableMap.of("action", "done"));
// loginObj.ClickLogin();
//
System.out.println("Application before in.......");

}

@Test
public void appiumFlutterTest() throws Exception {
CreatePostObj createObj = new CreatePostObj(driver2);
// LoginObjects loginObj = new LoginObjects(driver2);
// loginObj.EnterUserName("Samaa_Hazem");
// loginObj.EnterPassword("cmp123456");
// driver2.executeScript("mobile:performEditorAction", ImmutableMap.of("action", "done"));
// loginObj.ClickLogin();
// Thread.sleep(3000);

// //2)Link
createObj.HomeCreatPost();
Thread.sleep(1000);
createObj.LinkClick();
Thread.sleep(100);
createObj.EnterTitle(" link!!");
Thread.sleep(100);
createObj.EnterText("https://web.whatsapp.com/");
Thread.sleep(100);
createObj.NextClick();
Thread.sleep(100);
createObj.ChooseSubreddit("footbally");
Thread.sleep(100);
createObj.PostSubmit();
System.out.println("in test case1");

}
//
@Test
public void PostWithText() throws Exception {
CreatePostObj createObj = new CreatePostObj(driver2);
//1)pass post (text)
createObj.HomeCreatPost();
Thread.sleep(1000);
createObj.TextClick();
Thread.sleep(100);
createObj.EnterTitle("text!!");
Thread.sleep(100);
createObj.EnterText("post body from samaa");
Thread.sleep(100);
createObj.NextClick();
Thread.sleep(100);
createObj.ChooseSubreddit("footbally");
////then?:
Thread.sleep(100);
createObj.SpoilerClick();
createObj.NSFWClick();

Thread.sleep(100);
createObj.PostSubmit();
System.out.println("in test case2");

}
//
@Test
public void appiumFlutterTest33() throws Exception {
CreatePostObj createObj = new CreatePostObj(driver2);
//1)pass post (text)
createObj.HomeCreatPost();
Thread.sleep(1000);
// createObj.TextClick();
// Thread.sleep(100);
// createObj.EnterTitle("text!!");
// Thread.sleep(1000);
// createObj.EnterText("post body from samaa");
// Thread.sleep(100);
// createObj.NextClick();
// Thread.sleep(100);
// createObj.ChooseSubreddit("footbally");
// ////then?:
// Thread.sleep(100);
// createObj.SpoilerClick();
// createObj.NSFWClick();
//
// Thread.sleep(100);
// createObj.PostSubmit();
// System.out.println("in test case3");

// driver2.findElementByXPath("//android.widget.Button[@content-desc='Post']").isEnabled();
// MobileElement createPostObj = driver2.findElementByXPath("//android.widget.Button[@content-desc='Next']");
List<MobileElement> createPostObj = driver2.findElements(By.xpath("//android.widget.Button"));

//Assert.assertFalse((createPostObj.get(1).isEnabled()));
if(!(createPostObj.get(1).isEnabled()))
{
System.out.println("false.......");

}

}

@AfterMethod
public void tearDown() {
if (driver2 != null) {
driver2.quit();
}
System.out.println("Application finish.......");
}


}



//--------------//

Loading