-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from no10ds/fix/v7-ui
Fix UI v7.0.0
- Loading branch information
Showing
13 changed files
with
531 additions
and
394 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
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
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
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
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
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
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 |
---|---|---|
@@ -1,48 +1,30 @@ | ||
import { test as setup, expect } from '@playwright/test'; | ||
import { SecretsManager } from 'aws-sdk' | ||
import { test as setup, expect } from '@playwright/test' | ||
import { domain, getSecretValue } from './utils' | ||
|
||
const client = new SecretsManager({ region: process.env.AWS_REGION }) | ||
const authFile = 'playwright/.auth/user.json'; | ||
const domain = process.env.DOMAIN; | ||
const authFile = 'playwright/.auth/user.json' | ||
const secretName = `${process.env.RESOURCE_PREFIX}_UI_TEST_USER` | ||
|
||
|
||
export async function getSecretValue( | ||
secretName: string | ||
): Promise<string | void> { | ||
return new Promise((resolve, reject) => { | ||
client.getSecretValue({ SecretId: secretName }, function (err, data) { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve(data.SecretString) | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
|
||
setup('authenticate', async ({ page }) => { | ||
const secret = JSON.parse(await getSecretValue(secretName) as string) | ||
await page.goto(domain); | ||
await page.goto(`${domain}/login`); | ||
const secret = JSON.parse((await getSecretValue(secretName)) as string) | ||
await page.goto(domain) | ||
await page.goto(`${domain}/login`) | ||
|
||
await page.locator('[data-testid="login-link"]').click(); | ||
await page.locator('[data-testid="login-link"]').click() | ||
|
||
await page.locator('[placeholder="Username"]').nth(1).click(); | ||
await page.locator('[placeholder="Username"]').nth(1).click() | ||
|
||
await page.locator('[placeholder="Password"]').nth(1).click(); | ||
await page.locator('[placeholder="Password"]').nth(1).click() | ||
|
||
await page.locator('[placeholder="Password"]').nth(1).fill(`${secret['password']}`); | ||
await page.locator('[placeholder="Password"]').nth(1).fill(`${secret['password']}`) | ||
|
||
await page.locator('[placeholder="Username"]').nth(1).click(); | ||
await page.locator('[placeholder="Username"]').nth(1).click() | ||
|
||
await page.locator('[placeholder="Username"]').nth(1).click(); | ||
await page.locator('[placeholder="Username"]').nth(1).click() | ||
|
||
await page.locator('[placeholder="Username"]').nth(1).fill(`${secret['username']}`); | ||
await page.locator('[placeholder="Username"]').nth(1).fill(`${secret['username']}`) | ||
|
||
await page.locator('text=Sign in').nth(3).click(); | ||
await expect(page).toHaveURL(domain); | ||
await page.locator('text=Sign in').nth(3).click() | ||
await expect(page).toHaveURL(domain) | ||
|
||
await page.context().storageState({ path: authFile }); | ||
}); | ||
await page.context().storageState({ path: authFile }) | ||
}) |
Oops, something went wrong.