Skip to content

Commit f25d299

Browse files
feat: make cli close revert config optional (#1)
1 parent db931f9 commit f25d299

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

src/page-objects/_browser.page.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
import type {Browser, BrowserContext, Page} from '@playwright/test';
2-
import {TestPage} from './_page';
32

43
export interface BrowserPageParams {
54
page: Page;
65
context: BrowserContext;
76
browser: Browser;
87
}
98

10-
export abstract class BrowserPage extends TestPage {
9+
export abstract class BrowserPage {
1110
protected readonly page: Page;
1211
protected readonly context: BrowserContext;
1312
protected readonly browser: Browser;
1413

1514
protected constructor({page, context, browser}: BrowserPageParams) {
16-
super();
17-
1815
this.page = page;
1916
this.context = context;
2017
this.browser = browser;
2118
}
2219

23-
/**
24-
* @override
25-
*/
2620
async close(): Promise<void> {
2721
await this.page.close();
2822
}

src/page-objects/_page.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/page-objects/cli.page.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {execute, spawn} from '@junobuild/cli-tools';
44
import {statSync} from 'node:fs';
55
import {readdir, readFile, writeFile} from 'node:fs/promises';
66
import {join} from 'node:path';
7-
import {TestPage} from './_page';
87

98
const DEV = (process.env.NODE_ENV ?? 'production') === 'development';
109

@@ -22,12 +21,10 @@ export interface CliPageParams {
2221
satelliteId: PrincipalText;
2322
}
2423

25-
export class CliPage extends TestPage {
24+
export class CliPage {
2625
#satelliteId: PrincipalText;
2726

2827
private constructor({satelliteId}: CliPageParams) {
29-
super();
30-
3128
this.#satelliteId = satelliteId;
3229
}
3330

@@ -214,11 +211,11 @@ export class CliPage extends TestPage {
214211
return {accessKey: accessKey.trim()};
215212
}
216213

217-
/**
218-
* @override
219-
*/
220-
async close(): Promise<void> {
221-
await this.revertConfig();
214+
async close({revertConfig}: {revertConfig: boolean} = {revertConfig: true}): Promise<void> {
215+
if (revertConfig) {
216+
await this.revertConfig();
217+
}
218+
222219
await this.logout();
223220
}
224221
}

0 commit comments

Comments
 (0)