-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add admin campaign applications
- add a login fixture - add a test that verifies the current admin list of campaign applications
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,5 @@ PAYPAL_CLIENT_ID=sb | |
########### | ||
GHOST_API_URL=https://blog.podkrepi.bg | ||
GHOST_CONTENT_KEY=86ec17c4b9660acd66b6034682 | ||
[email protected] | ||
PODKREPI_PASSWORD=$ecurePa33 |
10 changes: 10 additions & 0 deletions
10
e2e/tests/regression/campaign-application/campaign-application-create.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { test, expect } from '../../../utils/fixtures' | ||
|
||
test.describe('Create campaign application', () => { | ||
test('should see list of applications', async ({ page, baseURL }) => { | ||
await page.goto(`${baseURL}/admin/campaign-applications`) | ||
|
||
await expect(page.getByRole('heading')).toHaveText('Кандидат Кампании') | ||
await expect(page.getByRole('row')).toHaveCount(6); // title plus 5 rows | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { test as base } from '@playwright/test' | ||
import dotenv from 'dotenv' | ||
|
||
dotenv.config({path: '../.env.local'}) | ||
dotenv.config({path: '../.env'}) | ||
|
||
const email = process.env.PODKREPI_EMAIL! | ||
const password = process.env.PODKREPI_PASSWORD! | ||
|
||
export const test = base.extend({ | ||
storageState: async ({ browser, baseURL }, use) => { | ||
const page = await browser.newPage() | ||
await page.goto(`${baseURL}/login`) | ||
|
||
await page.locator('[name=email]').fill(email) | ||
await page.locator('[name=password]').fill(password) | ||
|
||
await page.locator('[type=submit]').click() | ||
await page.waitForURL((url) => !url.pathname.includes('login')) | ||
|
||
const state = await page.context().storageState() | ||
|
||
await page.close() | ||
|
||
use(state) | ||
}, | ||
}) | ||
|
||
/** export the expect for consistency i.e. to be able to do `import { test, expect } from '../utils/fixtures'` */ | ||
export { expect } from 'playwright/test' |