Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable screenshot functionality (closes #104) #130

Conversation

AlexanderMoskovkin
Copy link
Contributor

We have client tests for this and server tests for reporting with screenshots now. Also I've created the functional tests locally, but we will commit them when we implement the #52 issue, because we need something like functional-tests-harness

/cc @inikulin @helen-dikareva

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit ca708d3 have failed. See details.

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit ca708d3 have passed. See details.

@helen-dikareva
Copy link
Collaborator

What about steps with empty test names? For all of them will be saved pageLoad.png

@@ -41,6 +41,7 @@
testCafeCore.SETTINGS.set({
CURRENT_TEST_STEP_NAME: nextStep ? stepNames[nextStep - 1] : 'Test initialization',
BROWSER_STATUS_URL: '{{{browserStatusUrl}}}',
ENABLE_SCREENSHOTS: {{{enableScreenshots}}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like enableScreenshots, maybe takeScreenshots? \cc @VasilyStrelyaev

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

@inikulin
Copy link
Contributor

BTW, I don't see code which attaches screenshot path on errors. And we need to add both types of screenshots in report-design-viewer (we need to figure out coloring for them as well).

@inikulin
Copy link
Contributor

\r-

@AlexanderMoskovkin
Copy link
Contributor Author

BTW, I don't see code which attaches screenshot path on errors.

If we implement this behavior we need not any sprecific code which attaches screenshot path on errors. We set the screenshotCreated (hasScreenshots) flag when any screenshot created (on the screenshot action or on an error)

@inikulin
Copy link
Contributor

@AlexanderMoskovkin We've discussed what if there were an error, then screenshot should be attached to the error text: #104 (comment)

So the report should look like this:

Running tests in: Chrome, Firefox

  fixture1 (./fixture1.js)
    ✓ fixture1test1 (unstable) (screenshots: D:\screenshots\1445437598847)
    ✖ fixture1test2 (screenshots: D:\screenshots\144543754328847)

        1) Chrome
           Assertion failed at step "Step":

               eq(["12345678901"], ["00000000000"])

           Arrays differ at index 0:

           Expected: [0]: "12345678901"
           Actual:   [0]: "00000000000"
                           ^

           Screenshot: D:\screenshots\144543754328847\errors\1.png


        2) Chrome
           Assertion failed at step "Step":

               notEq("test", "test")

           Expected: not "test"
           Actual:   "test"

           Screenshot: D:\screenshots\144543754328847\errors\2.png

        3) Firefox
           Assertion failed at step "Step":

               ok(false)

           Expected: not null, not undefined, not false, not NaN and not
           ''
           Actual:   false

           Screenshot: D:\screenshots\144543754328847\errors\3.png

    ✓ fixture1test3

  fixture2 (./fixture2.js)
    ✓ fixture2test1 (screenshots: D:\screenshots\4345437598847)
    ✓ fixture2test2 (screenshots: D:\screenshots\6545437598847)


  2/6 failed (15m 25s)

Sorry, seems like I was not quite clear in our discussion.

@AlexanderMoskovkin
Copy link
Contributor Author

ok

@AlexanderMoskovkin
Copy link
Contributor Author

What about steps with empty test names? For all of them will be saved pageLoad.png

I suppose, we should save the image as Step <num>.png in this case, for example Step 3.png.
Do step names should start from Step 0 or Step 1?
/cc @inikulin @VasilyStrelyaev

@inikulin
Copy link
Contributor

@AlexanderMoskovkin AFAIK you can't create step without a name in current API. Unnamed steps are subject of the new API and we will have a lot of other things to redo because of this. So, I think we shouldn't bother right now.

@AlexanderMoskovkin
Copy link
Contributor Author

I've checked it works with empty step names now. For example if an assertion failed in this step we see in the report Assertion failed at step "". But I think we can skip it now because we will implement the new API

@AlexanderMoskovkin
Copy link
Contributor Author

/cc @inikulin @VasilyStrelyaev
I've tried some colors for screenshot paths in reports, what do you think? I suppose, we should use a neutral color because it's just an info and we should not use such colors as red(error), yellow(warning), green(success). Screens from Windows:
1
2
3

@VasilyStrelyaev
Copy link
Collaborator

yellow is not too much of warning
it's rather highlighting - we use it to mark inline code and so on
I'd go for yellow or no accent (the third screenshot)

@AlexanderMoskovkin
Copy link
Contributor Author

Yellow:
4

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit 9d3f6eb have passed. See details.

@AlexanderMoskovkin
Copy link
Contributor Author

FPR
/cc @inikulin @helen-dikareva
@VasilyStrelyaev please check the comment here

Current reporting:
final_win
final_mac

`${this.screenshotPath}\\${isFailedStep ? 'errors\\' : ''}${stepName.replace(/\s/g, '_') ||
'Page_Load'}.png`;

//NOTE: we should not fail the test if we can't make a screenshot for some reason
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test should not fail if we can't make a screenshot for some reason

@VasilyStrelyaev
Copy link
Collaborator

/r-

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit c804a48 have passed. See details.

@VasilyStrelyaev
Copy link
Collaborator

lgtm

@AlexanderMoskovkin
Copy link
Contributor Author

FPR

@@ -13,26 +16,23 @@ export var batchUpdate = transport.batchUpdate.bind(transpor
export var queuedAsyncServiceMsg = transport.queuedAsyncServiceMsg.bind(transport);

export function fail (err, callback) {
// NOTE: we should not stop the test run if an error occured during page unloading because
// we destroy the session in this case and we can't get the next page in the browser.
// We should set the deferred error to the task to fail the test after the page reloading.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    // NOTE: we should not stop the test run if an error occured during page unloading because
    // we would destroy the session in this case and wouldn't be able to get the next page in the browser.
    // We should set the deferred error to the task to have the test failed after the page reloading.

@VasilyStrelyaev
Copy link
Collaborator

/r-

@AlexanderMoskovkin AlexanderMoskovkin force-pushed the enable-screenshots-functionality branch 2 times, most recently from 790d080 to b0108e1 Compare November 16, 2015 08:39
@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit b0108e1 have passed. See details.

export function fatalError (err, callback) {
// NOTE: we should not stop the test run if an error occured during page unloading because we
// would destroy the session in this case and wouldn't be able to get the next page in the browser.
// We should set the deferred error to the task to have the test failed after the page reloading.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sht... sorry, my mistake - have the test fail

    // We should set the deferred error to the task to have the test fail after the page reloading.

@VasilyStrelyaev
Copy link
Collaborator

/r-

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit bee81e7 have passed. See details.

@VasilyStrelyaev
Copy link
Collaborator

lgtm

@AlexanderMoskovkin
Copy link
Contributor Author

FPR

@inikulin
Copy link
Contributor

lgtm

@inikulin
Copy link
Contributor

ping @helen-dikareva

this.savedDocumentTitle = document.title;
document.title = assignedTitle;
}
}, 50);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move it to const

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@helen-dikareva
Copy link
Collaborator

\r-

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit 1768a35 have passed. See details.

@AlexanderMoskovkin
Copy link
Contributor Author

FPR

@inikulin
Copy link
Contributor

lgtm

1 similar comment
@helen-dikareva
Copy link
Collaborator

lgtm

helen-dikareva added a commit that referenced this pull request Nov 17, 2015
…nctionality

Enable screenshot functionality (closes #104)
@helen-dikareva helen-dikareva merged commit 92f91cf into DevExpress:master Nov 17, 2015
@AlexanderMoskovkin
Copy link
Contributor Author

thanks

@AlexanderMoskovkin AlexanderMoskovkin deleted the enable-screenshots-functionality branch November 17, 2015 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants