From 7038ed8ae654f090bce6aca8e0c3d7fb6db3472c Mon Sep 17 00:00:00 2001 From: Aleksey Gerasimov <56544305+anzud@users.noreply.github.com> Date: Wed, 13 May 2020 20:05:41 +0300 Subject: [PATCH] Products table showed #19 (#56) * Add scenario * extra spaces * expand uploadFile for specify different files * change action for use fieName * too early try to upload file * trying to fix login unstability Co-authored-by: Aleksey Gerasimov --- src/assets/dump-longInput-gm-holdback.txt | 55 +++++++++++++++++++++++ src/features/home-page.feature | 9 +--- src/features/job-page.feature | 14 ++++-- src/features/previewModalWindow.feature | 4 +- src/steps/when.ts | 2 +- src/support/action/authorizationOrSkip.ts | 35 ++++++++------- src/support/action/uploadFile.ts | 4 +- 7 files changed, 93 insertions(+), 30 deletions(-) create mode 100644 src/assets/dump-longInput-gm-holdback.txt diff --git a/src/assets/dump-longInput-gm-holdback.txt b/src/assets/dump-longInput-gm-holdback.txt new file mode 100644 index 00000000..c83074fb --- /dev/null +++ b/src/assets/dump-longInput-gm-holdback.txt @@ -0,0 +1,55 @@ +12/3/2019 BARS Reprint + + + RARPK028 BARS 12/02/2019 + HOLDBACK DETAIL REPORT 00:06:17 + REPORT PERIOD 11/01/2019 TO 11/30/2019 PAGE 1 + + BAC: 114394 + BMD: 13 19084 + + + SS/SITE CODE 13 19084 + + + STATEMENT INVOICE INVOICE TOTAL + DATE VIN NUMBER DATE AMOUNT + + 01/31/20 1G1ZD5ST5 LF051052 1OD94914685 11/12/19 934.50 + 01/31/20 1G1JD5SB0 L4103011 1OD94737466 11/07/19 593.85 + 01/31/20 1G1FY6S07 L4106258 1OD95576574 11/25/19 1,137.75 + 01/31/20 1G1FG1R72 L0112873 1OD94454666 11/01/19 1,379.55 + 01/31/20 1G1FH1R7X L0116201 1OD95319819 11/20/19 1,463.10 + 01/31/20 1GCUYBEF9 LZ149574 1OD94501748 11/04/19 1,323.90 + 01/31/20 1GC4YLE7X LF157828 1OD94442190 11/01/19 1,284.30 + 01/31/20 1GC4YPEY2 LF166314 1OD95369152 11/21/19 2,113.65 + 01/31/20 3GCUYDET7 LG182350 1OD95216841 11/18/19 1,607.25 + 01/31/20 1GNSKJKC4 LR187301 1OD94572723 11/04/19 2,279.55 + 01/31/20 1GNSKBKC9 LR187378 1OD94570776 11/04/19 1,970.85 + 01/31/20 3GCUYDED0 LG193537 1OD95639794 11/26/19 1,475.40 + 01/31/20 3GCUYDED6 LG193543 1OD95706007 11/27/19 1,475.40 + 01/31/20 3GCUYDED9 LG194203 1OD95706247 11/27/19 1,437.90 + 01/31/20 1GNSKBKC0 LR198589 1OD95033998 11/14/19 1,962.45 + 01/31/20 2GCVKNEC5 K1230799 1OD94615282 11/05/19 1,160.25 + 01/31/20 2GCVKNEC0 K1231861 1OD94769907 11/07/19 1,187.55 + 01/31/20 KL8CB6SA1 LC418711 1OD94696167 11/06/19 429.60 + 01/31/20 KL8CB6SA4 LC421974 1OD94696258 11/06/19 441.45 + 01/31/20 3GNKBHRSX LS588659 1OD94999173 11/13/19 1,225.20 + + TOTAL 26,883.45 + + + GRAND TOTAL + 01/31/20 24 34,059.75 + + + + + BUD CLARY CHEVROLET INC. + PO BOX 127 + LONGVIEW WA 98632-7079 + + + + +https://barsrr.autopartners.net/main/documentdetail?index=D012.13.19084.20191101&sellcd=13&dlrcd=19084 1/1 diff --git a/src/features/home-page.feature b/src/features/home-page.feature index 98aaf5b5..22d7ad02 100644 --- a/src/features/home-page.feature +++ b/src/features/home-page.feature @@ -5,18 +5,13 @@ Feature: Home page Because I want to get access to any job Background: - Given I open the url "https://dash-staging.accumatic.com/sign-out" - Then I wait on element "form.dash-form" for 5000ms to be displayed - When I open the url "https://dash-staging.accumatic.com/sign-in" - When I set "beepbeep" to the inputfield "#dash-form-field-password" - When I set "aleksey.gerasimov@akvelon.com" to the inputfield "#dash-form-field-email" - And I press "Enter" + Given I authorized as Dealer @Verbose Scenario: Scrolling list of jobs Given I wait on element "div.job-item" for 5000ms to be displayed Then I expect that element "div.job-item" does appear exactly "20" times - When I scroll to bottom of element ".jobs-items-view" + When I scroll to bottom of element ".jobs-items-view" Then I wait on element "div.wait-box" for 5000ms to be displayed When I scroll to bottom of element "div.wait-box" Then I wait on element "div.wait-box.wait-box--with-spinner" for 5000ms to not be displayed diff --git a/src/features/job-page.feature b/src/features/job-page.feature index 80f3e1f3..ecc564c6 100644 --- a/src/features/job-page.feature +++ b/src/features/job-page.feature @@ -10,13 +10,13 @@ Feature: Page of the job @Verbose Scenario: Button for download result is available Then I wait on element "label.file-upload-button" for 2000ms to be displayed - When I upload file + When I upload "dump-input-gm-warranty.txt" file Then I wait on element "div.job-document-item.preview-document a.download-icon-wrapper" for 20000ms to be displayed @Verbose Scenario: Delete job Then I wait on element "label.file-upload-button" for 2000ms to be displayed - When I upload file + When I upload "dump-input-gm-warranty.txt" file Then I wait on element "div.info-box.success div a:nth-child(3)" for 10000ms to be displayed When I click on the button "div.info-box.success div a:nth-child(3)" Then I expect that the url is "https://dash-staging.accumatic.com/jobs" @@ -24,8 +24,16 @@ Feature: Page of the job @Verbose Scenario: Job details Then I wait on element "label.file-upload-button" for 2000ms to be displayed - When I upload file + When I upload "dump-input-gm-warranty.txt" file Then I wait on element "div.job-details i.accu-material-icons.accu-icon.success" for 3000ms to be displayed And I expect that element "h2.job-title" contains the text "General Motors Warranty" And I expect that element "div.job-details div.job-documents-wrapper p" matches the text "Creator: aleksey.gerasimov@akvelon.com" And I expect that element "div.division-item div.division-item-name a" matches the text "101 - Bud Clary Chevrolet Subaru" + + @Verbose + Scenario: Product table is showed + Then I wait on element "label.file-upload-button" for 3000ms to be displayed + When I upload "dump-input-gm-warranty.txt" file + Then I wait on element "table.data-grid.table-datasheet" for 10000ms to be displayed + And I expect that element "table.data-grid.table-datasheet tbody tr:nth-child(2) td:nth-child(2)" does exist + And I expect that element "table.data-grid.table-datasheet tbody tr:nth-child(2) td:nth-child(2)" is not empty diff --git a/src/features/previewModalWindow.feature b/src/features/previewModalWindow.feature index ca2d780f..738331fe 100644 --- a/src/features/previewModalWindow.feature +++ b/src/features/previewModalWindow.feature @@ -9,7 +9,9 @@ Feature: Modal window with preview of output document @Verbose Scenario: Able to switch page of items - Then I wait on element "div.job-item" for 2000ms to be displayed + Then I wait on element "div.info-box.success div.info-box-content label.file-upload-button" for 2000ms to be displayed + When I upload "dump-longInput-gm-holdback.txt" file + Then I wait on element "div.job-item" for 3000ms to be displayed When I click on the element "div.job-item" Then I wait on element "a.preview-icon-wrapper" for 2000ms to be displayed When I click on the element "a.preview-icon-wrapper" diff --git a/src/steps/when.ts b/src/steps/when.ts index db45351d..d9241e10 100644 --- a/src/steps/when.ts +++ b/src/steps/when.ts @@ -109,6 +109,6 @@ When( ); When( - /^I upload file$/, + /^I upload "([^"]*)?" file$/, uploadFile, ) \ No newline at end of file diff --git a/src/support/action/authorizationOrSkip.ts b/src/support/action/authorizationOrSkip.ts index cf1748ab..0eb9b594 100644 --- a/src/support/action/authorizationOrSkip.ts +++ b/src/support/action/authorizationOrSkip.ts @@ -1,3 +1,5 @@ +import { expect } from "chai"; + /** * Open the given URL * @param {String} role role of user (Dealer or Administrator) @@ -6,21 +8,22 @@ export function authorizationOrSkip(role: 'Dealer' | 'Administrator'): void { browser.url('http://dash-staging.accumatic.com'); browser.pause(1000); const currentUrl = browser.getUrl(); - if (currentUrl.includes('jobs')) { - $('div.name')['waitForExist'](5000, false); - return; - } - - const emailSelector = '#dash-form-field-email'; - const passwordSelector = '#dash-form-field-password'; - $(emailSelector)['waitForExist'](5000, false); - if (role === 'Dealer') { - $(emailSelector)['setValue']('aleksey.gerasimov@akvelon.com'); - $(passwordSelector)['setValue']('beepbeep'); - } - else { - $(emailSelector)['setValue']('chadwick@accumatic.com'); - $(passwordSelector)['setValue']('beepbeep'); + if (!currentUrl.includes('jobs')) { + const emailSelector = '#dash-form-field-email'; + const passwordSelector = '#dash-form-field-password'; + $(emailSelector)['waitForExist'](5000, false); + if (role === 'Dealer') { + $(emailSelector)['setValue']('aleksey.gerasimov@akvelon.com'); + $(passwordSelector)['setValue']('beepbeep'); + } + else { + $(emailSelector)['setValue']('chadwick@accumatic.com'); + $(passwordSelector)['setValue']('beepbeep'); + } + browser.keys('Enter'); + } else { + const displayed = $('div.name').isDisplayed(); + expect(displayed).to + .equal(true, `Expected element "${'div.name'}" to be displayed`); } - browser.keys('Enter'); } \ No newline at end of file diff --git a/src/support/action/uploadFile.ts b/src/support/action/uploadFile.ts index d0ed4730..fdeee32b 100644 --- a/src/support/action/uploadFile.ts +++ b/src/support/action/uploadFile.ts @@ -1,6 +1,6 @@ import path from 'path'; -export function uploadFile(): void { +export function uploadFile(fileName: string): void { const fileUpload = $('label.file-upload-button input'); browser.execute( // assign style to elem in the browser @@ -10,7 +10,7 @@ export function uploadFile(): void { ); fileUpload.waitForDisplayed(); - const filePath = path.join(__dirname, '../../../src/assets/dump-input-gm-warranty.txt'); + const filePath = path.join(__dirname, `../../../src/assets/${fileName}`); const remoteFilePath = browser.uploadFile(filePath); fileUpload.setValue(remoteFilePath); } \ No newline at end of file