Results 1 to 5 of 5

Thread: Selecting Files from my File system

  1. #1

    Default Selecting Files from my File system

    Is there a way to select different types of files from my file system from within Sencha Test? The application requires external files to be included at different workflow stages.
    Thanks!

  2. #2
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    London, England
    Posts
    396
    Answers
    75

    Default

    Are you asking how you can reference files within your test suites, and read data from them? Or are you asking how to add/select a file to populate a file upload field within your web app?
    Daniel Gallo
    Sales Engineer
    Sencha

  3. #3

    Default

    Add/select a file to populate a file upload field within your web app.

  4. #4
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    London, England
    Posts
    396
    Answers
    75

    Default

    Please take a look at the following example:

    Code:
    describe('File Upload', function() {
        it('should select a file to upload', function() {
            // Find file upload field's HTML element (the actual HTML file upload field)
            ST.element('form[title="File Upload Form"] filefield[name="photo-path"] => input[type="file"]')
                .get('id')
                .and(function() {
                    // Use the id of the file input field
                    var fileFieldId = this.future.data.id;
                    
                    // Use WebDriver.io API to choose a file (define full file path)
                    ST.defaultContext.driver.chooseFile('#' + fileFieldId, '/Users/dan/Pictures/Picture1.png');
                });
        });
        
        it('should upload the file', function() {
            // Click the "Save" button, which uploads file to the server
            ST.button('form[title="File Upload Form"] button[text="Save"]')
                .click();
                
            // Wait for upload confirmation message box to be available
            ST.component('messagebox[title="Success"]')
                .textLike(/File processed on the server/);
        });
    });
    Daniel Gallo
    Sales Engineer
    Sencha

  5. #5

    Default

    It worked. Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •