Skip to content

Commit

Permalink
ci troubleshooting
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Kruggel committed Jul 18, 2024
1 parent ad2a465 commit f05fb03
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: playwright-screenshot
path: screenshot.png
path: tests/screenshots/screenshot.png

Check failure on line 96 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / Lint

96:49 [new-line-at-end-of-file] no new line character at the end of file
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ terraform.tfstate.backup
# Tests
node_modules/
.playwright/
screenshots/
20 changes: 13 additions & 7 deletions tests/auth.setup.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { test as setup, expect } from '@playwright/test';
import { authFile } from './playwright.config';
import path from 'path';

const screenshotPath = path.resolve(__dirname, 'screenshots', 'screenshot.png');

setup('authenticate', async ({ page, context, baseURL }) => {
try {
await page.goto(baseURL);
console.log('Current working directory:', process.cwd());
console.log('Screenshot will be saved to:', screenshotPath);
await page.goto('https://jenkins.uds.dev/');
await page.getByLabel("Username or email").fill("doug");
await page.getByLabel("Password").fill("unicorn123!@#");
await page.getByRole("button", { name: "Log In" }).click();
Expand All @@ -20,9 +24,11 @@ setup('authenticate', async ({ page, context, baseURL }) => {

await page.context().storageState({ path: authFile });

await expect(page).toHaveURL(baseURL);
} catch (error) {
await page.screenshot({ path: 'screenshot.png' });
throw error; // rethrow the error after taking the screenshot
}
try {
await expect(page).toHaveURL('https://jenkins.uds.dev/');
} catch (error) {
console.log('URL assertion failed');
await page.screenshot({ path: screenshotPath });
throw error; // Rethrow the error after taking the screenshot
}
})

0 comments on commit f05fb03

Please sign in to comment.