-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: create admin and test playwright authentication
- Loading branch information
1 parent
fc87645
commit b51ee95
Showing
2 changed files
with
83 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 |
---|---|---|
|
@@ -44,10 +44,32 @@ jobs: | |
working-directory: docker | ||
run: | | ||
./compose.py --compose-file docker-compose.yml --compose-file docker-compose.dev.yml up | ||
sleep 60 | ||
docker exec -ti saeoss_ckan-web_1 poetry run ckan db init | ||
docker exec -ti saeoss_ckan-web-1 poetry run ckan user add user [email protected] name=admin password=12345678 | ||
docker exec -ti saeoss_ckan-web_1 poetry run ckan sysadmin add admin | ||
- name: Test App endpoint | ||
run: | | ||
curl http://localhost:5000/ | ||
if [ $? -ne 0 ]; then | ||
echo "Curl command failed" | ||
exit 1 | ||
fi | ||
- name: Update dependencies | ||
working-directory: ./playwright/ci-test | ||
run: npm install | ||
- name: Install exact dependencies | ||
working-directory: ./playwright/ci-test | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
working-directory: ./playwright/ci-test | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
working-directory: ./playwright/ci-test | ||
run: npx playwright test | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright/ci-test/playwright-report/ | ||
retention-days: 30 |
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,61 @@ | ||
import { test as setup, expect } from '@playwright/test'; | ||
|
||
let url = '/'; | ||
|
||
let username = 'admin'; | ||
let useremail = '[email protected]'; | ||
let password = '12345678'; | ||
const authFile = 'auth.json' | ||
|
||
|
||
setup('test', async ({ page }) => { | ||
await page.goto(url); | ||
|
||
await expect(page.locator('.navbar-brand')).toBeVisible(); | ||
|
||
await expect(page.getByText('Welcome to the SAEOSS Portal LOGIN SIGN UP METADATA Discover a world of data-')).toBeVisible(); | ||
|
||
await expect(page.getByText('Welcome to the SAEOSS Portal')).toBeVisible(); | ||
|
||
await expect(page.getByRole('link', { name: 'LOGIN' })).toBeVisible(); | ||
|
||
await expect(page.locator('#title-header').getByRole('link', { name: 'SIGN UP' })).toBeVisible(); | ||
|
||
await page.getByRole('link', { name: 'LOGIN' }).click(); | ||
|
||
await expect(page.getByRole('heading', { name: 'Login' })).toBeVisible(); | ||
|
||
await expect(page.getByRole('heading', { name: 'Need an Account?' })).toBeVisible(); | ||
|
||
await expect(page.getByRole('link', { name: 'Create an Account' })).toBeVisible(); | ||
|
||
await expect(page.getByRole('heading', { name: 'Forgotten your password?' })).toBeVisible(); | ||
|
||
await expect(page.locator('p').filter({ hasText: 'Forgot your password?' })).toBeVisible(); | ||
|
||
await page.getByLabel('Username').click(); | ||
|
||
await page.getByLabel('Username').fill('admin'); | ||
|
||
await page.getByLabel('Password').click(); | ||
|
||
await page.getByLabel('Password').fill('admin123'); | ||
|
||
await page.getByRole('button', { name: 'Login' }).click(); | ||
|
||
await expect(page.getByRole('heading', { name: 'News feed Activity from items' })).toBeVisible(); | ||
|
||
await expect(page.getByRole('link', { name: ' News feed' })).toBeVisible(); | ||
|
||
await expect(page.getByRole('link', { name: ' My Metadata Records' })).toBeVisible(); | ||
|
||
await expect(page.getByRole('link', { name: ' My Organisations' })).toBeVisible(); | ||
|
||
await expect(page.getByRole('link', { name: ' My Groups' })).toBeVisible(); | ||
|
||
await expect(page.getByRole('link', { name: ' Profile settings' })).toBeVisible(); | ||
|
||
await expect(page.getByRole('link', { name: 'Activity from: Everything' })).toBeVisible(); | ||
|
||
await page.context().storageState({ path: authFile }); | ||
}); |