ブラウザ上で動くテストフレームワーク jest+jsdomでのテストと違って実際のブラウザを使うので、jsdomの実装による制限がない
まとめ:
同期非同期の区別は不要
宣言的に記述
CypressはURL指定でサーバにアクセスしてそれに対してテストする
ソースコード編集したら自動でテストが再実行される
JavaScript End to End Testing Framework https://www.cypress.io/
Cypress does not use Selenium. Whereas Selenium executes remote commands through the network, Cypress runs in the same run-loop as your application. https://www.cypress.io/how-it-works/
Introduction to Cypress | Cypress Documentation
This is the single most important guide
できた
できた
/// <reference types="cypress" />
describe('adjust font size', () => {
beforeEach(() => {
cy.visit('/')
})
it('first fusen', () => {
cy.get('.fusen[data-testid=">あ"]').should("have.css", "font-size", "66px")
})
})
cy.get('.fusen').eq(1).should("have.css", "font-size", "53px")cy.get('.fusen').should('have.length', 12).eq(1).should("have.css", "font-size", "53px")Cypress commands only retry the last command before the assertion
Assertions | Cypress Documentation
Cypress入門~初心者でも簡単にE2Eテストが作れる~ | フューチャー技術ブログ
保守・拡張をしやすいカプセル化したCypress | フューチャー技術ブログ
Cypress - 書きやすいテストの秘密と独自コマンドの実装 | フューチャー技術ブログ
CypressはWebDriver系(Selenium)やChrome DevTool Protocol系(Puppeteer)のツールとAPIの粒度が異なります。