Skip to content

Commit 41672d5

Browse files
authored
[tests-only] add e2e test for progress bars (#132)
* add e2e test for progress bars Signed-off-by: nabim777 <[email protected]> * lint fix Signed-off-by: nabim777 <[email protected]> * review addressed Signed-off-by: nabim777 <[email protected]> * review addresses Signed-off-by: nabim777 <[email protected]> --------- Signed-off-by: nabim777 <[email protected]>
1 parent 1df7449 commit 41672d5

File tree

5 files changed

+73
-0
lines changed

5 files changed

+73
-0
lines changed

.drone.star

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ APPS = [
2020
E2E_COVERED_APPS = [
2121
"draw-io",
2222
"unzip",
23+
"progress-bars",
2324
]
2425

2526
OCIS_URL = "https://ocis:9200"
@@ -343,6 +344,7 @@ def ocisService():
343344
"mkdir -p /apps",
344345
"mv packages/web-app-draw-io/dist /apps/draw-io",
345346
"mv packages/web-app-unzip/dist /apps/unzip",
347+
"mv packages/web-app-progress-bars/dist /apps/progress-bars",
346348
],
347349
"volumes": [
348350
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { test, Page, expect } from '@playwright/test'
2+
import { AccountPage } from '../../../../support/pages/accountPage'
3+
import { loginAsUser, logout } from '../../../../support/helpers/authHelper'
4+
5+
let adminPage: Page
6+
7+
test.beforeEach(async ({ browser }) => {
8+
const admin = await loginAsUser(browser, 'admin', 'admin')
9+
adminPage = admin.page
10+
})
11+
12+
test.afterEach(async () => {
13+
await logout(adminPage)
14+
})
15+
16+
test('select NyanCat progressBarOption on the account page', async () => {
17+
const accountPage = new AccountPage(adminPage)
18+
await accountPage.goToAccountPage()
19+
await accountPage.selectNyanCatProgressBarExtension()
20+
21+
const progressBarCurrent = await accountPage.progressBarCurrent.textContent()
22+
expect(progressBarCurrent).toEqual('Nyan Cat progress bar')
23+
})

packages/web-app-progress-bars/vite.config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ export default defineConfig({
1111
entryFileNames: 'progress-bars.js'
1212
}
1313
}
14+
},
15+
test: {
16+
exclude: ['**/e2e/**']
1417
}
1518
})

playwright.config.ts

+15
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ export default defineConfig({
6363
testDir: './packages/web-app-unzip/tests/e2e',
6464
use: { ...devices['Desktop Safari'], browserName: 'webkit', ignoreHTTPSErrors: true },
6565
},
66+
{
67+
name: 'progress-bars-chromium',
68+
testDir: './packages/web-app-progress-bars/tests/e2e',
69+
use: { ...devices['Desktop Chrome'], browserName: 'chromium', ignoreHTTPSErrors: true },
70+
},
71+
{
72+
name: 'progress-bars-firefox',
73+
testDir: './packages/web-app-progress-bars/tests/e2e',
74+
use: { ...devices['Desktop Firefox'], browserName: 'firefox', ignoreHTTPSErrors: true },
75+
},
76+
{
77+
name: 'progress-bars-webkit',
78+
testDir: './packages/web-app-progress-bars/tests/e2e',
79+
use: { ...devices['Desktop Safari'], browserName: 'webkit', ignoreHTTPSErrors: true },
80+
},
6681

6782
/* Test against mobile viewports. */
6883
// {

support/pages/accountPage.ts

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Locator, Page } from '@playwright/test'
2+
3+
export class AccountPage {
4+
readonly page: Page
5+
readonly accountMenuBtn: Locator
6+
readonly accountManageBtn: Locator
7+
readonly progressBarSelector: Locator
8+
readonly progressBarCurrent: Locator
9+
readonly nyanCatProgressBarOption: Locator
10+
11+
constructor(page: Page) {
12+
this.page = page
13+
this.accountMenuBtn = this.page.locator('.oc-topbar-avatar')
14+
this.accountManageBtn = this.page.locator('#oc-topbar-account-manage')
15+
16+
this.progressBarSelector = this.page.locator('.extension-preference .vs__search')
17+
this.progressBarCurrent = this.page.locator('.extension-preference .vs__selected span')
18+
this.nyanCatProgressBarOption = this.page.getByText('Nyan Cat progress bar')
19+
}
20+
21+
async goToAccountPage() {
22+
await this.accountMenuBtn.click()
23+
await this.accountManageBtn.click()
24+
}
25+
26+
async selectNyanCatProgressBarExtension(){
27+
await this.progressBarSelector.click()
28+
await this.nyanCatProgressBarOption.click()
29+
}
30+
}

0 commit comments

Comments
 (0)