GithubHelp home page GithubHelp logo

Comments (6)

rochejul avatar rochejul commented on May 28, 2024

Hi

Can you send a sample project please ? To reproduce your context

Many thanks

Cheets

from gulp-angular-protractor.

skywalker5727 avatar skywalker5727 commented on May 28, 2024

On Tue, Aug 2, 2016 at 1:12 PM, Roche julien [email protected]
wrote:

Hi

Can you send a sample project please ? To reproduce your context

Many thanks

Cheets


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQhEDdI_frQG9YP330Sf0GzyzMPb0yIyks5qb3qDgaJpZM4JaupD
.

//
// Home page (Material Design Lite)
//

import {browser, element, by, By, $, $$, ExpectedConditions} from 'protractor/globals';

var HomePage = function () {

this.DashboardMenuItem = element(by.id('navDashboard'));
this.NotificationsMenuItem = element(by.id('navNoties'));
this.UsersMenuItem = element(by.id('navUsers'));
this.HamburgerMenu = element(by.css('.mdl-layout__drawer-button i'));
this.HamburgerMenuVisibilityIndicator = element(by.tagName('rsu-app'))
    .element(by.className('mdl-layout__container'))
    .element(by.className('is-small-screen'));

this.openNotifications = function () {
    let self = this;
    this.HamburgerMenuVisibilityIndicator.isPresent().then(function (isPresent) {
        if (isPresent) {
            self.HamburgerMenu.click();
        };
    });
    this.NotificationsMenuItem.click();
}

this.openDashboard = function () {
    this.DashboardMenuItem.click();
}

};

module.exports = new HomePage();
//
// Noties grid
//
import {browser, element, by, By, $, $$, ExpectedConditions} from 'protractor/globals';

var NotificationGrid = function () {

// ********** Objects *********************************************

// card object
this.Container = element(by.tagName('rsu-noties'));

// grid object
this.NotiesGrid = element(by.tagName('rsu-noties-grid'));

// header objects
this.GridHeaderRow = this.NotiesGrid.element(by.tagName('thead'));
this.GridHeaders = this.GridHeaderRow.element(by.tagName('tr')).all(by.tagName('th'));
this.GridColumnNames = this.GridHeaders.all(by.className('ui-column-title'));

// row objects
this.GridRows = this.NotiesGrid.element(by.tagName('tbody')).all(by.tagName('tr'));

// pagination objects
this.PaginationSection = element(by.tagName('p-paginator'));
this.FirstPageButton = this.PaginationSection.element(by.className('ui-paginator-first'));
this.LastPageButton = this.PaginationSection.element(by.className('ui-paginator-last'));
this.PreviousPageButton = this.PaginationSection.element(by.className('ui-paginator-prev'));
this.NextPageButton = this.PaginationSection.element(by.className('ui-paginator-next'));
this.PageNumberButtons = this.PaginationSection.element(by.className('ui-paginator-pages')).all(by.className('ui-paginator-page'));

// **************  Getters and Setters *********************************

// ******* Actions ******************************************************

this.selectFirstRow = function () {
    this.GridRows.first().click();
}

};

module.exports = new NotificationGrid();

from gulp-angular-protractor.

skywalker5727 avatar skywalker5727 commented on May 28, 2024

I accidentally sent two files in a previous e-mail. I'm using Visual
Studio.

