protractor Migrations

Assertions

BeforeAfter
expect(by.className('thisClass').count()).toEqual(3)cy.get('.thisClass').its('length').should('equal', 3)
expect(testPageObject).toBe({ id: test })testPageObject.should('deepEqual', { id: test })
expect(by.css('.list').count()).toEqual(3)cy.get('.list').its('length').should('equal', 3)
expect(by.css('.list').count()).not.toEqual(5)cy.get('.list').its('length').should('not.equal', 5)
expect(element(by.css('.list')).isDisplayed()).toBeFalse()cy.get('.list').should('not.be.visible')
expect(by.className('thisClass').isPresent()).toBeFalse()cy.get('.thisClass').should('not.exist')
expect(element(by.className('test-checkbox').isSelected())).toBe(true)cy.get('.test-checkbox').should('be.selected')
expect(element(by.className('input-field').isEnabled())).toBe(false)cy.get('.input-field').should('not.be.enabled')
expect(element(by.id('user-name')).getText()).toBe('Joe Smith')cy.get('#user-name').should('have.text', 'Joe Smith')
element.all(by.css('.list-item')).get(3)cy.get('.list-item').eq(3)

Browser methods

BeforeAfter
browser.wait(5000)cy.wait(5000)
browser.getTitle()cy.title()
browser.getCurrentUrl()cy.location('href')
browser.setLocation('faq')cy.get('#faq').scrollIntoView()
browser.refresh()cy.reload()
browser.debugger()cy.debug()
browser.findElement(by.css('.list'))cy.get('.list')
browser.driver.findElement(by.css('.another-list'))cy.get('.another-list')
browser.restart()Removed from file.
browser.restartSync()Removed from file.
browser.ignoreSynchronization = trueRemoved from file.
browser.manage().timeouts().implicitlyWait(15000)Removed from file.
browser.waitForAngular()Removed from file.
browser.waitForAngularEnabled()Removed from file.
browser.pause()Removed from file.
browser.getId()Removed from file.

Interactions

BeforeAfter
element(by.className('thisClass')).sendKeys('type something')cy.get('.thisClass').type('type something')
browser.actions().click(element(by.tagName('button'))).perform()cy.get('button').click()
browser.actions().mouseMove(element(by.id('test-id'))).perform()cy.get('#test-id').scrollIntoView()
browser.actions().doubleClick(element(by.className('list-item'))).perform()cy.get('.list-item').dblclick()
element(by.id('test')).takeScreenshot()cy.get('#test').screenshot()
el.takeScreenshot()el.screenshot()

Selectors

BeforeAfter
by.className('thisClass')cy.get('.thisClass')
by.id('my-id')cy.get('#my-id')
by.css('.my-class')cy.get('.my-class')
by.name('field-name')cy.get('input[name="field-name"]')
by.model('user.name')cy.get('[ng-model="user.name"]');
by.binding('value')cy.get('[ng-bind="value"]')
by.options('n in name')cy.get('[ng-options="n in name"]')
by.linkText('Google')cy.contains('a', 'Google')
by.partialLinkText('Goo')cy.contains('a', 'Goo')
by.cssContainingText('.my-class', 'text')cy.contains('.my-class', 'text')
by.buttonText('Save')cy.contains('button', 'Save')
by.partialButtonText('Save')cy.contains('button', 'Save')
by.tagName('h1')cy.get('h1')
by.xpath('//ul[@class="todo-list"]//li')cy.xpath('//ul[@class="todo-list"]//li')
$('this-example')cy.get('this-example')
$('example').$$('li')cy.get('example').find('li')
$$('li').get(1)cy.get('li').eq(1)
element(by.css('.an-element'))cy.get('.an-element')
element.all(by.css('.list-items'))cy.get('.list-items')
el.getAttribute('abc')cy.get(el).invoke('attr', 'abc')
testElement.getDriver()testElement.parent()
$('.parent').getWebElement()cy.get('.parent')
element(by.css('.my-class')).getWebElement()cy.get('.my-class')