From 6dcee3516d357f80bfa82230e9e6faa3def46bd6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Mar 2020 10:40:09 +0100 Subject: [PATCH] ticket e2e fixes --- e2e/helpers/selectors.js | 2 +- e2e/paths/05-ticket/09_weekly.spec.js | 11 +---------- e2e/paths/05-ticket/12_descriptor.spec.js | 3 +-- front/core/components/searchbar/searchbar.js | 2 ++ 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 89857f770..88f7cb40d 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -369,7 +369,7 @@ export default { newTicketButton: 'vn-ticket-index a', searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr', searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr', - searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)', + searchResultDate: 'vn-ticket-summary [label=Landed] span', topbarSearch: 'vn-searchbar', advancedSearchButton: 'vn-ticket-search-panel button[type=submit]', searchButton: 'vn-searchbar vn-icon[icon="search"]', diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js index 3e791dc18..9213afd1d 100644 --- a/e2e/paths/05-ticket/09_weekly.spec.js +++ b/e2e/paths/05-ticket/09_weekly.spec.js @@ -63,16 +63,7 @@ describe('Ticket descriptor path', () => { }); it('should now search for the ticket 11', async() => { - await page.write(selectors.ticketsIndex.topbarSearch, '11'); - await page.waitToClick(selectors.ticketsIndex.searchButton); - await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); - const result = await page.countElement(selectors.ticketsIndex.searchResult); - - expect(result).toEqual(1); - }); - - it(`should click on the search result to access to the ticket`, async() => { - await page.waitToClick(selectors.ticketsIndex.searchResult); + await page.accessToSearchResult('11'); let url = await page.expectURL('/summary'); expect(url).toBe(true); diff --git a/e2e/paths/05-ticket/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js index 59691d380..0e3712c82 100644 --- a/e2e/paths/05-ticket/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -58,8 +58,7 @@ describe('Ticket descriptor path', () => { it(`should search for the deleted ticket and check it's date`, async() => { await page.write(selectors.ticketsIndex.topbarSearch, '18'); await page.waitToClick(selectors.ticketsIndex.searchButton); - await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); - await page.wait(selectors.ticketsIndex.searchResultDate); + await page.expectURL('/summary'); const result = await page.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText'); expect(result).toContain(2000); diff --git a/front/core/components/searchbar/searchbar.js b/front/core/components/searchbar/searchbar.js index 640ed48d6..21e72f60d 100644 --- a/front/core/components/searchbar/searchbar.js +++ b/front/core/components/searchbar/searchbar.js @@ -239,6 +239,8 @@ export default class Searchbar extends Component { this.filter = filter; + if (!filter && this.model) + this.model.clear(); if (source != 'state') this.transition = this.$state.go(state, params, opts).transition; if (source != 'bar')