Second commit

This commit is contained in:
aissel 2023-10-05 10:53:50 +05:30
parent b4bf3e08ad
commit 961b82bb86
9 changed files with 226 additions and 160 deletions

33
pom.xml
View File

@ -1,4 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DCIM_Counts_Check</groupId>
<artifactId>DCIM_Counts_Check</artifactId>
@ -25,17 +27,11 @@
</repositories>
<dependencies>
<!-- Other dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.5.3</version>
<version>4.12</version>
<scope>test</scope>
</dependency>
@ -77,7 +73,8 @@
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.ralfstuckert.pdfbox-layout/pdfbox2-layout -->
<!--
https://mvnrepository.com/artifact/com.github.ralfstuckert.pdfbox-layout/pdfbox2-layout -->
<dependency>
<groupId>com.github.ralfstuckert.pdfbox-layout</groupId>
<artifactId>pdfbox2-layout</artifactId>
@ -85,7 +82,6 @@
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
@ -116,7 +112,8 @@
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
<!--
https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
@ -133,8 +130,8 @@
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<!--
https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
@ -142,7 +139,8 @@
</dependency>
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports-cucumber4-adapter -->
<!--
https://mvnrepository.com/artifact/com.aventstack/extentreports-cucumber4-adapter -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber4-adapter</artifactId>
@ -167,7 +165,8 @@
<version>2.3.30</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api -->
<!--
https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
@ -204,7 +203,7 @@
<inherited>true</inherited>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>/home/aissel/git2/DCIM_Counts_Check/testng.xml</suiteXmlFile>
<suiteXmlFile>/home/aissel/git4/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>

View File

@ -5,11 +5,14 @@ import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import Utilities.ConfigReader;
import io.github.bonigarcia.wdm.WebDriverManager;
public class Contacts_Count
{
@Test
public static void main(String[] args) throws InterruptedException
{
WebDriverManager.chromedriver().setup();
@ -40,7 +43,7 @@ public class Contacts_Count
System.out.println("Contacts: " + text);
Thread.sleep(3000);
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//body[1]/div[74]/div[2]/div[1]/div[1]/a[1]/div[1]/table[1]/tbody[1]/tr[1]/td[2]/a[1]")).click();
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000);
}
driver.quit();

View File

@ -9,6 +9,7 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import org.testng.internal.BaseClassFinder;
import Utilities.ConfigReader;
@ -17,16 +18,15 @@ import io.github.bonigarcia.wdm.WebDriverManager;
public class Discover_Count
{
String path = System.getProperty("user.dir");
@Test
public static void main(String[] args) throws InterruptedException
{
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
ConfigReader config = new ConfigReader();
// Define the sets you want to use
//String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"};
String[] sets = {"set1", "set4", "set5", "set6", "set7"};
String[] sets = {"set1", "set2", "set4", "set5", "set6", "set7"};
//String[] sets = {"set1", "set4", "set5", "set6", "set7"};
Thread.sleep(10000);
for (String set : sets) {
Thread.sleep(10000);
@ -46,12 +46,23 @@ public class Discover_Count
Thread.sleep(5000);
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[normalize-space()='Reset']")));
//wait.until(ExpectedConditions.titleContains("kolsByRankingPager_left"));
//JavascriptExecutor jse = (JavascriptExecutor) driver;
//jse.executeScript("window.scrollTo(0,document.body.scrollHeight)");
//driver.findElement(By.xpath("//span[@class='ui-icon ui-icon-seek-end']")).click();
try {
String text= driver.findElement(By.xpath("//div[@class='ui-paging-info']")).getText();
System.out.println("Total Discover count: " + text);
Thread.sleep(3000);
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000);
}
driver.quit();
}
}
/* try {
int totalRowCount = 0;
boolean hasNextPage = true;
@ -92,6 +103,6 @@ public class Discover_Count
driver.quit();
}
}
} */

View File

@ -10,6 +10,7 @@ import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Wait;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@ -22,6 +23,7 @@ import io.github.bonigarcia.wdm.WebDriverManager;
public class Track_Interaction_Count
{
@Test
public static void main(String[] args) throws InterruptedException
{
WebDriverManager.chromedriver().setup();
@ -55,8 +57,31 @@ public class Track_Interaction_Count
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='wrapper']")));
String text= driver.findElement(By.xpath("//div[@class='ui-paging-info']")).getText();
System.out.println("Total Interactions count: " + text);
Thread.sleep(3000);
try {
} catch (NoSuchElementException e) {
// Handle the exception here (e.g., log, report, or take screenshots)
System.out.println("Element not found: " + e.getMessage());
}
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000);
}
driver.quit();
}
}
/*try {
int totalRowCount = 0;
boolean hasNextPage = true;
@ -99,5 +124,5 @@ public class Track_Interaction_Count
}
driver.quit();
}
}
}*/

