Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    mendhak
    @mendhak

    @vptes1 Is the documentation (smashtest.io) available for contribution? I'm sure there are some of us that would like to create pull requests to help bolster the documentation.

    +1 to this . It would be good to contribute to the documentation with more examples. @vptes1 Maybe you could transfer the pages to a Github repo? Github allows custom domains so smashtest.io can point at your repo and we just do PRs against it.

    ijazdar
    @ijazdar:matrix.org
    [m]
    Hi,
    I'm trying to find the element through this example but facing this error "rror: Element not found in time (2 s): ". Any one please tell me how can i use it in my code for smashtest automation ?
    ijazdar
    @ijazdar:matrix.org
    [m]
    This code is opened in console once i clicks on the drop down, anyone please help me to get element from this example?. Thanks
    slowmonkey
    @slowmonkey
    Hi @ijazdar:matrix.org , can you show your smashtest code please. Is the ConsoleExample_Code.png the html you're trying to find?
    ijazdar
    @ijazdar:matrix.org
    [m]
    slowmonkey (slowmonkey):
    Here's the smashtest code which i'm trying for the shared example
    click '#Testing option[value="mytest"]'
    slowmonkey
    @slowmonkey

    @ijazdar:matrix.org
    Is there a report.html generated? or do you have this test sample in a github repo?
    A good way to find out if it's working for me is.

    1. Use a browser in developer mode and find the element via the css selector you're specifying.
    2. Another thing to check is in the report.html if you've got screenshots on you can check for that step if the page is fully loaded before the step is executed. That way you can see that it's got something to find. If it's timing out that can be a reason why because the page isn't loaded and it's timed out trying to find a non-existing element.

    From what I can see of your images should it not be

    click '#Testing option[value="MT"]'

    ijazdar
    @ijazdar:matrix.org
    [m]

    @slowmonkey:
    Appreciated for your help.

    Please see the below code and UI for the shared query. I'm trying to select the language "Deutsch" from the "Change language" drop but receiving an error "Error: Element not found in time (2 s)". I've also checked there's no any timeout error before my last line against which element isn't found. Could you please check and shared your thoughts to fix this issue.

    Thanks

    Open Chrome

    Navigate to 'https://developer.mozilla.org/en-US/docs/Tools/'
        [
            // Wait 5 secs to load the page
            Wait '10' secs
                Click ['Change language']
                    Click '#language-selector option[value="de"]'
        ]
    ijazdar
    @ijazdar:matrix.org
    [m]

    :point_up: Edit: slowmonkey (slowmonkey):
    Appreciated for your help.

    Please see the below code and UI for the shared query. I'm trying to select the language "Deutsch" from the "Change language" drop but receiving an error "Error: Element not found in time (2 s)". I've also checked there's no any timeout error before my last line against which element isn't found. Could you please check and shared your thoughts to fix this issue.

    Thanks

    Open Chrome

    Navigate to 'https://developer.mozilla.org/en-US/docs/Tools/'
        [
            // Wait 5 secs to load the page
            Wait '5' secs
                Click ['Change language']
                    Click '#language-selector option[value="de"]'
        ]

    :point_up: Edit: slowmonkey (slowmonkey):
    Appreciated for your help.

    Please see the below code and UI for the shared query. I'm trying to select the language "Deutsch" from the "Change language" dropdown but receiving an error "Error: Element not found in time (2 s)". I've also checked there's no any timeout error before my last line against which element isn't found. Could you please check and shared your thoughts to fix this issue.

    Thanks

    Open Chrome

    Navigate to 'https://developer.mozilla.org/en-US/docs/Tools/'
        [
            // Wait 5 secs to load the page
            Wait '5' secs
                Click ['Change language']
                    Click '#language-selector option[value="de"]'
        ]

    :point_up: Edit: slowmonkey (slowmonkey):
    Appreciated for your help.

    Please see the below code and UI for the shared query. I'm trying to select the language "Deutsch" from the "Change language" dropdown but receiving an error "Error: Element not found in time (2 s)". I've also checked there's no any timeout error before my last line against which element isn't found. Could you please check and shared your thoughts to fix this issue.

    Thanks

    Open Chrome
    Navigate to 'https://developer.mozilla.org/en-US/docs/Tools/'
    [
    // Wait 5 secs to load the page
    Wait '5' secs
    Click ['Change language']
    Click '#language-selector option[value="de"]'
    ]
    ```

    :point_up: Edit: slowmonkey (slowmonkey):
    Appreciated for your help.

    Please see the below code and UI for the shared query. I'm trying to select the language "Deutsch" from the "Change language" dropdown but receiving an error "Error: Element not found in time (2 s)". I've also checked there's no any timeout error before my last line against which element isn't found. Could you please check and shared your thoughts to fix this issue.

    Thanks

    Open Chrome
    Navigate to 'https://developer.mozilla.org/en-US/docs/Tools/'
    [
    // Wait 5 secs to load the page
    Wait '5' secs
    Click ['Change language']
    Click '#language-selector option[value="de"]'
    ]

    :point_up: Edit: slowmonkey (slowmonkey):
    Appreciated for your help.

    Please see the below code and UI for the shared query. I'm trying to select the language "Deutsch" from the "Change language" dropdown but receiving an error "Error: Element not found in time (2 s)". I've also checked there's no any timeout error before my last line against which element isn't found. Could you please check and shared your thoughts to fix this issue. Thanks

    Open Chrome
    Navigate to 'https://developer.mozilla.org/en-US/docs/Tools/'
    [
    // Wait 5 secs to load the page
    Wait '5' secs
    Click ['Change language']
    Click '#language-selector option[value="de"]'
    ]

    slowmonkey
    @slowmonkey

    Woah your reply styling has gone crazy.

    I haven't found how to solve this issue but I have found the problem.
    You're using Chrome and the css selector you're using doesn't seem to work on Chrome.
    I tried it with Firefox and that works.
    I know you're following mendhak's tutorial. Mendhak's tutorial is using Firefox which is why that works there.

    I'll try investigate further as to why Chrome is being silly here.
    But that's why it's not working for you.

    Additionally here are some other tips:

    1. You don't need the [ and ] surrounding the Wait and Click steps. The [ and ] should be used as part of the Click Steps
    2. Putting a specific wait for a page to load will make your tests run a lot longer than you want it to. If you've got 100+ tests with a 5s wait your whole test stack will take 500s minimum. I prefer to use Wait Until '#language-selector' is visible. See here https://smashtest.io/ui-testing/verify-steps. This way it waits only as long as the page has not loaded and no longer.

    Hope that helps.

    slowmonkey
    @slowmonkey

    Ok. I've got a solution.

    In this page: https://smashtest.io/ui-testing/browser-steps

    It states you can also select drop down values like so:

    Select element '<option element>' from '<dropdown element>'Select element 'option[value="de"]' from '#language-selector'
    OR
    Select '<value>' from '<dropdown element>': Select 'de' from '#language-selector'

    However only this method seems to work in Chrome: Select 'de' from '#language-selector'

    Here's the code you should have:
    Open Chrome
    
        Navigate to 'https://developer.mozilla.org/en-US/docs/Tools/'
    
            Wait until '#language-selector' is visible
    
                Click ['Change language']
    
                    Select 'de' from '#language-selector'
    also another best practice is to change all the css selector's to props so it reads better. It's stated in a page on smashtest web page somewhere I can't remember.
    Please note that all the different methods for selecting the drop down value listed works in Firefox.
    ijazdar
    @ijazdar:matrix.org
    [m]

    :point_up: Edit: slowmonkey (slowmonkey):
    Appreciated for your help.
    Please see the below code and UI for the shared query. I'm trying to select the language "Deutsch" from the "Change language" dropdown but receiving an error "Error: Element not found in time (2 s)". I've also checked there's no any timeout error before my last line against which element isn't found. Could you please check and shared your thoughts to fix this issue. Thanks

    Open Chrome
    Navigate to 'https://developer.mozilla.org/en-US/docs/Tools/'
    [
    // Wait 5 secs to load the page
    Wait '5' secs
    Click ['Change language']
    Click '#language-selector option[value="de"]'
    ]

    ijazdar
    @ijazdar:matrix.org
    [m]
    @slowmonkey:
    Thank you so much for helping to resole the issue. And for sharing some more learning examples of code. 👍️
    ijazdar
    @ijazdar:matrix.org
    [m]
    slowmonkey (slowmonkey):
    Could you please tell me how can we run multiple .smash files ? and share some reference. Thanks
    slowmonkey
    @slowmonkey

    @ijazdar:matrix.org Can you give me scenarios for what you want to do? I'm not sure what you are asking.

    Are you asking if you can run multiple starting files? So multiple files with Open Chrome?

    As far as I'm aware you can only have one main file. From there you have to call out to other test scenarios or journeys as I like to call it.
    I can't test this for you at the moment as my machine just died yesterday.

    However the way I structure things is something like this.

    I have a main.smash so it's easily identifiable where the starting file is.

    From there the main.smash will call out to other tests.

    # main.smash
    Open Chrome
    
        Method to run smoke tests on this line
    
        Method to run regression tests on this line
    
        Method to run other types of tests on this line

    With this method you can call out to different types of tests. Then you can use the filtering options to call the required tests from the command line if you don't want all of them to work. Smashtest lingo calls this groups. Read it up here and try it out. It doesn't quite work the way you expect. https://smashtest.io/running-tests/selective-test-running. I think the main caveat is it will only read the top most group tag you place and no the ones you place in the underlying branches.

    The main thing about all this is the structuring of the smash test files. It's annoying to have it all in one directory so you will inevitably what it in sub directories but it's annoying to list out every file to load. So you can use the --recursive flag in the command line or add it to your smashtest.json. See https://smashtest.io/running-tests for the documentation. For a list of translated command line options and how to add it to your smashtest.json see this post I wrote: https://slowmonkey.github.io/smashtest-cli-json-mapping

    Hope that helps

    ijazdar
    @ijazdar:matrix.org
    [m]

    slowmonkey (slowmonkey):
    Could you please tell me how to get child element(Value) of a parent element in smashtest?
    I want to verify that "Pakistan" location text on the map is visible or exact value with the given text

    Example :

    <div class="Myclass">
    <div style="padding:15px">Paskistan</div>

    11 replies
    ijazdar
    @ijazdar:matrix.org
    [m]
    That correct. It has only one child.
    ijazdar
    @ijazdar:matrix.org
    [m]

    slowmonkey (slowmonkey):

    What if this text "Pakistan" have value like "Pakistan-Punjab, Lahore". Then how can i verify it because in that case receiving the error. " Error: Element not found in time (2 s)"

    Example of code:

    Open Chrome

    Desktop
    
        Maximize window
    
            Navigate to 'url'
    
                on homepage {
                    props({
                        'Pakistan-Punjab, Lahore Text': '.Myclass > div:first-of-type, Pakistan-Punjab, Lahore'
                    });
                }
    
                    Verify 'Pakistan-Punjab, Lahore Text' is visible
    slowmonkey
    @slowmonkey

    @ijazdar:matrix.org :

    Are you sure that worked? Did you try have it select with

    'Pakistan Text': '.Myclass > div:first-of-type, Pakistan1111'

    If that works still then what I provided doesn't work.

    I'm just trying some basic tests and I can't get it working so I might have steered you wrong sorry.

    3 replies
    ijazdar
    @ijazdar:matrix.org
    [m]

    :point_up: Edit: slowmonkey (slowmonkey):

    What if this text "Pakistan" have value like "Pakistan-Punjab, Lahore". Then how can i verify it because in that case receiving the error. " Error: Element not found in time (2 s)"

    Example of code:

    Open Chrome

    Desktop
    
        Maximize window
    
            Navigate to 'url'
    
                on homepage {
                    props({
                        'Pakistan Text': '.Myclass'
                    });
                }
    
                    Verify 'Pakistan Text' is visible
    ijazdar
    @ijazdar:matrix.org
    [m]
    slowmonkey (slowmonkey):
    Could you please share some examples about the use of global variable in smashtest?
    ijazdar
    @ijazdar:matrix.org
    [m]
    :point_up: Edit: slowmonkey (slowmonkey):
    Could you please share some examples about the use of global variable in smashtest?
    Thanks
    ijazdar
    @ijazdar:matrix.org
    [m]
    :point_up: Edit: slowmonkey (slowmonkey):
    Could you please share some examples about the use of global variable in smashtest?
    I want to declare global variables for multiple environments and can use it for my test cases based on the selected.
    Thanks
    ijazdar
    @ijazdar:matrix.org
    [m]
    :point_up: Edit: slowmonkey (slowmonkey):
    Could you please share some examples about the use of global variable in smashtest?
    I want to declare global variables for multiple environments and can use it for my test cases based on the variable .
    Thanks
    ijazdar
    @ijazdar:matrix.org
    [m]

    :point_up: Edit: slowmonkey (slowmonkey):
    Is that possible to create global variable for a navigate url on smashtest?
    I want to declare global variables for multiple environments web urls in my code.

    Thanks

    ijazdar
    @ijazdar:matrix.org
    [m]

    :point_up: Edit: slowmonkey (slowmonkey):
    Is that possible to create global variable for a navigate url on smashtest?
    I want to declare global variables for multiple environments web urls in my code.

    Open Chrome
    Navigate to 'https://code.mendhak.com/smashtest-tutorial/'

    Thanks

    slowmonkey
    @slowmonkey

    @ijazdar:matrix.org

    Yes you can use global variables or you can use groups.

    To use global variables call your smashtest like so:

    ./smashtest --g:test_url=www.google.com.nz

    The code should look like this:

    Open Chrome
    
        {base_url} = 'www.google.com.au' #Australia
        {base_url} = 'www.google.com.uk' #UK
        {base_url} = 'www.google.com' #US
        {base_url} = {test_url} #Custom
    
            Navigate to '{base_url}'

    or if you don't want to do branches of different urls just this will work:

    Open Chrome
    
        Navigate to '{test_url}'

    The groups example can be used like so:

    smashtest --groups="Australia,US"

    Open Chrome
    
        {base_url} = 'www.google.com.au' #Australia
        {base_url} = 'www.google.com.uk' #UK
        {base_url} = 'www.google.com' #US
    
            Navigate to '{base_url}'

    The group will run the Australia and US branches of the tests.

    ijazdar
    @ijazdar:matrix.org
    [m]
    @slowmonkey:
    Great. Thanks for sharing examples with details.
    1 reply
    ijazdar
    @ijazdar:matrix.org
    [m]
    :point_up: Edit: slowmonkey (slowmonkey):
    I've checked your shared examples and it works fine.
    What if i've 5 branches (.smash) files which have to test on two different urls with the same code?
    I don't want to change those urls every time when needs to run branches.
    1 reply
    ijazdar
    @ijazdar:matrix.org
    [m]
    slowmonkey (slowmonkey):
    I've resolved the issue by following your shared example and fix concatenate url error.
    ./smashtest --g:test_url=www.google.com.nz
    Thanks.
    1 reply
    ijazdar
    @ijazdar:matrix.org
    [m]

    @slowmonkey:
    I've set a global variable in url and calling it through command line and it works fine. What if I don't want to given global variable in the command and want to use default url when not passing global variables.
    make sense ?

    Open Chrome

    Navigate to '{baseUrl}/{syllabus}/index.htm' #test
        [
            wait '10' secs
        ]

    Command line: npx smashtest --g:baseUrl=https://www.tutorialspoint.com --g:syllabus=cbse_syllabus --groups="test" --recursive --screenshots=true --headless=false

    1 reply
    ijazdar
    @ijazdar:matrix.org
    [m]
    @slowmonkey:
    Could you please send me examples of code which could be run on mobile ?
    7 replies
    ijazdar
    @ijazdar:matrix.org
    [m]

    @slowmonkey:
    I've a below class which takes values given by the user from the text box by app. So, is that possible can get "$1" or what's given by user by smashtest? if yes then could you please share your code of example ? thanks

    <td class="cart_price">
    "$1"

    2 replies
    ijazdar
    @ijazdar:matrix.org
    [m]
    slowmonkey (slowmonkey):
    And how can we get child elements ? like parent > child1 >child2 >child3..
    1 reply
    ijazdar
    @ijazdar:matrix.org
    [m]

    :point_up: Edit: slowmonkey (slowmonkey):
    I've a below class which takes values given by the user from the text box by app. So, is that possible can get "$1" or what's given by user ? if yes then could you please share your code of example ? thanks

    <td class="cart_price">
    "$1"

    ijazdar
    @ijazdar:matrix.org
    [m]

    :point_up: Edit: slowmonkey (slowmonkey):
    1- I've a below class which takes values given by the user from the text box by app. So, is that possible can we get value "2" or what's given by user ? if yes then could you please share your code of example ?

    <div class="ct__qty">
    <label for="updates_large_1" class="cart__qty-label">Qut</label>
    <input class="cart__qty-input" type="number" name="updates[]" id="updates_large_1" value="2" min="0" pattern="[0-9]*" data-quantity-item="1">
    </div>

    2- And then I have to compare with the "total" amount which is innerText of below class that's is auto calculated by code based on the selected item price $1 and then multiply by qty 2 and returned below value after multiply.

    <td class="text-right small--hide">
    <div>
    $2.00
    </div>
    </td>

    ijazdar
    @ijazdar:matrix.org
    [m]

    Hi, anyone can help me in this regard? thanks

    1- I've a below class which takes values given by the user from the text box by app. So, is that possible can we get value "2" or what's given by user ? if yes then could you please share your code of example ?

    <div class="ct__qty"> <label for="updates_large_1" class="cart__qty-label">Qut</label> <input class="cart__qty-input" type="number" name="updates[]" id="updates_large_1" value="2" min="0" pattern="[0-9]*" data-quantity-item="1"> </div>

    2- And then I have to compare with the "total" amount which is innerText of below class that's is auto calculated by code based on the selected item price $1 and then multiply by qty 2 and returned below value after multiply.

    <td class="text-right small--hide"> <div> $2.00 </div> </td>

    ijazdar
    @ijazdar:matrix.org
    [m]
    Hi everyone,
    Is there a way to send email if any test case gets failed in smashtest?
    ijazdar
    @ijazdar:matrix.org
    [m]
    ijazdar
    @ijazdar:matrix.org
    [m]
    I want to click and verify this text through my code. Please see the highlighted part from the screenshot and help me in this regards. thanks
    ijazdar
    @ijazdar:matrix.org
    [m]

    Hi @All

    Open Chrome

    Navigate to 'google.com'
    
        Type 'hello world[enter]' into 'textbox'

    Is that possible to use any browser by global variable in the command? Like if i want to run this above code on firefox browser without doing any changes in the code.. just want to run by the given command. So what changes i've to if we can use browser in command line?