1

Is there an annotation that will ignore the 'authenticate' test from the report.

Let me know if more info is needed. I am calling the 'authenticate' test through the playwright.config file, 'setup', as a dependency and saving the auth within a 'storageState' user.json file.

example:

import { test as setup } from '@playwright/test';

const authFile = 'playwright/.auth/user.json';

setup('authenticate', async ({ request }) => {
  // Send authentication request. Replace with your own.
  await request.post('https://github.com/login', {
    form: {
      'user': 'user',
      'password': 'password'
    }
  });
  await request.storageState({ path: authFile });
});

Image of Report with 2 tests instead of 1

I created a function call (instead of a 'test as setup') to open browser before exporting default defineConfig to initialize the user's browser auth information into the user.json. But I kept running into file not found issues, due to the defineConfig file referring to user.json in the 'storageState: ...'

I've read playwright documentation related to annotations, and state configurations, global setup and teardowns, but I can't seem to find anything to remove this test report from the reporting page.

I was thinking of parsing the report and removing that test, but I'm not really sure about that approach.

Thank you for looking into this and let me know if more information is needed.

2
  • tldr: create a custom reporter. sinfluxx from the playwright discord sent this thread to me: discord.com/channels/807756831384403968/1264887648812662804/… Commented Jul 31, 2024 at 5:49
  • Please add your playwright.config file in order for the question to contain all the necessary details. Commented Aug 4, 2024 at 13:53

1 Answer 1

0

You have it as a test because you use it as a test. And test will be in the reports.

import { test as setup } from '@playwright/test';
setup('authenticate', async ({ request }) => {

Try use hooks - beforeAll, beforeEach or implement Auth in Global Setup

Sign up to request clarification or add additional context in comments.

1 Comment

Implementing Global Setup is gonna change this behavior?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.