View File

@ -11,6 +11,7 @@ import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@ -20,11 +21,12 @@ import io.github.bonigarcia.wdm.WebDriverManager;
public class Track_Interaction_Export
{
@Test
public static void main(String[] args) throws InterruptedException
{
ChromeOptions options = new ChromeOptions();
// Set the download directory
options.addArguments("download.default_directory=/home/aissel/git4");
options.addArguments("download.default_directory=" +System.getProperty("user.dir"));
// Disable the download prompt
options.setExperimentalOption("prefs",
ImmutableMap.of("download.prompt_for_download", false, "download.directory_upgrade", true));
@ -64,7 +66,8 @@ public class Track_Interaction_Export
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@data-original-title='Export Interaction Detail into Excel format']")));
File downloadedFile = new File("/home/aissel/Git2/DICM_Count/exported_file.xlsx");
//File downloadedFile = new File("/home/aissel/git4/exported_file.xlsx");
File downloadedFile = new File(System.getProperty("user.dir")+"/exported_file.xlsx");
if (downloadedFile.exists()) {
System.out.println("Downloaded file exists.");
} else {

View File

@ -12,6 +12,7 @@ import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@ -20,12 +21,14 @@ import io.github.bonigarcia.wdm.WebDriverManager;
public class Track_Medinsght_Export
{
@Test
public static void main(String[] args) throws InterruptedException
{
ChromeOptions options = new ChromeOptions();
// Set the download directory
options.addArguments("download.default_directory=/home/aissel/git4");
//options.addArguments("download.default_directory=/home/aissel/git4");
options.addArguments("download.default_directory=" +System.getProperty("user.dir"));
// Disable the download prompt
options.setExperimentalOption("prefs",
ImmutableMap.of("download.prompt_for_download", false, "download.directory_upgrade", true));
@ -66,7 +69,7 @@ public class Track_Medinsght_Export
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='excelExportIcon sprite_iconSet tooltip-demo tooltop-left']")));
File downloadedFile = new File("/home/aissel/Git2/DICM_Count/exported_file.xlsx");
File downloadedFile = new File(System.getProperty("user.dir")+"/exported_file.xlsx");
if (downloadedFile.exists()) {
System.out.println("Downloaded file exists.");
} else {

View File

@ -10,6 +10,7 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import Utilities.ConfigReader;
import Utilities.readConfigFile;
@ -17,13 +18,14 @@ import io.github.bonigarcia.wdm.WebDriverManager;
public class Track_Medinsight_Count
{
@Test
public static void main(String[] args) throws InterruptedException
{
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
ConfigReader config = new ConfigReader();
// Define the sets you want to use
String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6"};
String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"};
//String[] sets = {"set"};
Thread.sleep(10000);
for (String set : sets) {
@ -50,8 +52,28 @@ public class Track_Medinsight_Count
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='wrapper']")));
String text= driver.findElement(By.xpath("//div[@class='ui-paging-info']")).getText();
System.out.println("Total MedInsight count: " + text);
Thread.sleep(3000);
try {
} catch (NoSuchElementException e) {
// Handle the exception here (e.g., log, report, or take screenshots)
System.out.println("Element not found: " + e.getMessage());
}
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000);
}
driver.quit();
}
}
/*try {
int totalRowCount = 0;
boolean hasNextPage = true;
@ -94,7 +116,7 @@ public class Track_Medinsight_Count
}
driver.quit();
}
}
} */

View File

@ -9,7 +9,7 @@ public class ConfigReader
public ConfigReader() {
properties = new Properties();
try {
FileInputStream fis = new FileInputStream("/home/aissel/git4/src/test/resources/browser-config.properties");
FileInputStream fis = new FileInputStream(System.getProperty("user.dir")+"/src/test/resources/browser-config.properties");
properties.load(fis);
fis.close();
} catch (IOException e) {

View File

@ -3,7 +3,7 @@
<suite name="Suite">
<test thread-count="5" name="Test" junit="true">
<classes>
<class name="StepDefinitions.testRunnerTest"/>
<class name="test.Contacts_Count"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->