33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
55
6+ import { runOcc } from '@nextcloud/e2e-test-server'
67import { expect } from '@playwright/test'
78import { test } from '../../support/fixtures/admin-appstore-page.ts'
89import { handlePasswordConfirmation } from '../../support/utils/password-confirmation.ts'
9- import { runOcc } from '@nextcloud/e2e-test-server'
1010
1111test . describe ( 'Settings: App management' , ( ) => {
12- test . beforeEach ( async ( { page , appstorePage } ) => {
12+ test . beforeEach ( async ( { appstorePage } ) => {
1313 // Disable QA testing app if already enabled
1414 expect ( await runOcc ( [ 'app:disable' , 'testing' ] ) )
1515 . toMatch ( / ( N o s u c h a p p e n a b l e d | t e s t i n g .+ d i s a b l e d ) / )
@@ -19,22 +19,20 @@ test.describe('Settings: App management', () => {
1919
2020 // Open the installed apps page
2121 await appstorePage . openInstalledApps ( )
22-
22+
2323 // Wait for the apps table to load
2424 await appstorePage . appsTable ( ) . waitFor ( { state : 'visible' , timeout : 10000 } )
2525 } )
2626
2727 test ( 'Can enable an installed app' , async ( { page, appstorePage } ) => {
2828 // Intercept the enable app request
29- const enableRequest = page . waitForResponse (
30- ( response ) => response . url ( ) . includes ( '/ocs/v2.php/apps/appstore/api/v1/apps/enable' ) ,
31- )
29+ const enableRequest = page . waitForResponse ( ( response ) => response . url ( ) . includes ( '/ocs/v2.php/apps/appstore/api/v1/apps/enable' ) )
3230
3331 // Find and click the enable button for the QA testing app
3432 await expect ( appstorePage . appsTable ( ) ) . toBeVisible ( )
3533 const qaTestingRow = appstorePage . appRow ( 'QA testing' )
3634 await expect ( qaTestingRow ) . toBeVisible ( { timeout : 10000 } )
37-
35+
3836 await appstorePage . enableButton ( 'QA testing' ) . click ( { force : true } )
3937
4038 // Handle password confirmation if needed
@@ -57,15 +55,13 @@ test.describe('Settings: App management', () => {
5755
5856 test ( 'Can disable an installed app' , async ( { page, appstorePage } ) => {
5957 // Intercept the disable app request
60- const disableRequest = page . waitForResponse (
61- ( response ) => response . url ( ) . includes ( '/ocs/v2.php/apps/appstore/api/v1/apps/disable' ) ,
62- )
58+ const disableRequest = page . waitForResponse ( ( response ) => response . url ( ) . includes ( '/ocs/v2.php/apps/appstore/api/v1/apps/disable' ) )
6359
6460 // Find and click the disable button for the Update notification app
6561 await expect ( appstorePage . appsTable ( ) ) . toBeVisible ( )
6662 const updateRow = appstorePage . appRow ( 'Update notification' )
6763 await expect ( updateRow ) . toBeVisible ( { timeout : 10000 } )
68-
64+
6965 await appstorePage . disableButton ( 'Update notification' ) . click ( { force : true } )
7066
7167 // Handle password confirmation if needed
@@ -95,15 +91,15 @@ test.describe('Settings: App management', () => {
9591
9692 // Verify that there are only enabled apps (all have "Disable" button, no "Enable" button)
9793 await expect ( appstorePage . appsTable ( ) ) . toBeVisible ( )
98-
94+
9995 // Get all rows and verify each has a disable button and no enable button
10096 const rows = appstorePage . appsTable ( ) . locator ( 'tr' )
10197 const rowCount = await rows . count ( )
102-
103- for ( let i = 1 ; i < rowCount ; i ++ ) { // Skip header row
98+
99+ for ( let i = 1 ; i < rowCount ; i ++ ) { // Skip header row
104100 const row = rows . nth ( i )
105101 const enableButton = row . getByRole ( 'button' , { name : 'Enable' } )
106-
102+
107103 // Enabled apps should not have an "Enable" button
108104 await expect ( enableButton ) . not . toBeVisible ( )
109105 }
@@ -118,15 +114,15 @@ test.describe('Settings: App management', () => {
118114
119115 // Verify that there are only disabled apps (all have "Enable" button, no "Disable" button)
120116 await expect ( appstorePage . appsTable ( ) ) . toBeVisible ( )
121-
117+
122118 // Get all rows and verify each has an enable button and no disable button
123119 const rows = appstorePage . appsTable ( ) . locator ( 'tr' )
124120 const rowCount = await rows . count ( )
125-
126- for ( let i = 1 ; i < rowCount ; i ++ ) { // Skip header row
121+
122+ for ( let i = 1 ; i < rowCount ; i ++ ) { // Skip header row
127123 const row = rows . nth ( i )
128124 const disableButton = row . getByRole ( 'button' , { name : 'Disable' } )
129-
125+
130126 // Disabled apps should not have a "Disable" button
131127 await expect ( disableButton ) . not . toBeVisible ( )
132128 }
@@ -152,12 +148,12 @@ test.describe('Settings: App management', () => {
152148 const sidebar = appstorePage . appSidebar ( )
153149 await expect ( sidebar ) . toBeVisible ( )
154150 await expect ( appstorePage . appSidebarHeader ( ) ) . toContainText ( 'QA testing' )
155-
151+
156152 // Verify the sidebar contains expected elements
157153 await expect ( appstorePage . viewInStoreLink ( ) ) . toBeVisible ( )
158154 await expect ( appstorePage . appSidebarEnableButton ( ) ) . toBeVisible ( )
159155 await expect ( appstorePage . removeButton ( ) ) . toBeVisible ( )
160-
156+
161157 // Verify version information is displayed
162158 await expect ( appstorePage . versionText ( ) ) . toBeVisible ( )
163159 } )
0 commit comments