vendredi 1 mars 2019

Protracor comapare 2 strings arrays

I am a new tester and i struggle with this problem for 2.5 days so i need some of your help i can not how to figure it out. :(

I am using Protractor framework.

The problem is that i have 2 arrays :

var a= [ 'Mon. Dec 10, 2018', 'Mon. Feb 11, 2019', 'Tue. Feb 12, 2019', 'Tue. Aug 13, 2019' ]

var b= [ 'MON. DEC 10', 'MON. FEB 11', 'TUE. FEB 12', 'TUE. AUG 13' ]

i want to compere to those arrays like: expect(a(index)).toContain(b(index)).

To check if first element from first array'Mon. Dec 10, 2018' contains first element from second array 'MON. DEC 10' and so on...

THE CODE

headerText.getText().then(function (header) {
                dateTabs.getText().then(function (tab) {

                    h = header.toString().toUpperCase();
                    t = tab.toString();

                    console.log(header, '====', tab);
                    expect(h).toEqual(jasmine.arrayContaining(t));

                });
            });

Aucun commentaire:

Enregistrer un commentaire