flood-io / element

💦Load test your app using real web browsers
https://element.flood.io
Apache License 2.0
351 stars 43 forks source link

Proposal: Consider switching syntax to mocha style #73

Open ivanvanderbyl opened 5 years ago

ivanvanderbyl commented 5 years ago

Is your feature request related to a problem? Please describe.

To increase learnability we should consider using an existing testing DSL which is familiar to a wide audience. Example, Cypress uses the Mocha style.

Describe the solution you'd like

Implement a replacement for test steps which is based on the descriptive style of Mocha:

import {describe, it} from "@flood/element"

describe("Load testing app", () => {
  describe("Login page", () => {
    it("enters username and password", async (browser) => {
      let input = await browser.findElement(By.id("username"))
      ...
    })
  })
})

Describe alternatives you've considered

There are others, TBA

Additional context

The goal of this story is to open up support for nested test steps and a more flexible testing DSL.

ivanvanderbyl commented 4 years ago

Perhaps another approach would be to adopt support of Jest, which uses Jasmine syntax.

describe('A useful feature', () => {

  test.perf('Homepage', () => {
    step('Load page', async b => {})
    step('Find products', async b => {})
    step('Add to cart', async b => {})
    step('Checkout', async b => {})
    step('Submit payment details', async b => {})
  })

  test('a function component', async () => {})
});