-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef67057
commit 6307c1f
Showing
5 changed files
with
22 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,16 @@ import { test, expect } from '@playwright/test'; | |
const adminApikeyId = 'admin_key_client_id'; | ||
const adminApikeySecret = 'admin_key_client_secret'; | ||
|
||
test.beforeEach(async ({page}) => { | ||
test.beforeEach(async ({ page }) => { | ||
console.log(`Running ${test.info().title}`); | ||
await fetch('http://localhost:9000/admin-api/state/reset', { | ||
method: 'POST', | ||
headers: { | ||
"Authorization": `Basic ${btoa(adminApikeyId + ":" + adminApikeySecret)}` | ||
} | ||
}) | ||
.then(r => r.json()) | ||
.then(r => console.log({r})); | ||
.then(r => r.json()) | ||
.then(r => console.log({ r })); | ||
}) | ||
|
||
const exposedPort = process.env.EXPOSED_PORT || 5173 | ||
|
@@ -29,17 +29,17 @@ test('test a complete user journey', async ({ page }) => { | |
// FIXME: find the fine selector to check user is connected | ||
|
||
//create a new team | ||
await page.locator('div:nth-child(4) > .notification-link').first().click(); | ||
await page.getByRole('button', { name: '' }).first().click(); | ||
await page.getByRole('button', { name: 'Open creation menu' }).click(); | ||
await page.locator('span.block__entry__link').filter({ hasText: 'Team' }).first().click(); | ||
await page.getByLabel('Name').fill('The A team'); | ||
await page.getByLabel('Description').fill('the A team'); | ||
await page.getByLabel('Team contact').fill('[email protected]'); | ||
await page.getByRole('button', { name: 'Create' }).click(); | ||
await expect(page.getByRole('list')).toContainText('Team The A team created successfully'); | ||
await page.locator('.navbar-panel-background').click(); | ||
|
||
//create a new API | ||
await page.locator('div:nth-child(4) > .notification-link').first().click(); | ||
await page.getByRole('button', { name: 'Open creation menu' }).click(); | ||
await page.locator('span').filter({ hasText: 'API' }).first().click(); | ||
await page.locator('div').filter({ hasText: /^The A team$/ }).nth(1).click(); | ||
|
||
|
@@ -119,7 +119,7 @@ test('test a complete user journey', async ({ page }) => { | |
await page.getByRole('link', { name: 'APIs list' }).click(); | ||
await expect(page.getByRole('main')).toContainText('second test api'); | ||
|
||
|
||
await page.locator('div').filter({ hasText: /^second test api/ }).getByLabel('star').click(); | ||
await expect(page.locator('div').filter({ hasText: /^second test api/ }).locator('.star-button')).toContainText('1') | ||
await page.locator('div').filter({ hasText: /^second test api/ }).getByLabel('star').click(); | ||
|
@@ -134,7 +134,7 @@ test('test a complete user journey', async ({ page }) => { | |
await page.locator('.team-selection__team:has-text("The A team")').click(); | ||
//todo: wait subscription ok | ||
await page.waitForResponse(r => r.url().includes('/_subscribe') && r.status() === 200) | ||
|
||
await page.goto(`http://localhost:${exposedPort}/apis`); | ||
await page.getByRole('heading', { name: 'second test api' }).click(); | ||
// await page.getByText('Documentation').click(); | ||
|
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 |
---|---|---|
|
@@ -170,7 +170,7 @@ test('Create & manage API', async ({ page }) => { | |
await page.getByPlaceholder('Password').fill('password'); | ||
await page.getByPlaceholder('Password').press('Enter'); | ||
//create new API | ||
await page.locator('div:nth-child(4) > .notification-link').first().click(); | ||
await page.getByRole('button', { name: 'Open creation menu' }).click(); | ||
await page.locator('span').filter({ hasText: 'API' }).first().click(); | ||
await page.locator('#portal-root div').filter({ hasText: /^Testers$/ }).click(); | ||
await page.getByRole('button', { name: 'Published' }).click(); | ||
|
@@ -219,14 +219,14 @@ test('Create & manage API', async ({ page }) => { | |
await page.getByPlaceholder('Max. requests per day').fill('1000'); | ||
await page.getByPlaceholder('Max. requests per month').fill('1000'); | ||
await page.getByRole('button', { name: 'Save' }).click(); | ||
//FIXME | ||
|
||
await page.getByRole('main').locator('i').click(); | ||
await page.locator('#dropdownMenuButton').nth(1).click(); | ||
await page.getByText('Edit plan').nth(1).click(); | ||
await page.getByText('Process').click(); | ||
await page.getByRole('button', { name: 'Add a first validation step' }).click(); | ||
await page.getByRole('button', { name: 'Team admin' }).click(); | ||
await page.getByRole('button', { name: 'Create' }).click(); | ||
await page.getByRole('button', { name: 'Create', exact: true }).click(); | ||
await page.locator('.sortable-item__draggable-container').filter({ hasText: 'ADMIN' }).hover() | ||
|
||
await page.getByRole('listitem').getByRole('button').first().click(); | ||
|
@@ -238,12 +238,12 @@ test('Create & manage API', async ({ page }) => { | |
await page.getByRole('button', { name: 'Save' }).click(); | ||
await page.getByRole('application').getByRole('button').nth(1).click(); | ||
await page.getByRole('button', { name: 'Email' }).click(); | ||
await page.getByRole('button', { name: 'Create' }).click(); | ||
await page.getByRole('button', { name: 'Create', exact: true }).click(); | ||
await page.getByRole('button', { name: 'Add' }).click(); | ||
await page.locator('input[name="emails\\.0\\.value"]').click(); | ||
await page.locator('input[name="emails\\.0\\.value"]').fill('[email protected]'); | ||
await page.getByLabel('message').fill('somebody wants an apikey...is it ok ?'); | ||
await page.getByRole('button', { name: 'Create' }).click(); | ||
await page.getByRole('button', { name: 'Create', exact: true }).click(); | ||
|
||
//create last plan (private) | ||
await page.getByText('Plans').click(); | ||
|
@@ -429,7 +429,7 @@ test('aggregation mode', async ({ page, request, context }) => { | |
|
||
await page.getByRole('button', { name: 'clientId:clientToken' }).click(); | ||
const apikeyUniq = await page.evaluate(() => navigator.clipboard.readText()); | ||
console.log({apikey, apikey2, apikeyUniq}) | ||
console.log({ apikey, apikey2, apikeyUniq }) | ||
await expect(apikeyUniq).not.toBe(apikey) | ||
|
||
|
||
|
@@ -631,7 +631,7 @@ test('transfer an api subscription', async ({ page, context }) => { | |
await page.getByText('Testers').click(); | ||
await page.getByRole('button', { name: 'Confirm transfer' }).click(); | ||
|
||
await page.locator('.top__container').filter({hasText: 'Your teams'}).getByText('Testers').click(); | ||
await page.locator('.top__container').filter({ hasText: 'Your teams' }).getByText('Testers').click(); | ||
await page.getByText('API keys').click(); | ||
await page.getByRole('row', { name: 'test API 2.0.0 View API View' }).getByLabel('View APIkeys').click(); | ||
expect(page.locator('.api-subscription__infos__name')).toHaveText("not test plan"); | ||
|
@@ -653,7 +653,7 @@ test('can setup subscription valid until for a subs to his apis', async ({ page | |
|
||
await page.goto(`http://localhost:${exposedPort}/testers/settings/apis/test-api/1.0.0/infos`) | ||
// await page.waitForResponse(r => r.url().includes('/_name') && r.status() === 200) | ||
await page.locator('.block__entry__link').filter({ hasText: 'Subscriptions'}).click(); | ||
await page.locator('.block__entry__link').filter({ hasText: 'Subscriptions' }).click(); | ||
await page.getByRole('row', { name: 'daikoku-api-key-test-api-not-test-plan-consumers-' }).getByRole('button', { name: 'Update metadata' }).click(); | ||
await page.getByPlaceholder('mm/dd/yyyy').fill('11/18/2024'); | ||
await page.locator('.modal-footer .btn-outline-success').filter({ hasText: 'Update' }).click(); | ||
|
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ test('manage team as admin', async ({ page }) => { | |
await page.getByPlaceholder('Email address').fill('[email protected]'); | ||
await page.getByPlaceholder('Password').fill('password'); | ||
await page.getByPlaceholder('Password').press('Enter'); | ||
await page.locator('div:nth-child(4) > .notification-link').first().click(); | ||
await page.getByRole('button', { name: 'Open creation menu'}).click(); | ||
await page.locator('span.block__entry__link').filter({ hasText: 'Team' }).first().click(); | ||
await page.getByLabel('Name').fill('komainu'); | ||
await page.getByRole('button', { name: 'Create' }).click(); | ||
|