Skip to content
This repository was archived by the owner on Oct 18, 2018. It is now read-only.
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
target
*.iml
.DS_Store
.DS_Store
*jcore*.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import ru.qatools.school.DbClient;
import ru.qatools.school.pages.MainPage;
import ru.qatools.school.rules.WebDriverRule;
import ru.qatools.school.steps.websteps.DefaultSteps;
Expand All @@ -25,12 +26,12 @@ public void initSteps() {
@Test
@Title("Должны видеть виджет на главной странице")
public void shouldSeeWidgetOnMainPage() {
defaultSteps.openMainPageWithCity(MOSCOW);
defaultSteps.shouldSee(onMainPage().getWeatherWidget().get(0));
defaultSteps.dbString(dbClient.getCityById("Po"));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Наверное, мы не должны были это увидеть


private MainPage onMainPage() {
return new MainPage(webDriverRule.getDriver());
}
DbClient dbClient = new DbClient();

}
12 changes: 6 additions & 6 deletions dbclient-module/src/main/java/ru/qatools/school/DbClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
public class DbClient {
private static final String CONNECTION_STRING =
System.getProperty("db.url", "jdbc:mysql://db.host.ru:3310/db_name");
private static final String USER = System.getProperty("db.user", "user");
private static final String PASSWORD = System.getProperty("db.password", "password");;
System.getProperty("db.url", "jdbc:mysql://db.weather.lanwen.ru:3306/weather");
private static final String USER = System.getProperty("db.user", "autoschool");
private static final String PASSWORD = System.getProperty("db.password", U_PASSWORD);

private Connection connection;
private DSLContext create;
Expand All @@ -31,10 +31,10 @@ public DbClient() {
create = DSL.using(connection, SQLDialect.MYSQL);
}

public String getCityById(Integer id) {
public String getCityById(String str) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И тут с названием метода не сложилось

Record1 result = create.select(field("name"))
.from(table("table_name"))
.where(field("id").equal(id))
.from(table("City"))
.where(field("name").like(str))
.fetchOne();
return result.getValue(0, String.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public void shouldSee(WebElement element) {
assertThat("Должны видеть элемент", element, isDisplayed());
}

@Step("Выводим что-тоиз базы")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В консоль все-таки не выводим, наверное

public void dbString(String str){
System.out.println("Printed str = " + str);
}

private MainPage onMainPage() {
return new MainPage(driver);
}
Expand Down