diff --git a/mvc/controllers/api/api_controller.js b/mvc/controllers/api/api_controller.js index fbea2785..3408b8d1 100644 --- a/mvc/controllers/api/api_controller.js +++ b/mvc/controllers/api/api_controller.js @@ -732,19 +732,26 @@ async function createNewBaseline(params) { const identFields = buildIdentObject(params); + const lastBaseline = await Baseline.findOne(identFields) + .exec(); + const sameBaseline = await Baseline.findOne({ ...identFields, ...{ snapshootId: params.actualSnapshotId } }) .exec(); + const baselineParams = lastBaseline?.ignoreRegions + ? { ...identFields, ...{ ignoreRegions: lastBaseline.ignoreRegions } } + : identFields; + if (sameBaseline) { log.debug(`the baseline with same ident and snapshot id: ${params.actualSnapshotId} already exist`, $this); } else { log.debug(`the baseline with same ident and snapshot id: ${params.actualSnapshotId} does not exist, - create new one, identFields: ${JSON.stringify(identFields)}`, $this); + create new one, baselineParams: ${JSON.stringify(baselineParams)}`, $this); } log.silly({ sameBaseline }); - const resultedBaseline = sameBaseline || await Baseline.create(identFields); + const resultedBaseline = sameBaseline || await Baseline.create(baselineParams); resultedBaseline.markedAs = params.markedAs; resultedBaseline.markedById = params.markedById; @@ -754,7 +761,7 @@ async function createNewBaseline(params) { resultedBaseline.snapshootId = params.actualSnapshotId; return resultedBaseline.save(); -}; +} module.exports.createNewBaseline = createNewBaseline; @@ -2132,7 +2139,7 @@ exports.task_test = async (req, res, next) => { ); for (let i = 0; i < x; i += 1) { - await new Promise(r => setTimeout(() => r(), interval)); + await new Promise((r) => setTimeout(() => r(), interval)); taskOutput(`- Task Output - '${i}'\n`, res); if (isAborted) { taskOutput(`the task was aborted\n`, res); diff --git a/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/mainView.ts b/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/mainView.ts index 65f7bd19..138f22d2 100644 --- a/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/mainView.ts +++ b/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/mainView.ts @@ -8,25 +8,25 @@ import { log } from '../../../../../../../shared/utils/Logger'; /* eslint-disable dot-notation,no-underscore-dangle */ interface IRectParams { - name: any - fill: any - stroke: any - strokeWidth: any - top: any - left: any - width: any - height: any + name: any; + fill: any; + stroke: any; + strokeWidth: any; + top: any; + left: any; + width: any; + height: any; } interface Props { - canvasElementWidth: number - canvasElementHeight: number - canvasId: string + canvasElementWidth: number; + canvasElementHeight: number; + canvasId: string; // url: string - actual: any - expectedImage: any - actualImage: any - diffImage: any + actual: any; + expectedImage: any; + actualImage: any; + diffImage: any; } export class MainView { @@ -347,6 +347,13 @@ export class MainView { r.bringToFront(); } + removeAllRegions() { + const regions = this.allRects; + regions.forEach((region) => { + this.canvas.remove(region); + }); + } + get allRects() { return this.canvas.getObjects() .filter((r) => (r.name === 'ignore_rect') || (r.name === 'bound_rect')); @@ -481,6 +488,7 @@ export class MainView { } async getSnapshotIgnoreRegionsDataAndDrawRegions(id: string) { + this.removeAllRegions(); const regionData = await MainView.getRegionsData(id); this.drawRegions(regionData.ignoreRegions); } diff --git a/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/CheckDetails.tsx b/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/CheckDetails.tsx index 21948997..e00986dd 100644 --- a/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/CheckDetails.tsx +++ b/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/CheckDetails.tsx @@ -151,7 +151,7 @@ export function CheckDetails({ initCheckData, checkQuery, closeHandler }: Props) const diffImgSrc = `${config.baseUri}/snapshoots/${currentCheck?.diffId?.filename}?diffImg`; const diffImage = currentCheck?.diffId?.filename ? await imageFromUrl(diffImgSrc) : null; - await setMainView((prev) => { + setMainView((prev) => { if (prev) return prev; // for dev mode, when components render twice const MV = new MainView( { @@ -185,9 +185,9 @@ export function CheckDetails({ initCheckData, checkQuery, closeHandler }: Props) mainView.getSnapshotIgnoreRegionsDataAndDrawRegions(baselineId); } }, [ - baselineQuery.data?.timestamp, + // baselineQuery.data?.timestamp, mainView?.toString(), - query.checkId, + // query.checkId, ]); return ( diff --git a/tests/features/NEW/CP/check_details/regions.feature b/tests/features/NEW/CP/check_details/regions.feature index 473b78a6..d20df831 100644 --- a/tests/features/NEW/CP/check_details/regions.feature +++ b/tests/features/NEW/CP/check_details/regions.feature @@ -1,117 +1,243 @@ @smoke -Feature: Check details Regions - - Background: - Given I clear Database and stop Server - Given I start Server and start Driver - When I open the app - When I clear local storage - Given I create "1" tests with: - """ - testName: TestName - checks: - - checkName: CheckName - filePath: files/A.png - """ - When I accept via http the 1st check with name "CheckName" - - When I go to "main" page - When I unfold the test "TestName" - When I click on the element "[data-test-preview-image='CheckName']" - Then I wait on element "[data-check-header-name='CheckName']" to be displayed - - Scenario: Regions - When I execute javascript code: - """ - return(mainView.allRects.length.toString()); - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - 0 - """ - - Then I wait on element "[data-check='add-ignore-region']" to be displayed - When I click on the element "[data-check='add-ignore-region']" - - When I execute javascript code: - """ - return (mainView.allRects.length.toString()); - """ - - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - 1 - """ - - # save - When I click on the element "[data-check='save-ignore-region']" - When I wait for "1" seconds - When I refresh page - When I wait for "3" seconds - When I execute javascript code: - """ - return (mainView.allRects.length.toString()); - """ - - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - 1 - """ - - # check initial coordinates - When I execute javascript code: - """ - const { left, top: top1, width, height, fill, stroke, opacity } = mainView.getLastRegion() - return [left, top1, width, height, fill, stroke, opacity].toString() - """ - Then I expect the stored "js" string is equal: - """ - 20,50,202,102,MediumVioletRed,black,0.5 - """ - - # update coordinates - When I execute javascript code: - """ - mainView.getLastRegion().left = 300 - mainView.getLastRegion().top = 500 - mainView.canvas.renderAll() - const { left, top: top1, width, height, fill, stroke, opacity } = mainView.getLastRegion() - return [Math.round(left), Math.round(top1), Math.round(width), Math.round(height), fill, stroke, opacity].toString() - """ - Then I expect the stored "js" string is equal: - """ - 300,500,202,102,MediumVioletRed,black,0.5 - """ - - # save - When I click on the element "[data-check='save-ignore-region']" - When I wait for "1" seconds - When I refresh page - When I wait for "3" seconds - - # check updated coordinates - When I execute javascript code: - """ - return mainView.canvas.getObjects().filter(x=>x.name==='ignore_rect').length.toString() - """ - Then I expect the stored "js" string is equal: - """ - 1 - """ - - When I execute javascript code: - """ - const { left, top: top1, width, height, fill, stroke, opacity } = mainView.getLastRegion() - console.log(mainView.getLastRegion()) - console.log(mainView.getLastRegion()) - console.log(mainView.getLastRegion()) - return [Math.round(left), Math.round(top1), Math.round(width), Math.round(height), fill, stroke, opacity].toString() - """ - - Then I expect the stored "js" string is equal: - """ - 300,500,204,104,MediumVioletRed,black,0.5 - """ +Feature: Check details - Regions + + Background: + Given I clear Database and stop Server + Given I start Server and start Driver + When I open the app + When I clear local storage + Given I create "1" tests with: + """ + testName: TestName + checks: + - checkName: CheckName + filePath: files/A.png + """ + When I accept via http the 1st check with name "CheckName" + + When I go to "main" page + When I unfold the test "TestName" + When I click on the element "[data-test-preview-image='CheckName']" + Then I wait on element "[data-check-header-name='CheckName']" to be displayed + + Scenario: Regions - add, save, check + # check absence + When I execute javascript code: + """ + return(mainView.allRects.length.toString()); + """ + When I wait for "1" seconds + Then I expect the stored "js" string is equal: + """ + 0 + """ + + # add and check presence + Then I wait on element "[data-check='add-ignore-region']" to be displayed + When I click on the element "[data-check='add-ignore-region']" + + When I execute javascript code: + """ + return (mainView.allRects.length.toString()); + """ + + When I wait for "1" seconds + Then I expect the stored "js" string is equal: + """ + 1 + """ + + # save refresh page check presence + When I click on the element "[data-check='save-ignore-region']" + When I wait for "1" seconds + When I refresh page + When I wait for "3" seconds + When I execute javascript code: + """ + return (mainView.allRects.length.toString()); + """ + + When I wait for "1" seconds + Then I expect the stored "js" string is equal: + """ + 1 + """ + + # check initial coordinates + When I execute javascript code: + """ + const { left, top: top1, width, height, fill, stroke, opacity } = mainView.getLastRegion() + return [left, top1, width, height, fill, stroke, opacity].toString() + """ + Then I expect the stored "js" string is equal: + """ + 20,50,202,102,MediumVioletRed,black,0.5 + """ + + # update coordinates + When I execute javascript code: + """ + mainView.getLastRegion().left = 300 + mainView.getLastRegion().top = 500 + mainView.canvas.renderAll() + const { left, top: top1, width, height, fill, stroke, opacity } = mainView.getLastRegion() + return [Math.round(left), Math.round(top1), Math.round(width), Math.round(height), fill, stroke, opacity].toString() + """ + Then I expect the stored "js" string is equal: + """ + 300,500,202,102,MediumVioletRed,black,0.5 + """ + + # save + When I click on the element "[data-check='save-ignore-region']" + When I wait for "1" seconds + When I refresh page + When I wait for "3" seconds + + # check updated coordinates + When I execute javascript code: + """ + return mainView.canvas.getObjects().filter(x=>x.name==='ignore_rect').length.toString() + """ + Then I expect the stored "js" string is equal: + """ + 1 + """ + + When I execute javascript code: + """ + const { left, top: top1, width, height, fill, stroke, opacity } = mainView.getLastRegion() + console.log(mainView.getLastRegion()) + console.log(mainView.getLastRegion()) + console.log(mainView.getLastRegion()) + return [Math.round(left), Math.round(top1), Math.round(width), Math.round(height), fill, stroke, opacity].toString() + """ + + Then I expect the stored "js" string is equal: + """ + 300,500,204,104,MediumVioletRed,black,0.5 + """ + + Scenario: Regions - delete + # add and check presence + Then I wait on element "[data-check='add-ignore-region']" to be displayed + When I click on the element "[data-check='add-ignore-region']" + + When I execute javascript code: + """ + return (mainView.allRects.length.toString()); + """ + + When I wait for "1" seconds + Then I expect the stored "js" string is equal: + """ + 1 + """ + + # save refresh page check presence + When I click on the element "[data-check='save-ignore-region']" + When I wait for "1" seconds + When I refresh page + When I wait for "3" seconds + When I execute javascript code: + """ + return (mainView.allRects.length.toString()); + """ + + When I wait for "1" seconds + Then I expect the stored "js" string is equal: + """ + 1 + """ + + # select and remove + When I execute javascript code: + """ + mainView.canvas.setActiveObject(mainView.canvas.getObjects().filter(x=>x.name==='ignore_rect')[0]); + mainView.canvas.requestRenderAll(); + """ + When I click on the element "[data-check='remove-ignore-region']" + + # save refresh page check absence + When I click on the element "[data-check='save-ignore-region']" + When I wait for "1" seconds + When I refresh page + When I wait for "3" seconds + When I execute javascript code: + """ + return (mainView.allRects.length.toString()); + """ + + When I wait for "1" seconds + Then I expect the stored "js" string is equal: + """ + 0 + """ + + Scenario: Regions - copy regions from previous baseline + # add region to first check + Then I wait on element "[data-check='add-ignore-region']" to be displayed + When I click on the element "[data-check='add-ignore-region']" + + # save refresh page check presence + When I click on the element "[data-check='save-ignore-region']" + When I wait for "1" seconds + When I refresh page + When I wait for "3" seconds + When I execute javascript code: + """ + return (mainView.allRects.length.toString()); + """ + + When I wait for "1" seconds + Then I expect the stored "js" string is equal: + """ + 1 + """ + + # create second check + Given I create "1" tests with: + """ + testName: TestName + checks: + - checkName: CheckName + filePath: files/A.png + """ + + # open second check and check absence + When I go to "main" page + When I unfold the test "TestName" + When I click on the element "[data-test-preview-image='CheckName']" + + Then I wait on element "[data-check-header-name='CheckName']" to be displayed + When I execute javascript code: + """ + return (mainView.allRects.length.toString()); + """ + + When I wait for "1" seconds + Then I expect the stored "js" string is equal: + """ + 0 + """ + + # accept second check and check presence + When I accept via http the 2st check with name "CheckName" + + When I go to "main" page + When I unfold the test "TestName" + When I click on the element "[data-test-preview-image='CheckName']" + + Then I wait on element "[data-check-header-name='CheckName']" to be displayed + When I execute javascript code: + """ + return (mainView.allRects.length.toString()); + """ + + When I wait for "1" seconds + Then I expect the stored "js" string is equal: + """ + 1 + """ + + diff --git a/tests/features/api/auth_off.feature b/tests/features/PENDING/api/auth_off.feature similarity index 100% rename from tests/features/api/auth_off.feature rename to tests/features/PENDING/api/auth_off.feature diff --git a/tests/features/api/auth_on.feature b/tests/features/PENDING/api/auth_on.feature similarity index 100% rename from tests/features/api/auth_on.feature rename to tests/features/PENDING/api/auth_on.feature diff --git a/tests/features/api/check_if_baseline_exist.feature b/tests/features/PENDING/api/check_if_baseline_exist.feature similarity index 100% rename from tests/features/api/check_if_baseline_exist.feature rename to tests/features/PENDING/api/check_if_baseline_exist.feature diff --git a/tests/features/api/get_checks.feature b/tests/features/PENDING/api/get_checks.feature similarity index 100% rename from tests/features/api/get_checks.feature rename to tests/features/PENDING/api/get_checks.feature diff --git a/tests/features/api/smoke.feature b/tests/features/PENDING/api/smoke.feature similarity index 100% rename from tests/features/api/smoke.feature rename to tests/features/PENDING/api/smoke.feature diff --git a/tests/features/api/start_stop_session.feature b/tests/features/PENDING/api/start_stop_session.feature similarity index 100% rename from tests/features/api/start_stop_session.feature rename to tests/features/PENDING/api/start_stop_session.feature diff --git a/tests/features/baselines/base_flow.feature b/tests/features/PENDING/baselines/base_flow.feature similarity index 100% rename from tests/features/baselines/base_flow.feature rename to tests/features/PENDING/baselines/base_flow.feature diff --git a/tests/features/baselines/set_match_type.feature b/tests/features/PENDING/baselines/set_match_type.feature similarity index 100% rename from tests/features/baselines/set_match_type.feature rename to tests/features/PENDING/baselines/set_match_type.feature diff --git a/tests/features/checkview/prev_next_buttons.feature b/tests/features/PENDING/checkview/prev_next_buttons.feature similarity index 100% rename from tests/features/checkview/prev_next_buttons.feature rename to tests/features/PENDING/checkview/prev_next_buttons.feature diff --git a/tests/features/checks/create_by_user.feature b/tests/features/checks/create_by_user.feature deleted file mode 100644 index 16479641..00000000 --- a/tests/features/checks/create_by_user.feature +++ /dev/null @@ -1,87 +0,0 @@ -@integration -Feature: Creation by User - - Background: - Given I clear Database and stop Server - When I set env variables: - """ - SYNGRISI_TEST_MODE: 1 - SYNGRISI_AUTH: 0 - """ - Given I start Server - - When I create via http test user - Given I stop Server - - When I set env variables: - """ - SYNGRISI_TEST_MODE: 0 - SYNGRISI_AUTH: 1 - """ - Given I start Server and start Driver - When I wait for "5" seconds - - Scenario: Create as User - # login as test admin - When I login with user:"Test" password "123" - Then I wait on element "span*=TA" to be displayed - - # create user - When I go to "admin>users" page - When I wait for "3" seconds - When I click on the element "#add-user" - When I set "j_doe@gmail.com" to the inputfield "//input[@placeholder='Username']" - When I set "John" to the inputfield "//input[@placeholder='First Name']" - When I set "Doe" to the inputfield "//input[@placeholder='Last Name']" - When I select the option with the text "user" for element "//select[@new-user-role]" - When I set "Password-123" to the inputfield "//input[@placeholder='password']" - When I click on the element "a.send-new-user-button" - When I wait for "3" seconds - When I refresh page - When I wait for "3" seconds - Then I expect that element "//input[@name='username' and @value='j_doe@gmail.com']/../..//input[@name='firstName' and @value='John']/../..//input[@name='lastName' and @value='Doe']" is displayed - - When I go to "logout" page - When I wait for "1" seconds - - # login by user - When I login with user:"j_doe@gmail.com" password "Password-123" - Then I wait on element "span*=JD" to be displayed - - # generate and parse API key - When I click on the element "a#user-icon" - When I click on the element "#generate-api" - When I accept the confirmbox - When I parse the API key - - # create check - When I set the API key in config - When I create "1" tests with params: - """ - filePath: files/A.png - testName: Create by User - """ - - # the check validation as new user - When I go to "main" page - When I wait for "2" seconds - Then I expect that VRS test "Create by User - 1" has "New" status - When I click on "Create by User - 1" VRS test - - Then I expect that VRS test "Create by User - 1" is unfolded - Then I expect that "1" check preview tooltip "created by" field equal to "j_doe@gmail.com" - - # the check validation as test admin - When I go to "logout" page - When I wait for "2" seconds - - When I login with user:"Test" password "123" - Then I wait on element "span*=TA" to be displayed - - When I wait for "2" seconds - Then I expect that VRS test "Create by User - 1" has "New" status - When I click on "Create by User - 1" VRS test - - Then I expect that VRS test "Create by User - 1" is unfolded - Then I expect that "1" check preview tooltip "created by" field equal to "j_doe@gmail.com" - diff --git a/tests/features/checks/create_checks.feature b/tests/features/checks/create_checks.feature deleted file mode 100644 index 7fffb5d4..00000000 --- a/tests/features/checks/create_checks.feature +++ /dev/null @@ -1,257 +0,0 @@ -@integration @e2e -Feature: VRS One Suite, One test, One check - - Background: - Given I clear Database and stop Server - Given I start Server and start Driver - - @smoke - Scenario: Create one check - [new, without session ending] - Given I start session with parameters: - """ - testName: "Without session ending" - """ - When I check image with path: "files/A.png" as "new int check" - When I open the app - Then I wait and refresh page on element "span=Without session ending" for "3" seconds to exist - Then I expect that 1th test "Without session ending" has "Running" status - Then I expect that 1th test "Without session ending" contains "chrome" browser - Then I expect that 1th test "Without session ending" has "≠" viewport - - When I click on "Without session ending" VRS test - Then I expect that VRS test "Without session ending" is unfolded - Then I expect that VRS check "1/1 new int check" has "New" status - - # descriptive e2e test - @smoke - Scenario: Create one check [new, with session ending] - Given I set window size: "1366x768" - When I create "1" tests with params: - """ - appName: Integration Test App - testName: With session ending - checkName: Check - 1 - filePath: files/A.png - branch: onebranch - tags: ["@tag11", "@tag22"] - """ - - When I open the app - When I wait and refresh page on element "span=With session ending - 1" for "3" seconds to exist - Then I expect that 1th test "With session ending - 1" has "New" status - Then I expect that 1th test "With session ending - 1" has "onebranch" branch - Then I expect that 1th test "With session ending - 1" has "Guest" created by - Then I expect that 1th test "With session ending - 1" has "Unaccepted" accepted status - Then I expect that 1th test "With session ending - 1" contains "" date - Then I expect that 1th test "With session ending - 1" contains "chrome" browser - Then I expect that 1th test "With session ending - 1" has "" platform - Then I expect that 1th test "With session ending - 1" has "1366x768" viewport - Then I expect that 1th test "With session ending - 1" contains "tag11" tags - Then I expect that 1th test "With session ending - 1" contains "tag22" tags - - When I click on "With session ending - 1" VRS test - Then I expect that VRS test "With session ending - 1" is unfolded - Then I expect that VRS check "1/1 Check - 1" has "New" status - Then I expect the "1/1 Check - 1" check has "not accept" acceptance status - - When I open "Check - 1" view - When I wait for "2" seconds - Then I expect the element ".status" contains the text "new" via js - - # suite and run - When I go to "main" page - Then I expect that element "span=Integration suite" is displayed - When I go to "runs" page - Then I expect that element "span=integration_run_name" is displayed - - @smoke - Scenario: VRS create two checks - [new, failed (not_accepted)] - Given I set window size: "1366x768" - When I create "2" tests with params: - """ - appName: Integration Test App - testName: "Created two: new, passed" - checkName: Check - 1 - filePath: files/A.png - branch: onebranch - """ - When I open the app - When I wait and refresh page on element "span=Created two: new, passed - 1" for "3" seconds to exist - Then I expect that 1th test "Created two: new, passed - 2" has "Failed" status - Then I expect that 1th test "Created two: new, passed - 2" has "onebranch" branch - Then I expect that 1th test "Created two: new, passed - 2" has "Guest" created by - Then I expect that 1th test "Created two: new, passed - 2" has "Unaccepted" accepted status - Then I expect that 1th test "Created two: new, passed - 2" contains "" date - Then I expect that 1th test "Created two: new, passed - 2" contains "chrome" browser - Then I expect that 1th test "Created two: new, passed - 2" has "" platform - Then I expect that 1th test "Created two: new, passed - 2" has "1366x768" viewport - - Then I expect that 1th test "Created two: new, passed - 1" has "New" status - - When I click on "Created two: new, passed - 2" VRS test - Then I expect that VRS test "Created two: new, passed - 2" is unfolded - Then I expect that VRS check "1/1 Check - 1" has "Failed" status - Then I expect the "1/1 Check - 1" check has "not accept" acceptance status - When I open "Check - 1" view - Then I expect that element "#not-accepted-checks-char" is displayed - Then the element "#not-accepted-checks-char" contains the text "×" - Then the element "//div[contains(text(), 'failReasons')]/../div[2]" contains the text "not_accepted" - - @smoke - Scenario: VRS create two checks - [new, accept, passed] - Given I set window size: "1366x768" - When I create "1" tests with params: - """ - appName: Integration Test App - testName: "Created two: new, passed" - checkName: Check - 1 - filePath: files/A.png - branch: onebranch - """ - When I accept via http the 1st check with name "Check - 1" - When I create "1" tests with params: - """ - appName: Integration Test App - testName: "Created two: new, passed" - checkName: Check - 1 - filePath: files/A.png - branch: onebranch - """ - When I open the app - When I wait and refresh page on element "span=Created two: new, passed - 1" for "3" seconds to exist - Then I expect that 1th test "Created two: new, passed - 1" has "Passed" status - Then I expect that 1th test "Created two: new, passed - 1" has "onebranch" branch - Then I expect that 1th test "Created two: new, passed - 1" has "Guest" created by - Then I expect that 1th test "Created two: new, passed - 1" has "Accepted" accepted status - Then I expect that 1th test "Created two: new, passed - 1" contains "" date - Then I expect that 1th test "Created two: new, passed - 1" contains "chrome" browser - Then I expect that 1th test "Created two: new, passed - 1" has "" platform - Then I expect that 1th test "Created two: new, passed - 1" has "1366x768" viewport - - When I click on "Created two: new, passed - 1" VRS test - Then I expect that VRS test "Created two: new, passed - 1" is unfolded - Then I expect that VRS check "1/1 Check - 1" has "Passed" status - Then I expect the "1/1 Check - 1" check has "previously accept" acceptance status - - Then I expect that 2th test "Created two: new, passed - 1" has "New" status - - @smoke - Scenario: VRS create two checks - [new, failed (different_images)] - Given I set window size: "1366x768" - When I create "1" tests with params: - """ - appName: Integration Test App - testName: "Created two: new, failed" - checkName: Check - 1 - filePath: files/A.png - branch: onebranch - """ - When I accept via http the 1st check with name "Check - 1" - When I create "1" tests with params: - """ - appName: Integration Test App - testName: "Created two: new, failed" - checkName: Check - 1 - filePath: files/B.png - branch: onebranch - """ - When I open the app - When I wait and refresh page on element "span=Created two: new, failed - 1" for "3" seconds to exist - Then I expect that 1th test "Created two: new, failed - 1" has "Failed" status - Then I expect that 1th test "Created two: new, failed - 1" has "onebranch" branch - Then I expect that 1th test "Created two: new, failed - 1" has "Guest" created by - Then I expect that 1th test "Created two: new, failed - 1" has "Accepted" accepted status - Then I expect that 1th test "Created two: new, failed - 1" contains "" date - Then I expect that 1th test "Created two: new, failed - 1" contains "chrome" browser - Then I expect that 1th test "Created two: new, failed - 1" has "" platform - Then I expect that 1th test "Created two: new, failed - 1" has "1366x768" viewport - - When I click on "Created two: new, failed - 1" VRS test - Then I expect that VRS test "Created two: new, failed - 1" is unfolded - Then I expect that VRS check "1/1 Check - 1" has "Failed" status - Then I expect the "1/1 Check - 1" check has "previously accept" acceptance status - - Then I expect that 2th test "Created two: new, failed - 1" has "New" status - - When I open "Check - 1" view - Then the element "#mismatch_percentage" contains the text "(1.34%)" - Then the element "//div[contains(text(), 'failReasons')]/../div[2]" contains the text "different_images" - - @smoke - Scenario: VRS create three checks - [new, passed, failed (different_images)] - Given I set window size: "1366x768" - When I create "1" tests with params: - """ - appName: Integration Test App - testName: "Created three: new, passed, failed" - checkName: Check - 1 - filePath: files/A.png - branch: onebranch - """ - When I accept via http the 1st check with name "Check - 1" - - When I create "1" tests with params: - """ - appName: Integration Test App - testName: "Created three: new, passed, failed" - checkName: Check - 1 - filePath: files/A.png - branch: onebranch - """ - - When I create "1" tests with params: - """ - appName: Integration Test App - testName: "Created three: new, passed, failed" - checkName: Check - 1 - filePath: files/B.png - branch: onebranch - """ - When I open the app - When I wait and refresh page on element "span=Created three: new, passed, failed - 1" for "3" seconds to exist - Then I expect that 1th test "Created three: new, passed, failed - 1" has "Failed" status - Then I expect that 2th test "Created three: new, passed, failed - 1" has "Passed" status - Then I expect that 3th test "Created three: new, passed, failed - 1" has "New" status - - @smoke - Scenario: VRS create two checks - [new, failed (not_accepted, different_images), accept, passed] - Given I set window size: "1366x768" - When I create "2" tests with params: - """ - appName: Integration Test App - testName: "Created two: new, failed (not_accepted, different_images), accept, passed" - checkName: Check - 1 - filePath: files/A.png - branch: onebranch - """ - When I open the app - When I wait and refresh page on element "span=Created two: new, failed (not_accepted, different_images), accept, passed - 1" for "3" seconds to exist - Then I expect that 1th test "Created two: new, failed (not_accepted, different_images), accept, passed - 2" has "Failed" status - Then I expect that 1th test "Created two: new, failed (not_accepted, different_images), accept, passed - 1" has "New" status - - When I click on "Created two: new, failed (not_accepted, different_images), accept, passed - 2" VRS test - Then I expect that VRS test "Created two: new, failed (not_accepted, different_images), accept, passed - 2" is unfolded - Then I expect that VRS check "1/1 Check - 1" has "Failed" status - Then I expect the "1/1 Check - 1" check has "not accept" acceptance status - When I open "Check - 1" view - Then the element "#not-accepted-checks-char" contains the text "×" - Then the element "//div[contains(text(), 'failReasons')]/../div[2]" contains the text "not_accepted" - - When I accept via http the 2st check with name "Check - 1" - When I create "1" tests with params: - """ - appName: Integration Test App - testName: "Created two: new, failed (not_accepted, different_images), accept, passed" - checkName: Check - 1 - filePath: files/A.png - branch: onebranch - """ - When I open the app - When I wait for "2" seconds - Then I expect that 1th test "Created two: new, failed (not_accepted, different_images), accept, passed - 1" has "Passed" status - When I click on "Created two: new, failed (not_accepted, different_images), accept, passed - 1" VRS test - Then I expect that VRS test "Created two: new, failed (not_accepted, different_images), accept, passed - 1" is unfolded - Then I expect that VRS check "1/1 Check - 1" has "Passed" status - Then I expect the "1/1 Check - 1" check has "previously accept" acceptance status - - diff --git a/tests/features/checks/multi_check.feature b/tests/features/checks/multi_check.feature deleted file mode 100644 index f1f60790..00000000 --- a/tests/features/checks/multi_check.feature +++ /dev/null @@ -1,149 +0,0 @@ -@integration -Feature: Few Checks into the same Test - - Background: - Given I clear Database and stop Server - Given I start Server and start Driver - - Scenario: Tho checks with different images [new, new] - When I create "1" tests with: - """ - testName: "Test" - checks: - - filePath: files/A.png - checkName: Check - 1 - - filePath: files/B.png - checkName: Check - 2 - """ - - When I expect via http 1st test filtered as "name=Test" matched: - """ - markedAs: Unaccepted - status: New - """ - When I expect via http 1st check filtered as "name=Check - 1" matched: - """ - status: [new] - """ - When I expect via http 1st check filtered as "name=Check - 2" matched: - """ - status: [new] - """ - - Scenario: Tho checks with different images [new, new, -> new, passed] - When I create "1" tests with: - """ - testName: "Test" - checks: - - filePath: files/A.png - checkName: Check - 1 - - filePath: files/B.png - checkName: Check - 2 - """ - When I accept via http the 1st check with name "Check - 1" - When I create "1" tests with: - """ - testName: "Test" - checks: - - filePath: files/A.png - checkName: Check - 1 - """ - When I expect via http 2st test filtered as "name=Test" matched: - """ - markedAs: Accepted - status: Passed - """ - When I expect via http 2st check filtered as "name=Check - 1" matched: - """ - status: [passed] - """ - When I expect via http 1st check filtered as "name=Check - 2" matched: - """ - status: [new] - """ - - Scenario: Tho checks with different images [new, new, -> passed, passed] - When I create "1" tests with: - """ - testName: "Test" - checks: - - filePath: files/A.png - checkName: Check - 1 - - filePath: files/B.png - checkName: Check - 2 - """ - When I accept via http the 1st check with name "Check - 1" - When I accept via http the 1st check with name "Check - 2" - When I create "1" tests with: - """ - testName: "Test" - checks: - - filePath: files/A.png - checkName: Check - 1 - - filePath: files/B.png - checkName: Check - 2 - """ - When I expect via http 2st test filtered as "name=Test" matched: - """ - markedAs: Accepted - status: Passed - """ - When I expect via http 1st test filtered as "name=Test" matched: - """ - markedAs: Accepted - status: New - """ - - When I expect via http 2st check filtered as "name=Check - 1" matched: - """ - markedAs: accepted - status: [passed] - """ - When I expect via http 2st check filtered as "name=Check - 2" matched: - """ - markedAs: accepted - status: [passed] - """ - - Scenario: Tho checks with different images [new, new, -> failed, failed] - When I create "1" tests with: - """ - testName: "Test" - checks: - - filePath: files/A.png - checkName: Check - 1 - - filePath: files/A.png - checkName: Check - 2 - """ - When I accept via http the 1st check with name "Check - 1" - When I accept via http the 1st check with name "Check - 2" - When I create "1" tests with: - """ - testName: "Test" - checks: - - filePath: files/B.png - checkName: Check - 1 - - filePath: files/B.png - checkName: Check - 2 - """ - When I expect via http 2st test filtered as "name=Test" matched: - """ - markedAs: Accepted - status: Failed - """ - When I expect via http 1st test filtered as "name=Test" matched: - """ - markedAs: Accepted - status: New - """ - - When I expect via http 2st check filtered as "name=Check - 1" matched: - """ - markedAs: accepted - status: [failed] - """ - When I expect via http 2st check filtered as "name=Check - 2" matched: - """ - markedAs: accepted - status: [failed] - """ diff --git a/tests/features/checks/remove_check.feature b/tests/features/checks/remove_check.feature deleted file mode 100644 index d0b77035..00000000 --- a/tests/features/checks/remove_check.feature +++ /dev/null @@ -1,216 +0,0 @@ -@integration -Feature: Baseline - Remove checks - - Background: - Given I clear Database and stop Server - When I set env variables: - """ - SYNGRISI_TEST_MODE: 1 - SYNGRISI_AUTH: 0 - """ - Given I start Server - When I create via http test user - - Given I stop the Syngrisi server - When I set env variables: - """ - SYNGRISI_TEST_MODE: 0 - SYNGRISI_AUTH: 1 - """ - Given I start Server and start Driver - - # create user - When I login via http with user:"Test" password "123" - When I create via http user as:"Test" with params: - """ - { - "username": "j_doe@gmail.com", - "firstName": "John", - "lastName": "Doe", - "role": "user", - "password": "Password-123" - } - """ - When I login via http with user:"j_doe@gmail.com" password "Password-123" - When I generate via http API key for the User - When I set the API key in config - - @e2e - Scenario: Remove Checks, [unaccepted] - # create check - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - """ - # check baseline without acceptance - When I parse via http "actual" snapshot for 1st check with name "Check - 1" - Then I expect exact "1" snapshot files - - # delete single check - When I login with user:"j_doe@gmail.com" password "Password-123" - When I wait for "2" seconds - - When I click on "Baseline Base Flow - 1" VRS test - When I wait for "2" seconds - Then I expect that VRS test "Baseline Base Flow - 1" is unfolded - When I click on the element "a.remove-button" - When I click on the element "a.remove-option" - When I wait for "3" seconds - - Then I expect that element "span=Check - 1" does not exist - Then I expect that element "span=Baseline Base Flow - 1" does not exist - - Then I expect via http that "Check - 1" check exist exactly "0" times - Then I expect via http that "Baseline Base Flow - 1" test exist exactly "1" times - Then I expect exact "0" snapshot files - Then I expect via http 0 baselines - - Scenario: Remove Checks, [accepted] - # create check - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - """ - When I login via http with user:"Test" password "123" - When I accept via http the 1st check with name "Check - 1" - - When I wait for "2" seconds - - # delete 1 check - When I remove via http 1st check with name "Check - 1" - Then I expect via http 1 baselines - Then I expect exact "1" snapshot files - - Scenario: Remove Checks, [unaccepted, unaccepted] - # create check - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - """ - - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - """ - When I wait for "2" seconds - - # delete 1 check - When I remove via http 1st check with name "Check - 1" - Then I expect via http 0 baselines - Then I expect exact "1" snapshot files - - # delete 2 check - When I remove via http 1st check with name "Check - 1" - Then I expect via http 0 baselines - Then I expect exact "0" snapshot files - - Scenario: Remove Checks, [unaccepted, accepted] - # create check - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - """ - - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - """ - # accept 2nd check, check baselines - When I accept via http the 1st check with name "Check - 1" - When I expect via http 1st check filtered as "name=Check - 1" matched: - """ - markedAs: accepted - """ - # delete 1 check - When I remove via http 1st check with name "Check - 1" - Then I expect via http 1 baselines - Then I expect exact "1" snapshot files - - # delete 2 check - When I remove via http 1st check with name "Check - 1" - Then I expect via http 1 baselines - Then I expect exact "1" snapshot files - - Scenario: Remove Checks, [accepted, accepted] - # create check - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - """ - When I accept via http the 1st check with name "Check - 1" - Then I expect via http 1 baselines - - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - """ - When I accept via http the 2st check with name "Check - 1" - Then I expect via http 2 baselines - - Then I expect via http 1st check filtered as "name=Check - 1" matched: - """ - markedAs: accepted - """ - Then I expect via http 2st check filtered as "name=Check - 1" matched: - """ - markedAs: accepted - """ - - # delete 1 check - When I remove via http 1st check with name "Check - 1" - Then I expect via http 2 baselines - Then I expect exact "1" snapshot files - - # delete 2 check - When I remove via http 1st check with name "Check - 1" - Then I expect via http 2 baselines - Then I expect exact "1" snapshot files - - Scenario: Remove Checks, [accepted, failed] - # create check - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - filePath: files/A.png - """ - When I accept via http the 1st check with name "Check - 1" - Then I expect via http 1 baselines - - When I create "1" tests with params: - """ - testName: Baseline Base Flow - checkName: Check - 1 - filePath: files/B.png - """ - Then I expect via http 1 baselines - - Then I expect via http 1st check filtered as "name=Check - 1" matched: - """ - status: [new] - markedAs: accepted - """ - - Then I expect via http 2st check filtered as "name=Check - 1" matched: - """ - status: [failed] - markedAs: accepted - """ - - # delete failed - When I remove via http 2st check with name "Check - 1" - Then I expect via http 1 baselines - Then I expect exact "1" snapshot files - - # delete new - When I remove via http 1st check with name "Check - 1" - Then I expect via http 1 baselines - Then I expect exact "1" snapshot files diff --git a/tests/features/checkview/resize.feature b/tests/features/checkview/resize.feature deleted file mode 100644 index 7b52984e..00000000 --- a/tests/features/checkview/resize.feature +++ /dev/null @@ -1,265 +0,0 @@ -Feature: Resize checkview - - Background: - Given I clear Database and stop Server - Given I start Server and start Driver - - Scenario: High Image - resize by width and height [image height > canvas height, image height / canvas height < 10] - ...┌──────────────┬─────┐ - ...│ │xxxxx│ - ...│ │xxxxx│ - ...│ │xxxxx│ - ...│ │xxxxx│ - ...│ │xxxxx│ - ...├──────────────┘xxxxx│ - ...│xxxxxxxxxxxxxxxxxxxx│ - ...│xxxxxxxxxxxxxxxxxxxx│ - ...└────────────────────┘ - Given I set window size: "1366x768" - When I create "1" tests with params: - """ - testName: "Test - High" - checkName: Check - High - filePath: files/high_image.png - """ - - When I accept via http the 1st check with name "Check - High" - When I create "1" tests with params: - """ - testName: "Test - High" - checkName: Check - High - filePath: files/high_image_broken.png - """ - - When I open the app - When I wait and refresh page on element "span=Test - High - 1" for "5" seconds to exist - When I click on "Test - High - 1" VRS test - When I wait for "2" seconds - When I open "Check - High" view - When I wait for "2" seconds - When I execute javascript code: - """ - return (parseInt(mainView.image.getScaledWidth()) === 397 // for headless mode - || parseInt(mainView.image.getScaledWidth()) === 328).toString() - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - true - """ - - When I click on the element "#toggle-actual-baseline" - When I wait for "2" seconds - When I execute javascript code: - """ - return (parseInt(mainView.actualImage.getScaledWidth()) === 397 // for headless mode - || parseInt(mainView.actualImage.getScaledWidth()) === 328).toString() - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - true - """ - - When I click on the element "#diff-wrapper" - When I wait for "2" seconds - When I execute javascript code: - """ - return (parseInt(mainView.diffImage.getScaledWidth()) === 397 // for headless mode - || parseInt(mainView.diffImage.getScaledWidth()) === 328).toString() - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - true - """ - - When I click on the element "#toggle-side" - When I wait for "2" seconds - When I execute javascript code: - """ - return (parseInt(mainView.sideToSideView.baselineImg.getScaledWidth()) === 397 // for headless mode - || parseInt(mainView.sideToSideView.baselineImg.getScaledWidth()) === 328).toString() - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - true - """ - - Scenario: Extra High Image - resize only by width [image height > canvas height, image height / canvas height > 10] - ...┌──────────────┬──┐ - ...│ │xx│ - ...│ │xx│ - ...│ │xx│ - ...│ │xx│ - ...│ │xx│ - ...│ │xx│ - ...├──────────────┘xx│ - ...│xxxxxxxxxxxxxxxxx│ - ...│xxxxxxxxxxxxxxxxx│ - ...│xxxxxxxxxxxxxxxxx│ - ...│xxxxxxxxxxxxxxxxx│ - ...│xxxxxxxxxxxxxxxxx│ - ...│xxxxxxxxxxxxxxxxx│ - ...│xxxxxxxxxxxxxxxxx│ - ...│xxxxxxxxxxxxxxxxx│ - ...└─────────────────┘ - Given I set window size: "1366x768" - When I create "1" tests with params: - """ - testName: "Test - Extra High" - checkName: Check - Extra High - filePath: files/extra_heigh_image.png - """ - When I open the app - When I wait and refresh page on element "span=Test - Extra High - 1" for "5" seconds to exist - When I click on "Test - Extra High - 1" VRS test - When I wait for "2" seconds - When I open "Check - Extra High" view - When I wait for "2" seconds - When I execute javascript code: - """ - return (parseInt(mainView.image.getScaledWidth()) === 1008 // for headless mode - || parseInt(mainView.image.getScaledWidth()) === 1008).toString() - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - true - """ - - Scenario: Low High Image with normal width - no resize [image width < canvas width] - ...┌──────────────┐ - ...│ │ - ...│ ┌───────┐ │ - ...│ │xxxxxxx│ │ - ...│ └───────┘ │ - ...│ │ - ...│ │ - ...└──────────────┘ - Given I set window size: "1366x768" - When I create "1" tests with params: - """ - testName: "Test - Low High" - checkName: Check - Low High - filePath: files/low_high_image_with_normal_width.png - """ - When I open the app - When I wait and refresh page on element "span=Test - Low High - 1" for "5" seconds to exist - When I click on "Test - Low High - 1" VRS test - When I wait for "2" seconds - When I open "Check - Low High" view - When I wait for "2" seconds - When I execute javascript code: - """ - return (parseInt(mainView.image.getScaledWidth()) === parseInt(mainView.image.width)).toString() - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - true - """ - - Scenario: Low High Image with wide width - resize by width [image width > canvas width] - ...┌──────────────┐ - ...│ │ - ...│ ┌────────────┴─────┐ - ...│ │xxxxxxxxxxxxxxxxxx│ - ...│ └────────────┬─────┘ - ...│ │ - ...│ │ - ...└──────────────┘ - Given I set window size: "1366x768" - # 3524 x 114 - When I create "1" tests with params: - """ - testName: "Test - Low High Wide" - checkName: Check - Low High Wide - filePath: files/low_high_mage_with_wide_width.png - """ - When I open the app - When I wait and refresh page on element "span=Test - Low High Wide - 1" for "5" seconds to exist - When I click on "Test - Low High Wide - 1" VRS test - When I wait for "2" seconds - When I open "Check - Low High Wide" view - When I wait for "2" seconds - When I execute javascript code: - """ - return (parseInt(mainView.image.getScaledWidth()) === 1008 // for headless mode - || parseInt(mainView.image.getScaledWidth()) === 1008).toString() - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - true - """ - - Scenario: Extra Low High Image - resize height 2 times [image height < 50px] - ...┌──────────────┐ - ...│ │ - ...│ ┌─┐ │ - ...│ │x│ │ - ...│ └─┘ │ - ...│ │ - ...│ │ - ...└──────────────┘ - Given I set window size: "1366x768" - # 160 x 48 - When I create "1" tests with params: - """ - testName: "Test - Extra Low High" - checkName: Check - Extra Low High - filePath: files/extra_low_high_image.png - """ - When I open the app - When I wait and refresh page on element "span=Test - Extra Low High - 1" for "5" seconds to exist - When I click on "Test - Extra Low High - 1" VRS test - When I wait for "2" seconds - When I open "Check - Extra Low High" view - When I wait for "2" seconds - When I execute javascript code: - """ - return parseInt(mainView.image.getScaledHeight()).toString() // for headless mode - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - 96 - """ - - Scenario: Extra Low High Image with wide width - resize by width [image width > canvas width, image height < 50px] - ...┌──────────────┐ - ...│ │ - ...│ ┌────────────┴──────┐ - ...│ │xxxxxxxxxxxxxxxxxxx│ - ...│ └────────────┬──────┘ - ...│ │ - ...│ │ - ...└──────────────┘ - Given I set window size: "1366x768" - # 3564 x 48 - When I create "1" tests with params: - """ - testName: "Test - Extra Low High Wide" - checkName: Check - Extra Low High Wide - filePath: files/extra_low_high_image_with_wide_width.png - """ - When I open the app - When I wait and refresh page on element "span=Test - Extra Low High Wide - 1" for "5" seconds to exist - When I click on "Test - Extra Low High Wide - 1" VRS test - When I wait for "2" seconds - When I open "Check - Extra Low High Wide" view - When I wait for "2" seconds - When I execute javascript code: - """ - return (parseInt(mainView.image.getScaledWidth()) === 1008 // for headless mode - || parseInt(mainView.image.getScaledWidth()) === 1008).toString() - """ - When I wait for "1" seconds - Then I expect the stored "js" string is equal: - """ - true - """ - -