The tests that have Expected Condition give an error with Protractor 4.0.0

  • 'Cannot read property 'presenceOf' of undefined, but other tests I have
    run fine (I didn't send you all of my tests)
    When I have Protractor 4.0.1 (or 2), the application does not open and I
    get 'Cannot read property 'id' of undifined

[image: Inline image 1]

Thanks,

Lucy

On Tue, Aug 2, 2016 at 1:28 PM, Lucy Aslett [email protected] wrote:

On Tue, Aug 2, 2016 at 1:12 PM, Roche julien [email protected]
wrote:

Hi

Can you send a sample project please ? To reproduce your context

Many thanks

Cheets


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQhEDdI_frQG9YP330Sf0GzyzMPb0yIyks5qb3qDgaJpZM4JaupD
.

//
// Tests for Main menu.
//
import {browser, element, by, By, $, $$, ExpectedConditions} from 'protractor/globals';

describe('Menu', function () {

var homePage = require('../Pages/home.page');
var notificationGrid = require('../Pages/notiesGrid.page');
var Timeout = 60000;

beforeEach(function () {

    // Note:  As of 4/10/2016 there is an ssue with synchronization.  https://github.com/angular/angular/issues/8758
    // and https://github.com/angular/protractor/issues/460
    // browser.ignoreSynchronization = true is required or the following error occurs:   
    // "Timed out waiting for Protractor to synchronize with the page after 11 seconds..."

    browser.get(browser.params.baseURL);

});

it('should contain menu items', function () {

    //
    // Need to wait for the home page to appear.  
    var EC1 = ExpectedConditions;
    browser.wait(EC1.presenceOf(homePage.DashboardMenuItem), Timeout);

    expect(homePage.DashboardMenuItem.isPresent()).toBe(true);
    expect(homePage.NotificationsMenuItem.isPresent()).toBe(true);
    expect(homePage.UsersMenuItem.isPresent()).toBe(true);

});

// this test has started failing - we don't know why. so we are skipping it for now
xit('Notifications Grid should open (test with narrow width)', function () {

    let width = 800;
    let height = 1000;
    browser.driver.manage().window().setSize(width, height);

    //
    // Wwait for home page to appear.
    var EC1 = ExpectedConditions;
    browser.wait(EC1.presenceOf(homePage.DashboardMenuItem), Timeout);

    homePage.openNotifications()
    browser.wait(EC1.presenceOf(notificationGrid.Container), Timeout);

    expect(notificationGrid.Container.isPresent()).toBe(true);

});

it('Notifications Grid should open (test with standard width)', function () {

    let width = 1200;
    let height = 1000;
    browser.driver.manage().window().setSize(width, height);

    homePage.openNotifications();
    expect(notificationGrid.Container.isPresent()).toBe(true);

});

it('should contain Hamburger menu when window is narrow', function () {
    //
    // Set the window size to be narrow enough for Hamburger menu to appear.
    let width = 800;
    let height = 1000;
    browser.driver.manage().window().setSize(width, height);

    var EC1 = ExpectedConditions;
    browser.wait(EC1.presenceOf(homePage.DashboardMenuItem), Timeout);

    expect(homePage.HamburgerMenuVisibilityIndicator.isPresent()).toBe(true);

});

it('should not contain Hamburger menu when window is wide', function () {
    //
    // Set the window size wide enough so that Hamburger menu doesn't appear.    
    let width = 1600;
    let height = 1000;
    browser.driver.manage().window().setSize(width, height);

    var EC1 = ExpectedConditions;
    browser.wait(EC1.presenceOf(homePage.DashboardMenuItem), Timeout);

    expect(homePage.HamburgerMenuVisibilityIndicator.isPresent()).toBe(false);

});

});

from gulp-angular-protractor.

skywalker5727 avatar skywalker5727 commented on May 28, 2024

I think I sent you the typescript files - you probably want the transpiled
javascript. Thanks for taking a look.

Lucy

On Tue, Aug 2, 2016 at 1:34 PM, Lucy Aslett [email protected] wrote:

I accidentally sent two files in a previous e-mail. I'm using Visual
Studio.

The tests that have Expected Condition give an error with Protractor 4.0.0

  • 'Cannot read property 'presenceOf' of undefined, but other tests I have
    run fine (I didn't send you all of my tests)
    When I have Protractor 4.0.1 (or 2), the application does not open and I
    get 'Cannot read property 'id' of undifined

[image: Inline image 1]

Thanks,

Lucy

On Tue, Aug 2, 2016 at 1:28 PM, Lucy Aslett [email protected] wrote:

On Tue, Aug 2, 2016 at 1:12 PM, Roche julien [email protected]
wrote:

Hi

Can you send a sample project please ? To reproduce your context

Many thanks

Cheets


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQhEDdI_frQG9YP330Sf0GzyzMPb0yIyks5qb3qDgaJpZM4JaupD
.

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

Ok, I try to checkout this point

See you

from gulp-angular-protractor.

rochejul avatar rochejul commented on May 28, 2024

Hi,

Many thinks: first I use a version of gulp-protractor which use protractor 3.0.0 (not 4.0.0)

Next, I have pushed an example with typescript: https://github.com/rochejul/gulp-angular-protractor/tree/master/examples/example-04

As you can see, I don't have to import stuff (becausejasmine / protractor are "external" modules, and so are exposed as global on the scope, as you can see in a vanillaJs example: https://github.com/angular/protractor/blob/master/example/example_spec.js)

And if you run the tests, it works fine:

'use strict';

const TIME_OUT = 10000;

describe('angularjs homepage', function () {
    it('should greet the named user', function () {
        browser.get('http://www.angularjs.org');

        element(by.model('yourName')).sendKeys('Julie');

        let greeting = element(by.binding('yourName'));

        expect(greeting.getText()).toEqual('Hello Julie!');
    });

    describe('todo list', function () {
        let todoList;

        beforeEach(function () {
            browser.get('http://www.angularjs.org');

            todoList = element.all(by.repeater('todo in todoList.todos'));
        });

        it('should list todos', function () {
            expect(todoList.count()).toEqual(2);
            expect(todoList.get(1).getText()).toEqual('build an angular app');
        });

        it('should add a todo', function () {
            let addTodo = element(by.model('todoList.todoText'));
            let addButton = element(by.css('[value="add"]'));

            addTodo.sendKeys('write a protractor test');
            addButton.click();

            expect(todoList.count()).toEqual(3);
            expect(todoList.get(2).getText()).toEqual('write a protractor test');
        });

        it('should wait until the video tags are shown', function () {
            browser.wait(protractor.ExpectedConditions.presenceOf(element(by.css('.video-img'))), TIME_OUT);

            let videos = element.all(by.css('.video-img'));
            expect(videos.count()).toEqual(2);
        });
    });
});

I hope that help you

Cheers

Julien Roche

from gulp-angular-protractor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.