public EventAssert ddlContains( String expected) { assertThat(actual.statement()).contains(expected); return this; }
assertThat(homeDir.getAbsolutePath()).contains(File.separator + "tmp_agent_home"); FileUtils.deleteDirectory(homeDir); System.setProperty("ngrinder.agent.home", "");
@Test public void should_enable_myCustomFeature_and_myOtherCustomFeature() throws Exception { goToPage("advanced/custom_extensions2"); assertThat(getConfigurationFromPage("advanced/custom_extensions2").getContent()).contains("\"bStateSave\":true"); assertThat(getConfigurationFromPage("advanced/custom_extensions2").getContent()).contains("\"bAutoWidth\":true"); } }
@Test public void should_generate_bottom_left_link() throws Exception { goToPage("export/bottom_left_link"); // Div position inside the Datatables' wrapper assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 0).getAttribute("class")).contains("dataTables_length"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 1).getAttribute("class")).contains("dataTables_filter"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 2).getAttribute("class")).contains("dandelion_dataTables_export"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 3).getAttribute("class")).contains("dataTables_info"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 4).getAttribute("class")).contains("dataTables_paginate"); // Div style assertThat(StringUtils.trimAllWhitespace(find("div.dandelion_dataTables_export").getAttribute("style"))).contains("float:left;margin-right:10px;"); }
@Test public void should_generate_bottom_right_link() throws Exception { goToPage("export/bottom_right_link"); // Div position inside the Datatables' wrapper assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 0).getAttribute("class")).contains("dataTables_length"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 1).getAttribute("class")).contains("dataTables_filter"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 2).getAttribute("class")).contains("dandelion_dataTables_export"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 3).getAttribute("class")).contains("dataTables_info"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 4).getAttribute("class")).contains("dataTables_paginate"); // Div style assertThat(StringUtils.trimAllWhitespace(find("div.dandelion_dataTables_export").getAttribute("style"))).contains("float:right;"); }
@Test public void should_generate_top_middle_link() throws Exception { goToPage("export/top_middle_link"); // Div position inside the Datatables' wrapper assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 0).getAttribute("class")).contains("dataTables_length"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 1).getAttribute("class")).contains("dataTables_filter"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 2).getAttribute("class")).contains("dandelion_dataTables_export"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 3).getAttribute("class")).contains("dataTables_info"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 4).getAttribute("class")).contains("dataTables_paginate"); // Div style assertThat(StringUtils.trimAllWhitespace(find("div.dandelion_dataTables_export").getAttribute("style"))).contains("float:left;margin-left:10px;"); }
@Test public void should_generate_top_left_link() throws Exception { goToPage("export/top_left_link"); // Div position inside the Datatables' wrapper assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 0).getAttribute("class")).contains("dandelion_dataTables_export"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 1).getAttribute("class")).contains("dataTables_length"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 2).getAttribute("class")).contains("dataTables_filter"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 3).getAttribute("class")).contains("dataTables_info"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 4).getAttribute("class")).contains("dataTables_paginate"); // Div style assertThat(StringUtils.trimAllWhitespace(find("div.dandelion_dataTables_export").getAttribute("style"))).contains("float:left;margin-right:10px;"); }
@Test public void should_generate_bottom_middle_link() throws Exception { goToPage("export/bottom_middle_link"); // Div position inside the Datatables' wrapper assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 0).getAttribute("class")).contains("dataTables_length"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 1).getAttribute("class")).contains("dataTables_filter"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 2).getAttribute("class")).contains("dataTables_info"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 3).getAttribute("class")).contains("dataTables_paginate"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 4).getAttribute("class")).contains("dandelion_dataTables_export"); // Div style assertThat(StringUtils.trimAllWhitespace(find("div.dandelion_dataTables_export").getAttribute("style"))).contains("float:left;margin-left:10px;"); }
@Test public void should_generate_top_right_link() throws Exception { goToPage("export/top_right_link"); // Div position inside the Datatables' wrapper assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 0).getAttribute("class")).contains("dandelion_dataTables_export"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 1).getAttribute("class")).contains("dataTables_length"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 2).getAttribute("class")).contains("dataTables_filter"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 3).getAttribute("class")).contains("dataTables_info"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 4).getAttribute("class")).contains("dataTables_paginate"); // Div style assertThat(StringUtils.trimAllWhitespace(find("div.dandelion_dataTables_export").getAttribute("style"))).contains("float:right"); }
@Test public void should_generate_top_and_bottom_right_links() throws Exception { goToPage("export/top_and_bottom_right_links"); // Div position inside the Datatables' wrapper assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 0).getAttribute("class")).contains("dandelion_dataTables_export"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 1).getAttribute("class")).contains("dataTables_length"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 2).getAttribute("class")).contains("dataTables_filter"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 3).getAttribute("class")).contains("dandelion_dataTables_export"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 4).getAttribute("class")).contains("dataTables_info"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find("div", 5).getAttribute("class")).contains("dataTables_paginate"); } }
@Test public void should_use_overriden_global_configuration() throws Exception { goToPage("configuration/global_overriden"); assertThat(getTable().getAttribute("class")).contains("myClass"); }
@Test public void should_use_group1_configuration() throws Exception { goToPage("configuration/enable_custom_group"); assertThat(getTable().getAttribute("class")).contains("my-group1-class"); } }
@Test public void should_enable_myCustomFeature() throws Exception { goToPage("advanced/custom_extensions"); assertThat(getConfigurationFromPage("advanced/custom_extensions").getContent()).contains("\"bStateSave\":true"); }
@Test public void should_disable_scroll_collapse() { goToPage("basics/disable_scroll_collapse"); assertThat(find("#" + Constants.TABLE_ID + "_wrapper").find(".dataTables_scrollBody").getAttribute("style")).contains("height: 1000px"); }
@Test public void should_generate_pdf_link_with_custom_url() throws Exception { goToPage("export/custom_pdf_url"); assertThat(find("div.dandelion_dataTables_export")).hasSize(1); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getText()).isEqualTo("PDF"); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getAttribute("onclick")).isEqualTo("ddl_dt_launch_export_PDF();"); String js = getConfigurationFromPage("export/custom_pdf_url").getContent(); assertThat(js).contains("function ddl_dt_launch_export_PDF(){window.location='/context/customPdfUrl?' + $.param(oTable_myTableId.oApi._fnAjaxParameters(oTable_myTableId.fnSettings()));};"); }
@Test public void should_generate_xls_link_with_custom_url() throws Exception { goToPage("export/custom_xls_url"); assertThat(find("div.dandelion_dataTables_export")).hasSize(1); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getText()).isEqualTo("XLS"); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getAttribute("onclick")).isEqualTo("ddl_dt_launch_export_XLS();"); String js = getConfigurationFromPage("export/custom_xls_url").getContent(); assertThat(js).contains("function ddl_dt_launch_export_XLS(){window.location='/context/customXlsUrl?' + $.param(oTable_myTableId.oApi._fnAjaxParameters(oTable_myTableId.fnSettings()));};"); }
@Test public void should_generate_xml_link_with_custom_url() throws Exception { goToPage("export/custom_xml_url"); assertThat(find("div.dandelion_dataTables_export")).hasSize(1); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getText()).isEqualTo("XML"); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getAttribute("onclick")).isEqualTo("ddl_dt_launch_export_XML();"); String js = getConfigurationFromPage("export/custom_xml_url").getContent(); assertThat(js).contains("function ddl_dt_launch_export_XML(){window.location='/context/customXmlUrl?' + $.param(oTable_myTableId.oApi._fnAjaxParameters(oTable_myTableId.fnSettings()));};"); } }
@Test public void should_generate_csv_link_with_custom_url() throws Exception { goToPage("export/custom_csv_url"); assertThat(find("div.dandelion_dataTables_export")).hasSize(1); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getText()).isEqualTo("CSV"); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getAttribute("onclick")).isEqualTo("ddl_dt_launch_export_CSV();"); String js = getConfigurationFromPage("export/custom_csv_url").getContent(); assertThat(js).contains("function ddl_dt_launch_export_CSV(){window.location='/context/customCsvUrl?' + $.param(oTable_myTableId.oApi._fnAjaxParameters(oTable_myTableId.fnSettings()));};"); }
@Test public void should_generate_xlsx_link_with_custom_url() throws Exception { goToPage("export/custom_xlsx_url"); assertThat(find("div.dandelion_dataTables_export")).hasSize(1); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getText()).isEqualTo("XLSX"); assertThat(find("div.dandelion_dataTables_export").findFirst("a").getAttribute("onclick")).isEqualTo("ddl_dt_launch_export_XLSX();"); String js = getConfigurationFromPage("export/custom_xlsx_url").getContent(); assertThat(js).contains("function ddl_dt_launch_export_XLSX(){window.location='/context/customXlsxUrl?' + $.param(oTable_myTableId.oApi._fnAjaxParameters(oTable_myTableId.fnSettings()));};"); }