Skip to content

Commit

Permalink
fix front office tests
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinovega committed Jan 31, 2025
1 parent ef67057 commit 6307c1f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions daikoku/javascript/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,8 @@
"apis.list.apigroup.badge.label": "API group",
"apis.list.currentVersion.badge.label": "Current version",
"api.form.create.version.btn.aria.label": "Create new API version",
"sidebar.search.button.aria.label": "Open creation menu",
"sidebar.create.button.aria.label": "Open search",
"sidebar.search.button.aria.label": "Open search",
"sidebar.create.button.aria.label": "Open creation menu",
"sidebar.more.button.aria.label": "Show more options",
"sidebar.messages.button.aria.label": "Open chat with an admin",
"sidebar.notifications.button.aria.label": "Open notification center",
Expand Down
4 changes: 2 additions & 2 deletions daikoku/javascript/src/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1426,8 +1426,8 @@
"apis.list.apigroup.badge.label": "API group",
"apis.list.currentVersion.badge.label": "Version courante",
"api.form.create.version.btn.aria.label": "Créer une nouvelle version de l'API",
"sidebar.search.button.aria.label": "Ouvrir le menu de création",
"sidebar.create.button.aria.label": "Ouvrir la recherche",
"sidebar.search.button.aria.label": "Ouvrir la recherche",
"sidebar.create.button.aria.label": "Ouvrir le menu de création",
"sidebar.more.button.aria.label": "Afficher plus d'options",
"sidebar.messages.button.aria.label": "Ouvrir le chat avec un admin",
"sidebar.notifications.button.aria.label": "Ouvrir le centre de notifications",
Expand Down
18 changes: 9 additions & 9 deletions daikoku/javascript/tests/completeJourney.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
16 changes: 8 additions & 8 deletions daikoku/javascript/tests/connectedUser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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");
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion daikoku/javascript/tests/manageMembers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6307c1f

Please sign in to comment.