Skip to content
Merged
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
32 changes: 32 additions & 0 deletions .github/workflows/ci_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: TestUI CI integration tests workflow

on:
push:
branches:
- master
pull_request:
branches:
- master

workflow_dispatch:

jobs:
integration_test:
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: "zulu"
- name: Remove Chrome
run: sudo apt purge google-chrome-stable
- name: Remove default Chromium
run: sudo apt purge chromium-browser
- name: Install a new Chromium
run: sudo apt install -y chromium-browser
- name: Integration browser test with Maven
run: mvn -Dtest=TestBrowser test
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
Expand Down Expand Up @@ -170,7 +170,7 @@
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>

<version>6.10.1</version>
<version>6.12.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
40 changes: 13 additions & 27 deletions src/test/java/TestRunners/TestBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.junit.Test;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import pages.GoogleLandingPage;
import testUI.Configuration;

Expand All @@ -29,54 +30,33 @@ public void testDesktopBrowser() {
Configuration.testUILogLevel = LogLevel.DEBUG;
Configuration.softAsserts = true;
Configuration.browser = "chrome";
Configuration.headless = true;
open("https://www.google.com");
UIAssert("the url is not correct",
getSelenideDriver().getCurrentUrl().equals("https://www.google.com/"));
executeJs("arguments[0].value='TestUI';", googleLandingPage.getGoogleSearchInput()
.getSelenideElement().getWrappedElement());
googleLandingPage.getGoogleSearch()
.then().saveScreenshot("~/Documents" +
"/screen" +
".png");
.then().saveScreenshot("~/target/screen.png");
logAverageTime();
System.out.println(getListOfCommandsTime());

raiseSoftAsserts();
stop();
}

@Test
public void setDriverTest() {
ChromeOptions options = new ChromeOptions();
Configuration.softAsserts = false;
options.addArguments("--user-agent=Agent", "--ignore-certificate-errors");
options.addArguments(
"--user-agent=Agent", "--ignore-certificate-errors", "--headless", "--remote-allow-origins=*");
Configuration.chromeOptions = options;
selenideBrowserCapabilities.setBrowserName("chrome");
open("https://www.whatsmyua.info/");
E(byCssSelector("textarea")).waitFor(10).untilHasText("Agent");
sleep(1000);
}

@Test
@DisplayName("Laptop browser test case")
public void testDesktopBrowserSafari() {
Configuration.automationType = DESKTOP_PLATFORM;
Configuration.browser = "safari";
Configuration.serverLogLevel = "all";
Configuration.softAsserts = true;
open("https://www.google.com");
System.out.println(getTestUIDriver().getCurrentUrl());
executeJs("arguments[0].value='TestUI';", googleLandingPage.getGoogleSearchInput()
.getSelenideElement().getWrappedElement());
googleLandingPage.getGoogleSearch().given()
.then().click().saveScreenshot("/Users/alvarolasernalopez/Documents/screen" +
".png");
stop();
open("https://www.google.com");
googleLandingPage.getGoogleSearch().given().waitFor(10).untilIsVisible()
.then().click().saveScreenshot("/Users/alvarolasernalopez/Documents/screen" +
".png");

raiseSoftAsserts();
}


Expand All @@ -86,6 +66,7 @@ public void testDesktopBrowserStatusCode() {
Configuration.automationType = DESKTOP_PLATFORM;
Configuration.logNetworkCalls = true;
Configuration.browser = "chrome";
Configuration.headless = true;
open("https://www.google.com")
.getNetworkCalls().logAllCalls().filterByExactUrl("https://www.google.com/")
.logFilteredCalls()
Expand All @@ -107,11 +88,14 @@ public void testDesktopBrowserStatusCode() {
public void testDesktopCustomDriverBrowser() {
Configuration.automationType = DESKTOP_PLATFORM;
Configuration.browser = "chrome";
Configuration.headless = true;
open("https://www.google.com");
stop();
ChromeOptions options = new ChromeOptions();
String userAgent = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)";
ChromeOptions options = new ChromeOptions();
options.addArguments("--remote-allow-origins=*");
options.addArguments("--user-agent=" + userAgent);
options.addArguments("--headless");
ChromeDriver chromeDriver = new ChromeDriver(options);
setDriver(chromeDriver);
open("https://www.whatsmyua.info/");
Expand All @@ -128,6 +112,7 @@ public void testAndroidBrowserOneLine() {
Configuration.useAllure = false;
Configuration.softAsserts = true;
Configuration.browser = "chrome";
Configuration.headless = true;
Configuration.testUILogLevel = LogLevel.DEBUG;
open("https://loadero.com/login")
.given("I set element").setElement(byCssSelector("#username"))
Expand All @@ -139,5 +124,6 @@ public void testAndroidBrowserOneLine() {
.then("I find the submit").setElement(byCssSelector("[type=\"submit\"]"))
.and("I click on it").click();
raiseSoftAsserts();
stop();
}
}