3

I want to test the pages of my website application. However, I have a disclaimer page that needs to be accepted before you can access the actual application. Is there a way to execute a task (click the accept button in my case) before doing the tests.

Currently, all my tasks fail because they can't pass the page.

Thanks.

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
LuVu
  • 1,053
  • 1
  • 7
  • 23

2 Answers2

9

You can do this in a BeforeEach Step

hdorgeval
  • 3,000
  • 8
  • 17
1

The code will look something like this:

fixture`testing BeforeEach functionality`
  .meta('fixtureID', 'fix-0001')
  .meta({ author: 'luka98v', creationDate: Date() })
  .page`${url}`
  .beforeEach(async t => {
    const acceptButton = Selector('#accept-disclaimer')
    await t
      .click(acceptButton)
  })

It works fine.

LuVu
  • 1,053
  • 1
  • 7
  • 23