Skip to content

Commit af92383

Browse files
committed
chore(test): fixing format
Signed-off-by: xbabalov <t.babalova.17@gmail.com>
1 parent 166b681 commit af92383

File tree

4 files changed

+71
-60
lines changed

4 files changed

+71
-60
lines changed

.github/workflows/pr-check.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
DVLPR_PASSWORD: ${{ secrets.DVLPR_PASSWORD }}
154154
steps:
155155
- uses: actions/checkout@v4
156-
with:
156+
with:
157157
path: podman-desktop-sandbox-ext
158158

159159
# Install nodejs
@@ -197,7 +197,7 @@ jobs:
197197
- name: Execute yarn in Sandbox extension
198198
working-directory: ./podman-desktop-sandbox-ext
199199
run: yarn install
200-
200+
201201
- name: Build Sandbox extension from container file
202202
working-directory: ./podman-desktop-sandbox-ext
203203
run: |
@@ -213,7 +213,7 @@ jobs:
213213
working-directory: ./podman-desktop-sandbox-ext
214214
run: |
215215
rm -rf tests/playwright/output/sandbox-tests-pd/plugins/extension/node_modules/electron/dist/resources
216-
216+
217217
- name: Run E2E tests
218218
working-directory: ./podman-desktop-sandbox-ext
219219
env:
@@ -224,4 +224,4 @@ jobs:
224224
if: always()
225225
with:
226226
name: e2e-tests
227-
path: ./**/tests/**/output/
227+
path: ./**/tests/**/output/

tests/src/developer-sandbox.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const skipInstallation = process.env.SKIP_INSTALLATION === 'true';
4949
let browserOutputPath: string;
5050
let loginCommand = '';
5151
const resourceCardLabel = 'redhat.sandbox';
52+
const resourceName = 'Developer Sandbox';
5253
const contextName = 'dev-sandbox-context-3';
5354
const chromePort = '9222';
5455

