Reading Kendo UI Grid Row Color in TestStudio

4 posts, 0 answers
  1. VVP
    VVP avatar
    61 posts
    Member since:
    Mar 2015

    Posted 18 May 2015 Link to this post

    Hi,

     

    In the application i am testing, there is a Kendo UI grid Row which is highlighted in Red color when some the data entered is not correct.

    Can we validate the row color in Test Studio?

    In the verification section(Telerik Recorder UI) for that row, I saw "kendo-grid-tt-custom-error k-state-border-down". How ever i am not sure if this is the only info that will be displayed.

     Kindly let me know.

     

    Thanks,

    VVP

  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 19 May 2015 Link to this post

    Hi Vishnu,

    Not directly. Test Studio cannot directly test the exact color of any random text on the screen. It can however test what value is set for a property, including properties set via CSS. For example, assume you have HTML like this:
    <p><font color="red">This is some text!</font></p>
    <p><font color="blue">This is some text!</font></p>

    Test Studio can easily verify that the "color" attribute has the value "red" or "blue". As far as Test Studio is concerned "color" is just another named attribute. To Test Studio there's nothing special about the word "color" other than it's the name of an attribute for it to perform a verification of the value of.

    You can also use a coded step to validate the CSS computed color like this:
    Assert.AreEqual<string>("Red", Pages.ASPNETTreeViewExample.ContentPlaceHolder1RadTreeView1Div.GetComputedStyleValue("Color"));

    I hope this helps point you in the right direction.

    Regards,
    Cody
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. VVP
    VVP avatar
    61 posts
    Member since:
    Mar 2015

    Posted 25 May 2015 in reply to Cody Link to this post

    Unforutantely that is not working. I am getting. rgb(0, 63, 89) for all cells.

     Is there any way to check whether a Kendo grid cell is editable or not? I tried Isenabled. But it is always returning true.

  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 26 May 2015 Link to this post

    Hello Vishnu,

    Another possibility is you need to get the background-color attribute. You should use this when you what the color shading of a UI element or cell. Use "color" when you want to get at the color of the text itself.

    You can always use an rgb string as the expected value in the assert:
    Assert.AreEqual<string>("rgb(0, 63, 89)", Pages.ASPNETTreeViewExample.ContentPlaceHolder1RadTreeView1Div.GetComputedStyleValue("Color"));

    To figure out why it's not working as expected I would need to have a first hand look at your application.

    Is there any way to check whether a Kendo grid cell is editable or not? I tried Isenabled. But it is always returning true.

    Why do you care? Normally you would just let the test script enter the values needed for the business logic and not worry about testing whether the cell is in edit mode or not.

    Anyway, how this is accomplished depends on whether row editing mode is used or cell editing mode is used. You will have to write a line or two of code and test whether or not the right attribute is applied to the right UI element as shown in the attached screen shots.


    Regards,
    Cody
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!