From 3f3c04cc4bac420e0e5f43cdb183793a71d36422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atte=20Kein=C3=A4nen?= <atte.keinanen@gmail.com> Date: Thu, 14 Sep 2017 14:29:48 +0300 Subject: [PATCH] Remove the new question tests from query_builder as they were already moved --- .../query_builder/query_builder.integ.spec.js | 140 ------------------ 1 file changed, 140 deletions(-) diff --git a/frontend/test/query_builder/query_builder.integ.spec.js b/frontend/test/query_builder/query_builder.integ.spec.js index 3a700ae8ffd..bd12ac131a1 100644 --- a/frontend/test/query_builder/query_builder.integ.spec.js +++ b/frontend/test/query_builder/query_builder.integ.spec.js @@ -90,146 +90,6 @@ describe("QueryBuilder", () => { await login() }) - /** - * Simple tests for seeing if the query builder renders without errors - */ - describe("for new questions", async () => { - let metricId = null; - let segmentId = null; - - beforeAll(async () => { - const metricDef = {name: "A Metric", description: "For testing new question flow", table_id: 1,show_in_getting_started: true, - definition: {database: 1, query: {aggregation: ["count"]}}} - const segmentDef = {name: "A Segment", description: "For testing new question flow", table_id: 1, - definition: {source_table: 1, filter: ["time-interval", ["field-id", 1], -30, "day"]}} - - // Needed for question creation flow - metricId = (await MetricApi.create(metricDef)).id; - segmentId = (await SegmentApi.create(segmentDef)).id; - }) - - afterAll(async () => { - await MetricApi.delete({ metricId, revision_message: "The lifetime of this metric was just a few seconds" }) - await SegmentApi.delete({ segmentId, revision_message: "Sadly this segment didn't enjoy a long life either" }) - }) - - it("redirects /question to /question/new", async () => { - const store = await createTestStore() - store.pushPath("/question"); - mount(store.getAppContainer()); - await store.waitForActions([REDIRECT_TO_NEW_QUESTION_FLOW]) - expect(store.getPath()).toBe("/question/new") - }) - it("renders normally on page load", async () => { - const store = await createTestStore() - - store.pushPath(Urls.newQuestion()); - const app = mount(store.getAppContainer()); - await store.waitForActions([RESET_QUERY, FETCH_METRICS, FETCH_SEGMENTS]); - await store.waitForActions([SET_REQUEST_STATE]); - - expect(app.find(NewQueryOption).length).toBe(4) - }); - it("lets you start a custom gui question", async () => { - const store = await createTestStore() - - store.pushPath(Urls.newQuestion()); - const app = mount(store.getAppContainer()); - await store.waitForActions([RESET_QUERY, FETCH_METRICS, FETCH_SEGMENTS]); - await store.waitForActions([SET_REQUEST_STATE]); - - click(app.find(NewQueryOption).filterWhere((c) => c.prop('title') === "Custom")) - await store.waitForActions(INITIALIZE_QB, UPDATE_URL, LOAD_METADATA_FOR_CARD); - expect(getQuery(store.getState()) instanceof StructuredQuery).toBe(true) - }) - - it("lets you start a custom native question", async () => { - // Don't render Ace editor in tests because it uses many DOM methods that aren't supported by jsdom - // see also parameters.integ.js for more notes about Ace editor testing - NativeQueryEditor.prototype.loadAceEditor = () => {} - - const store = await createTestStore() - - store.pushPath(Urls.newQuestion()); - const app = mount(store.getAppContainer()); - await store.waitForActions([RESET_QUERY, FETCH_METRICS, FETCH_SEGMENTS, FETCH_DATABASES]); - await store.waitForActions([SET_REQUEST_STATE]); - - click(app.find(NewQueryOption).filterWhere((c) => c.prop('title') === "SQL")) - await store.waitForActions(INITIALIZE_QB); - expect(getQuery(store.getState()) instanceof NativeQuery).toBe(true) - - // No database selector visible because in test environment we should - // only have a single database - expect(app.find(DataSelector).length).toBe(0) - - // The name of the database should be displayed - expect(app.find(NativeQueryEditor).text()).toMatch(/Sample Dataset/) - }) - - it("lets you start a question from a metric", async () => { - const store = await createTestStore() - - store.pushPath(Urls.newQuestion()); - const app = mount(store.getAppContainer()); - await store.waitForActions([RESET_QUERY, FETCH_METRICS, FETCH_SEGMENTS]); - await store.waitForActions([SET_REQUEST_STATE]); - - click(app.find(NewQueryOption).filterWhere((c) => c.prop('title') === "Metrics")) - await store.waitForActions(FETCH_DATABASES); - await store.waitForActions([SET_REQUEST_STATE]); - expect(store.getPath()).toBe("/question/new/metric") - - const entitySearch = app.find(EntitySearch) - const viewByCreator = entitySearch.find(SearchGroupingOption).last() - expect(viewByCreator.text()).toBe("Creator"); - click(viewByCreator) - expect(store.getPath()).toBe("/question/new/metric?grouping=creator") - - const group = entitySearch.find(SearchResultsGroup) - expect(group.prop('groupName')).toBe("Bobby Tables") - - const metricSearchResult = group.find(SearchResultListItem) - .filterWhere((item) => /A Metric/.test(item.text())) - click(metricSearchResult.childAt(0)) - - await store.waitForActions([INITIALIZE_QB, QUERY_COMPLETED]); - expect( - app.find(AggregationWidget).find(".View-section-aggregation").text() - ).toBe("A Metric") - }) - - it("lets you start a question from a segment", async () => { - const store = await createTestStore() - - store.pushPath(Urls.newQuestion()); - const app = mount(store.getAppContainer()); - await store.waitForActions([RESET_QUERY, FETCH_METRICS, FETCH_SEGMENTS]); - await store.waitForActions([SET_REQUEST_STATE]); - - click(app.find(NewQueryOption).filterWhere((c) => c.prop('title') === "Segments")) - await store.waitForActions(FETCH_DATABASES); - await store.waitForActions([SET_REQUEST_STATE]); - expect(store.getPath()).toBe("/question/new/segment") - - const entitySearch = app.find(EntitySearch) - const viewByTable = entitySearch.find(SearchGroupingOption).at(1) - expect(viewByTable.text()).toBe("Table"); - click(viewByTable) - expect(store.getPath()).toBe("/question/new/segment?grouping=table") - - const group = entitySearch.find(SearchResultsGroup) - .filterWhere((group) => group.prop('groupName') === "Orders") - - const metricSearchResult = group.find(SearchResultListItem) - .filterWhere((item) => /A Segment/.test(item.text())) - click(metricSearchResult.childAt(0)) - - await store.waitForActions([INITIALIZE_QB, QUERY_COMPLETED]); - expect(app.find(FilterWidget).find(".Filter-section-value").text()).toBe("A Segment") - }) - }); - describe("visualization settings", () => { it("lets you hide a field for a raw data table", async () => { const { store, qb } = await initQBWithReviewsTable(); -- GitLab