@@ -165,7 +166,9 @@ test.describe.serial('Red Hat Developer Sandbox extension verification', () => {
165166
test.afterAll(async () => {
166167
if (browser) {
167168
console.log('Stopping tracing and closing browser...');
168-
await context?.tracing.stop({ path: join(path.join(browserOutputPath), 'traces', 'browser-sandbox-trace.zip') });
169+
await context?.tracing.stop({
170+
path: join(path.join(browserOutputPath), 'traces', 'browser-sandbox-trace.zip'),
171+
});
169172
if (chromiumPage) {
170173
await chromiumPage.close();
171174
}
@@ -180,7 +183,7 @@ test.describe.serial('Red Hat Developer Sandbox extension verification', () => {
180183
await settingsBar.resourcesTab.click();
181184
const resourcesPage = new ResourcesPage(page);
182185
playExpect(await resourcesPage.resourceCardIsVisible(resourceCardLabel)).toBeTruthy();
183-
await resourcesPage.goToCreateNewResourcePage(resourceCardLabel);
186+
await resourcesPage.goToCreateNewResourcePage(resourceName);
184187
const createResourcePage = new CreateResourcePage(page);
185188
await createResourcePage.logIntoSandboxButton.click();
186189
const websiteDialog = createResourcePage.content.getByRole('dialog', { name: 'Open External Website' });
@@ -234,13 +237,17 @@ test.describe.serial('Red Hat Developer Sandbox extension verification', () => {
234237
await usernameBox.focus();
235238

236239
//after login redirect twice to sandbox.redhat.com, same tab
237-
await performBrowserLogin(chromiumPage, /Log In/, usernameAction, passwordAction, async (chromiumPage) => {
240+
await performBrowserLogin(chromiumPage, /Log In/, usernameAction, passwordAction, async chromiumPage => {
238241
playExpect(chromiumPage).toBeDefined();
239242
if (!chromiumPage) {
240243
throw new Error('Chromium browser page was not initialized');
241244
}
242245
playExpect(await chromiumPage.title()).toBe('Developer Sandbox | Developer Sandbox');
243-
await chromiumPage.screenshot({ path: join(path.join(browserOutputPath), 'screenshots', 'after_login_in_browser.png'), type: 'png', fullPage: true });
246+
await chromiumPage.screenshot({
247+
path: join(path.join(browserOutputPath), 'screenshots', 'after_login_in_browser.png'),
248+
type: 'png',
249+
fullPage: true,
250+
});
244251
});
245252
});
246253
test('Fetch the login command', async () => {

tests/src/model/pages/create-resource-page.ts

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,52 @@
1717
***********************************************************************/
1818

1919
import type { Page, Locator } from '@playwright/test';
20-
import { BasePage, ResourcesPage, expect as playExpect } from '@podman-desktop/tests-playwright';;
20+
import { BasePage, ResourcesPage, expect as playExpect } from '@podman-desktop/tests-playwright';
2121

2222
export class CreateResourcePage extends BasePage {
23-
readonly heading: Locator;
24-
readonly content: Locator;
25-
readonly logIntoSandboxButton: Locator;
26-
readonly contextName: Locator;
27-
readonly setAsCurrentContext: Locator;
28-
readonly loginCommand: Locator;
29-
readonly closeButton: Locator;
30-
readonly createButton: Locator;
23+
readonly heading: Locator;
24+
readonly content: Locator;
25+
readonly logIntoSandboxButton: Locator;
26+
readonly contextName: Locator;
27+
readonly setAsCurrentContext: Locator;
28+
readonly loginCommand: Locator;
29+
readonly closeButton: Locator;
30+
readonly createButton: Locator;
3131

32-
constructor(page: Page) {
33-
super(page);
34-
this.heading = this.page.getByRole('heading', { name: 'Create Developer Sandbox' });
35-
this.content = this.page.getByRole('region', { name: 'Tab Content' });
36-
this.logIntoSandboxButton = this.page.getByRole('button', { name: 'Log into Developer Sandbox' });
37-
this.contextName = this.page.getByRole('textbox', { name: 'Context name' });
38-
this.setAsCurrentContext = this.page.getByRole('checkbox', { name: 'Set as current context' });
39-
this.loginCommand = this.page.getByRole('textbox', { name: 'Login command from Developer Console' });
40-
this.closeButton = this.page.getByRole('button', { name: 'Close page' });
41-
this.createButton = this.page.getByRole('button', { name: 'Create' });
42-
}
32+
constructor(page: Page) {
33+
super(page);
34+
this.heading = this.page.getByRole('heading', { name: 'Create Developer Sandbox' });
35+
this.content = this.page.getByRole('region', { name: 'Tab Content' });
36+
this.logIntoSandboxButton = this.page.getByRole('button', { name: 'Log into Developer Sandbox' });
37+
this.contextName = this.page.getByRole('textbox', { name: 'Context name' });
38+
this.setAsCurrentContext = this.page.getByRole('checkbox', { name: 'Set as current context' });
39+
this.loginCommand = this.page.getByRole('textbox', { name: 'Login command from Developer Console' });
40+
this.closeButton = this.page.getByRole('button', { name: 'Close page' });
41+
this.createButton = this.page.getByRole('button', { name: 'Create' });
42+
}
4343

44-
async createResource(loginCommandValue: string, contextNameValue?: string, setAsCurrentContextValue = false): Promise<ResourcesPage> {
45-
await this.loginCommand.fill(loginCommandValue);
44+
async createResource(
45+
loginCommandValue: string,
46+
contextNameValue?: string,
47+
setAsCurrentContextValue = false,
48+
): Promise<ResourcesPage> {
49+
await this.loginCommand.fill(loginCommandValue);
4650

47-
if (contextNameValue) {
48-
await this.contextName.fill(contextNameValue);
49-
}
51+
if (contextNameValue) {
52+
await this.contextName.fill(contextNameValue);
53+
}
5054

51-
if (setAsCurrentContextValue !== (await this.setAsCurrentContext.isChecked())) {
52-
await this.setAsCurrentContext.locator('..').click();
53-
playExpect(await this.setAsCurrentContext.isChecked()).toBe(setAsCurrentContextValue);
54-
}
55+
if (setAsCurrentContextValue !== (await this.setAsCurrentContext.isChecked())) {
56+
await this.setAsCurrentContext.locator('..').click();
57+
playExpect(await this.setAsCurrentContext.isChecked()).toBe(setAsCurrentContextValue);
58+
}
5559

56-
const successMessage = this.page.getByText('Successful operation');
57-
const goToResourcesButton = this.page.getByRole('button', { name: 'Go back to resources' });
58-
await playExpect(successMessage).toBeVisible();
59-
await playExpect(goToResourcesButton).toBeVisible();
60+
const successMessage = this.page.getByText('Successful operation');
61+
const goToResourcesButton = this.page.getByRole('button', { name: 'Go back to resources' });
62+
await playExpect(successMessage).toBeVisible();
63+
await playExpect(goToResourcesButton).toBeVisible();
6064

61-
await goToResourcesButton.click();
62-
return new ResourcesPage(this.page);
63-
}
64-
}
65+
await goToResourcesButton.click();
66+
return new ResourcesPage(this.page);
67+
}
68+
}

tests/tsconfig.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"compilerOptions": {
3-
"strictNullChecks": true,
4-
"lib": [ "ES2017", "webworker" ],
5-
"module": "esnext",
6-
"target": "esnext",
7-
"sourceMap": true,
8-
"rootDir": "src",
9-
"outDir": "dist",
10-
"skipLibCheck": true,
11-
"types": [ "node" ],
12-
"allowSyntheticDefaultImports": true,
13-
"moduleResolution": "Node",
14-
"esModuleInterop": true
15-
}
16-
}
2+
"compilerOptions": {
3+
"strictNullChecks": true,
4+
"lib": ["ES2017", "webworker"],
5+
"module": "esnext",
6+
"target": "esnext",
7+
"sourceMap": true,
8+
"rootDir": "src",
9+
"outDir": "dist",
10+
"skipLibCheck": true,
11+
"types": ["node"],
12+
"allowSyntheticDefaultImports": true,
13+
"moduleResolution": "Node",
14+
"esModuleInterop": true
15+
}
16+
}

0 commit comments

Comments
 (0)