Skip to content

Commit 35e8bef

Browse files
committed
frontend/tests: automatically change relay server on test box.
1 parent ecb288a commit 35e8bef

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

frontend/tests/basic.spec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect, Page } from '@playwright/test';
2-
import { login, mailiskClient, mailiskNameSpace, testDomain, testPassword1, testPassword2, testUser1Email, testUser2, testUser2Email, testUserName1, testUserName2, testWallboxDomain, testWallboxUID } from './common';
2+
import { login, mailiskClient, mailiskNameSpace, needCustomCert, testDomain, testPassword1, testPassword2, testUser1Email, testUser2, testUser2Email, testUserName1, testUserName2, testWallboxDomain, testWallboxUID } from './common';
33

44
test('has title', async ({ page }) => {
55
await page.goto(testDomain);
@@ -35,6 +35,13 @@ test('charger lifecycle', async ({ page }) => {
3535
await page.goto(testWallboxDomain + '/#status');
3636
await page.getByRole('button', { name: 'System' }).click();
3737
await page.getByRole('button', { name: 'Remote Access' }).click();
38+
await page.getByRole('button', { name: 'Show' }).click();
39+
await page.getByLabel('Relay server hostnameTo').fill(testDomain.substring(8));
40+
if (needCustomCert) {
41+
await page.getByLabel('TLS cer­tif­i­cate', { exact: true }).selectOption('0');
42+
} else {
43+
await page.getByLabel('TLS cer­tif­i­cate', { exact: true }).selectOption('-1');
44+
}
3845
await page.getByRole('row', { name: 'of 5 users config­ured.' }).getByRole('button').click();
3946
await page.getByLabel('Email ad­dress').click();
4047
await page.getByLabel('Email ad­dress').fill(testUser1Email);

frontend/tests/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export const testUser2Email = `${testUser2}@${mailiskNameSpace}.mailisk.net`;
1616
export const testWallboxDomain = process.env.TEST_WALLBOX_DOMAIN;
1717
export const testWallboxUID = process.env.TEST_WALLBOX_UID;
1818

19+
export const needCustomCert = process.env.NEED_CUSTOM_CERT === "true";
20+
1921
export async function login(page: Page, email: string, password: string) {
2022
await page.goto(testDomain);
2123
await page.getByRole('textbox', { name: 'Email' }).click();

0 commit comments

Comments
 (0)