Skip to content

Commit

Permalink
feat: Build minor adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Nowocin committed Mar 22, 2020
1 parent 86c6cd4 commit 6bebad2
Show file tree
Hide file tree
Showing 22 changed files with 289 additions and 323 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ Supported browsers aka hosts:
* Support for Allure Report
* Support for .xlsx files
* Support for Fake & Mock data
* Support for BrowserStack
## TEST RESULTS
* After each CI/CD cycle run, tests results will be automatically uploaded to [kamil_nowocin/allure_report](https://kamil-nowocin.github.io/Test_Automation-automationpractice/)
* After each CI/CD cycle run, tests results will be automatically uploaded to [kamil_nowocin/github.io/allure_report](https://kamil-nowocin.github.io/Test_Automation-automationpractice/)
* After each LOCAL cycle run, tests results will be stored in build/allure-report.
In terminal type `allure generate build/allure-report --clean` to generate local Allure Test Results
##LOGS
## TEST LOGS
There are two types of log information saved after each test run:
* Detailed logs in log directory. Warning! These logs will be deleted when you launch new test run.
* Colorful logs in testdata.xls file. Warning! These logs will be overwritten when you launch new test run. <sub><sup>(Only for TestNG runners)</sup></sub>
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ test {
ignoreFailures = true
useTestNG()
{
suites "src/test/resources/xml_runners/TestNG-WEB.xml"
suites "src/test/resources/xml_runners/TestNG-API.xml"
suites "src/test/resources/xml_runners/TestNG-WebAPP.xml"
suites "src/test/resources/xml_runners/TestNG-WebAPI.xml"
suites "src/test/resources/xml_runners/TestNG-POC.xml"
}
systemProperties System.properties
Expand All @@ -105,6 +105,6 @@ task exper(type: JavaExec, dependsOn: 'classes') {
project.sourceSets.test.compileClasspath,
project.sourceSets.main.runtimeClasspath,
project.sourceSets.test.runtimeClasspath)
args = ["./src/test/resources/xml_runners/TestNG-WEB.xml", "./src/test/resources/xml_runners/TestNG-API.xml",
args = ["./src/test/resources/xml_runners/TestNG-WebAPP.xml", "./src/test/resources/xml_runners/TestNG-WebAPI.xml",
"./src/test/resources/xml_runners/TestNG-POC.xml"]
}
12 changes: 6 additions & 6 deletions src/test/java/com/FrameworkEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@

public class FrameworkEnvironment {

protected static Logger logger = LoggerFactory.getLogger(Hooks.class);
protected static Faker faker = new Faker(new Locale("en-US"));
protected static Faker faker = new Faker(Locale.US);
protected static MockNeat mockNeat = MockNeat.threadLocal();
protected static Logger logger = LoggerFactory.getLogger(Hooks.class);
protected static DecimalFormat $decimalFormat = new DecimalFormat("$#0.00", new DecimalFormatSymbols(Locale.US));

//BUNDLES//
Expand Down Expand Up @@ -197,10 +197,10 @@ protected void deleteOldLogs() {

public void printWebDriverManagerVersions(Boolean boolStatus) {
if (boolStatus) {
logger.info("ChromeDriver available versions: " + WebDriverManager.chromedriver().getVersions() + "\n");
logger.info("GeckoDriver available versions: " + WebDriverManager.firefoxdriver().getVersions() + "\n");
logger.info("OperaDriver available versions: " + WebDriverManager.operadriver().getVersions() + "\n");
logger.info("EdgeDriver available versions: " + WebDriverManager.edgedriver().getVersions() + "\n");
logger.info("ChromeDriver available versions: " + WebDriverManager.chromedriver().getVersions());
logger.info("GeckoDriver available versions: " + WebDriverManager.firefoxdriver().getVersions());
logger.info("OperaDriver available versions: " + WebDriverManager.operadriver().getVersions());
logger.info("EdgeDriver available versions: " + WebDriverManager.edgedriver().getVersions());
logger.info("IE available versions: " + WebDriverManager.iedriver().getVersions());
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/com/steps/RegistrationPageSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,14 @@ public void iChooseGender() throws Throwable {
if (randomNumber == 1) {
registrationPage.mrButton.click();
logger.info("User gender: Male");

//ASSERT//
Assert.assertTrue(registrationPage.mrButton.isSelected());

} else {
registrationPage.mrsButton.click();
logger.info("User gender: Female");

//ASSERT//
Assert.assertTrue(registrationPage.mrsButton.isSelected());
}
Expand Down Expand Up @@ -282,7 +284,7 @@ public void iChooseDateOfBirth() throws Throwable {
@And("I sign in to receive newsletter and special offers")
public void iSignInToReceiveNewsletterAndSpecialOffers() throws Throwable {
//ARRANGE//
int tempRandomValue = basePage.randomIntValue(3, 1);
int tempRandomValue = basePage.randomIntValue(3, 3);

//ACT//
if (tempRandomValue == 1) {
Expand All @@ -302,8 +304,7 @@ public void iSignInToReceiveNewsletterAndSpecialOffers() throws Throwable {
Assert.assertTrue(registrationPage.specialOffersCheckbox.isSelected());

} else {
if (!registrationPage.newsletterCheckbox.isSelected() &&
registrationPage.specialOffersCheckbox.isSelected()) {
if (!registrationPage.newsletterCheckbox.isSelected() && !registrationPage.specialOffersCheckbox.isSelected()) {
registrationPage.newsletterCheckbox.click();
registrationPage.specialOffersCheckbox.click();
logger.info("User signed to receive newsletter & special offers");
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/com/steps/SearchPageSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public void iCanSeeThatEveryResultsWhichHaveBeenFoundContainsPhrase(String searc
}

} else {
Assert.assertTrue(basePage.isDisplayed(5, searchPage.noResultsWereFoundHeader), VIEW_ERROR);
Assert.assertTrue(basePage.isDisplayed(5, searchPage.noResultsWereFoundHeader),
String.format(VIEW_ERROR, "No result header"));
}
}

Expand Down
21 changes: 11 additions & 10 deletions src/test/java/com/steps/ShoppingLoggedUserSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public ShoppingLoggedUserSteps(ContextInjection contextInjection) {

@Step("I click on *{0}* button from sub menu")
@And("I click on {string} button from sub menu")
public void iClickOnButtonFromSubMenu(String category) throws Throwable {
public void iClickOnButtonFromSubMenu(String subMenuCategory) throws Throwable {
//ACT//
switch (category.toLowerCase()) {
switch (subMenuCategory.toLowerCase()) {
case "women":
mainPage.subMenuWomen.click();
break;
Expand All @@ -56,13 +56,13 @@ public void iClickOnButtonFromSubMenu(String category) throws Throwable {
break;

default:
throw new IllegalStateException(String.format(INPUT_ERROR, category.toUpperCase()));
throw new IllegalStateException(String.format(INPUT_ERROR, subMenuCategory.toUpperCase()));
}
logger.info(String.format("User clicked on: %S submenu category", category));
logger.info(String.format("User clicked on: %S submenu category", subMenuCategory));

//ASSERT//
Assert.assertEquals(mainPage.subMenuChosenCategory.getText().replaceAll
("\\s+", "").toLowerCase(), category.toLowerCase(), VALUE_ERROR);
("\\s+", "").toLowerCase(), subMenuCategory.toLowerCase(), VALUE_ERROR);
}

@Step("I click on following product *{0}*")
Expand Down Expand Up @@ -210,10 +210,10 @@ public void iCanSeeShoppingCartFormWithValidInformation(String shoppingSummaryTa
Assert.assertEquals(shoppingCartSummaryPage.productTotalPrice.getText()
.replaceAll("[^$0-9.]", ""),
$decimalFormat.format(contextInjection.finalProductTotalPrice), VALUE_ERROR);
//TODO - how tax is calculated in america?
//Assert.assertEquals(shoppingCartSummaryPage.productTotalOrderPriceTAX.getText()
// .replaceAll("[$]*[^$0-9.]", "").replace(".", ","),
// decimalFormat.format(productTotalOrderPriceWithTax), VALUE_ERROR);
/* //TODO - how tax is calculated in america?
Assert.assertEquals(shoppingCartSummaryPage.productTotalOrderPriceTAX.getText()
.replaceAll("[$]*[^$0-9.]", ""),
$decimalFormat.format(productTotalOrderPriceWithTax), VALUE_ERROR);*/
break;

case "addresses":
Expand Down Expand Up @@ -287,7 +287,8 @@ public void iWriteCommentAboutMyOrder() throws Throwable {
logger.info(String.format("User comment order: %S", orderComment.toUpperCase()));

//ASSERT//
Assert.assertEquals(shoppingCartSummaryPage.orderComment.getAttribute("value").toLowerCase(), orderComment.toLowerCase(), VALUE_ERROR);
Assert.assertEquals(shoppingCartSummaryPage.orderComment.getAttribute("value").toLowerCase(),
orderComment.toLowerCase(), VALUE_ERROR);
}

@Step("I choose shipping option *{0}*")
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/tests/POC/POC_Tests.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public void testSteps(XSSFRow row) {
}

@Ignore
@Owner("Kamil Nowocin")
@Test(priority = 0,
description = "As a developer I'd like to see working POC with .xlsx file")
@Description("As a developer I'd like to see working POC with .xlsx file")
@Severity(SeverityLevel.MINOR)
@Issue("TAP-POC")
@Story("POC Tests")
@Owner("Kamil Nowocin")
@Severity(SeverityLevel.MINOR)
@Description("As a developer I'd like to see working POC with .xlsx file")
@Test(description = "As a developer I'd like to see working POC with .xlsx file",
priority = 0)
public void excelTest() throws Throwable {
//ARRANGE//
ExcelEnvironment.saveTestResultsXLSX(50);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tests.API;
package tests.WebAPI;

import com.ExcelEnvironment;
import com.listeners.TestNGListener_API;
Expand Down Expand Up @@ -34,11 +34,13 @@ public void beforeTest(ITestResult iTestResult) {
destroyDriver();
}

@Issue("TAP/API-0001")
@Story("HTTP STATUSES")
@Owner("Kamil Nowocin")
@Test(description = "HTTP status check", priority = 0)
@Description("As a user I would like to check availability of automationpractice.com")
@Severity(SeverityLevel.BLOCKER)
@Issue("TAP-0000")
@Description("[US-XXX]/[1] As a user I would like to check availability of automationpractice.com")
@Test(description = "[US-XXX]/[1] I would like to check availability of automationpractice.com",
priority = 0)
public void test_1() throws Throwable {
//ARRANGE//
ExcelEnvironment.saveTestResultsXLSX(45);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tests.APP;
package tests.WebAPP;

import com.ContextInjection;
import com.ExcelEnvironment;
Expand All @@ -22,14 +22,13 @@
@Listeners({TestNGListener_WEB.class})
public class Authentication_Tests extends Hooks {

@Owner("Kamil Nowocin")
@Test(priority = 0,
description = "I can log into automationpractice.com using registered email [email protected]")
@Description("As a user I would like to log in automationpractice.com ->\n" +
"I can log into automationpractice.com using registered email [email protected]")
@Severity(SeverityLevel.CRITICAL)
@Issue("TAP-0001")
@Story("POSITIVE FLOW")
@Owner("Kamil Nowocin")
@Severity(SeverityLevel.CRITICAL)
@Description("[US-111]/[1] As a user I can log into automationpractice.com using registered email \"[email protected]\" & password \"12345\"")
@Test(description = "[US-111]/[1] I can log into automationpractice.com using registered email \"[email protected]\" & password \"12345\"",
priority = 0)
public void test_1() throws Throwable {
//ARRANGE//
ExcelEnvironment.saveTestResultsXLSX(1);
Expand All @@ -51,14 +50,13 @@ public void test_1() throws Throwable {
registrationPageSteps.iCanSeeWelcomeMessage();
}

@Owner("Kamil Nowocin")
@Test(priority = 0,
description = "I can't log into automationpractice.com using unregistered email [email protected] and wrong password")
@Description("As a user I would like to log in automationpractice.com ->\n" +
"I can't log into automationpractice.com using email [email protected] and wrong password")
@Severity(SeverityLevel.NORMAL)
@Issue("TAP-0002")
@Story("NEGATIVE FLOW")
@Severity(SeverityLevel.NORMAL)
@Owner("Kamil Nowocin")
@Description("[US-111]/[2] As a user I can't log into automationpractice.com using email \"[email protected]\" & password \"12345\"")
@Test(description = "[US-111]/[2] I can't log into automationpractice.com using email \"[email protected]\" & password \"12345\"",
priority = 0)
public void test_2() throws Throwable {
//ARRANGE//
ExcelEnvironment.saveTestResultsXLSX(2);
Expand All @@ -80,14 +78,13 @@ public void test_2() throws Throwable {
authenticationPageSteps.iCanSeeWarningMessageWithInclude("Authentication failed");
}

@Owner("Kamil Nowocin")
@Test(priority = 0,
description = "I can't log into automationpractice.com using registered email [email protected] without password")
@Description("As a user I would like to log in automationpractice.com ->\n" +
"I can't log into automationpractice.com using email [email protected] without password")
@Severity(SeverityLevel.NORMAL)
@Issue("TAP-0003")
@Story("NEGATIVE FLOW")
@Owner("Kamil Nowocin")
@Severity(SeverityLevel.NORMAL)
@Description("[US-111]/[2] As a user I can't log into automationpractice.com using email \"[email protected]\" & password \"null\"")
@Test(description = "[US-111]/[3] I can't log into automationpractice.com using email \"[email protected]\" & password \"null\"",
priority = 0)
public void test_3() throws Throwable {
//ARRANGE//
ExcelEnvironment.saveTestResultsXLSX(3);
Expand All @@ -109,14 +106,13 @@ public void test_3() throws Throwable {
authenticationPageSteps.iCanSeeWarningMessageWithInclude("Password is required");
}

@Owner("Kamil Nowocin")
@Test(priority = 0,
description = "I can't log into automationpractice.com using email \"null\" with password")
@Description("As a user I would like to log in automationpractice.com ->\n" +
"I can't log into automationpractice.com using email \"null\" with password")
@Severity(SeverityLevel.NORMAL)
@Issue("TAP-0004")
@Story("NEGATIVE FLOW")
@Owner("Kamil Nowocin")
@Severity(SeverityLevel.NORMAL)
@Description("[US-111]/[2] As a user I can't log into automationpractice.com using email \"null\" & password \"12345\"")
@Test(description = "[US-111]/[4] I can't log into automationpractice.com using email \"null\" & password \"12345\"",
priority = 0)
public void test_4() throws Throwable {
//ARRANGE//
ExcelEnvironment.saveTestResultsXLSX(4);
Expand Down
Loading

0 comments on commit 6bebad2

Please sign in to comment.