jeudi 24 décembre 2020

Testcafe introduce entry point for tests after authorization

I have a test suite(fixture) with multiple functional tests for test cafe. They look something like this:

fixture('Test suite')
  .page(login_url)
  .beforeEach(async (t) => {
    await t.maximizeWindow()
    await page.signIn('username', 'pass');
  });

test('Test case 1', async (t) => {
  await t.expect(page.title.textContent).eql('My Page');}
test('Test case 2', async (t) => {
  await do some other stuff}

This obviously wastes a lot of time before each test because we need to log in each time. How do I log in once, set that page as an entry point, and start each test from that page?

Aucun commentaire:

Enregistrer un commentaire