-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 [e2e-frontend] Service browser (#6664)
- Loading branch information
Showing
4 changed files
with
159 additions
and
5 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
64 changes: 64 additions & 0 deletions
64
tests/e2e-frontend/tests/serviceBrowser/leftFilters.spec.js
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,64 @@ | ||
/* eslint-disable no-undef */ | ||
|
||
const { test, expect } = require('@playwright/test'); | ||
|
||
import { LoginPage } from '../fixtures/loginPage'; | ||
|
||
import products from '../products.json'; | ||
import users from '../users.json'; | ||
|
||
const product = "osparc"; | ||
const productUrl = products[product]; | ||
const user = users[product][0]; | ||
|
||
test.describe.serial(`Left Filters:`, () => { | ||
let page = null; | ||
let loginPageFixture = null; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
|
||
const responsePromise = page.waitForResponse('**/services/-/latest**', { | ||
timeout: 30000 | ||
}); | ||
|
||
loginPageFixture = new LoginPage(page, productUrl); | ||
const role = await loginPageFixture.login(user.email, user.password); | ||
expect(role).toBe(user.role); | ||
|
||
await responsePromise; | ||
|
||
await page.getByTestId("servicesTabBtn").click(); | ||
}); | ||
|
||
test.afterAll(async ({ browser }) => { | ||
await loginPageFixture.logout(); | ||
await page.close(); | ||
await browser.close(); | ||
}); | ||
|
||
test(`Filters`, async () => { | ||
const sharedWithButtons = page.getByTestId("service-sharedWithFilterItem"); | ||
await expect(sharedWithButtons.first()).toBeVisible({ | ||
timeout: 30000 // it will take some time to load the Study Browser | ||
}); | ||
|
||
const countSharedWithButtons = await sharedWithButtons.count(); | ||
// All Services | ||
// My Services | ||
// Shared with Me | ||
// Shared with Everyone | ||
expect(countSharedWithButtons === 4).toBeTruthy(); | ||
|
||
|
||
const serviceTypeButtons = page.getByTestId("service-serviceTypeFilterItem"); | ||
await expect(serviceTypeButtons.first()).toBeVisible({ | ||
timeout: 30000 // it will take some time to load the Study Browser | ||
}); | ||
|
||
const countServiceTypeButtons = await serviceTypeButtons.count(); | ||
// Computational | ||
// Interactive | ||
expect(countServiceTypeButtons === 2).toBeTruthy(); | ||
}); | ||
}); |
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,88 @@ | ||
/* eslint-disable no-undef */ | ||
|
||
const { test, expect } = require('@playwright/test'); | ||
|
||
import { LoginPage } from '../fixtures/loginPage'; | ||
|
||
import products from '../products.json'; | ||
import users from '../users.json'; | ||
|
||
const servicesTabExposed = { | ||
"osparc": { | ||
"areServicesExposed": true, | ||
}, | ||
"s4l": { | ||
"areServicesExposed": true, | ||
}, | ||
"s4lacad": { | ||
"areServicesExposed": true, | ||
}, | ||
"s4llite": { | ||
"areServicesExposed": false, | ||
}, | ||
"tis": { | ||
"areServicesExposed": false, | ||
}, | ||
"tiplite": { | ||
"areServicesExposed": false, | ||
}, | ||
} | ||
|
||
for (const product in products) { | ||
expect(servicesTabExposed[product]).toBeDefined(); | ||
if (!servicesTabExposed[product]["areServicesExposed"]) { | ||
continue; | ||
} | ||
|
||
if (product in users) { | ||
const productUrl = products[product]; | ||
const productUsers = users[product]; | ||
for (const user of productUsers) { | ||
// expected roles for users: "USER" | ||
const role = "USER"; | ||
expect(user.role).toBe(role); | ||
|
||
test.describe.serial(`Main View: ${product}`, () => { | ||
let page = null; | ||
let loginPageFixture = null; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
|
||
const responsePromise = page.waitForResponse('**/services/-/latest**', { | ||
timeout: 30000 | ||
}); | ||
|
||
loginPageFixture = new LoginPage(page, productUrl); | ||
const role = await loginPageFixture.login(user.email, user.password); | ||
expect(role).toBe(user.role); | ||
|
||
const response = await responsePromise; | ||
const resp = await response.json(); | ||
expect("data" in resp && "_meta" in resp["data"] && "total" in resp["data"]["_meta"]); | ||
console.log("N Services in Response:", resp["data"]["_meta"]["total"]); | ||
|
||
await page.getByTestId("servicesTabBtn").click(); | ||
}); | ||
|
||
test.afterAll(async ({ browser }) => { | ||
await loginPageFixture.logout(); | ||
await page.close(); | ||
await browser.close(); | ||
}); | ||
|
||
test(`Services list`, async () => { | ||
const servicesList = page.getByTestId("servicesList"); | ||
await expect(servicesList).toBeVisible({ | ||
timeout: 30000 | ||
}); | ||
|
||
const serviceCards = servicesList.locator(':scope > *'); | ||
const count = await serviceCards.count(); | ||
console.log("N Services listed", count); | ||
expect(count > 0); | ||
}); | ||
}); | ||
} | ||
} | ||
} |
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