含聚合物1.0的Cypress,cy.get()在重试时将触发属性观察器

时间:2019-01-03 14:40:01

标签: javascript firebase polymer cypress

当前行为:

在index.html中,我正在尝试初始化firebase并将电子邮件发送到子模块app.html

<script>
const config = {
            apiKey: "{{ firebase_api_key }}",
            authDomain: "{{ firebase_auth_domain }}",
            databaseURL: "{{ firebase_database_url }}",
            storageBucket: "{{ firebase_storage_bucket }}"
        };

        firebase.initializeApp(config, 'dmc-db');
        firebase.app('dmc-db').auth().signInWithCustomToken("{{custom_auth_token }}");
</script>
<body> 
<dmc-app id="dmc-app" email="{{ email }}"></dmc-app>
</body>

在app.html中:

<script> 
     Polymer({
        is: 'app',
       properties: {
                email: {
                type: String,
                observer: '_setUser',                                     
            }
       },
        _setUser: function (email, old) {
            console.log('---- set user, email: ', email, ' old:', old);
        },
</script>

问题是当cy.get('#create-button')找不到元素时,它将重试并触发polymer('_ setUser')中的观察者

beforeEach(() => {
    cy.login();
    cy.visit('/dashboard');
});

it('Should create work sheet without information', ()=> {
    cy.get('#create-button');
})

结果为enter image description here,而不仅仅是对_setUser()的一次调用

0 个答案:

没有答案