Skip to content

Commit

Permalink
playwright screenshot on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
jalling97 committed Jul 24, 2024
1 parent 27df058 commit 68b37c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/leapfrogai_ui/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ const devConfig: PlaywrightTestConfig = {
// when e2e testing, use the deployed instance
const CI_Config: PlaywrightTestConfig = {
use: {
baseURL: 'https://ai.uds.dev'
baseURL: 'https://ai.uds.dev',
screenshot: 'only-on-failure'
},
reporter: [['html', { outputFolder: 'e2e-report' }]]
};
Expand Down
11 changes: 1 addition & 10 deletions src/leapfrogai_ui/tests/global.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as OTPAuth from 'otpauth';

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

setup('authenticate', async ({ page }, testInfo) => {
setup('authenticate', async ({ page }) => {
await page.goto('/'); // go to the home page
if (process.env.PUBLIC_DISABLE_KEYCLOAK === 'true') {
// when running in Github CI, create a new account because we don't have seed migrations
Expand Down Expand Up @@ -42,15 +42,6 @@ setup('authenticate', async ({ page }, testInfo) => {
await page.getByRole('button', { name: 'Log In' }).click();
}

// Take a screenshot for debugging login attempts in CI
if (process.env.TEST_ENV === 'CI') {
const screenshot = await page.screenshot();

await testInfo.attach('login_auth_attempt', {
body: screenshot,
contentType: 'image/png'
});
}
// Wait until the page receives the cookies.
//
// Login flow sets cookies in the process of several redirects.
Expand Down

0 comments on commit 68b37c8

Please sign in to comment.