-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathplan-resources.test.ts
More file actions
58 lines (51 loc) · 2.09 KB
/
plan-resources.test.ts
File metadata and controls
58 lines (51 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import test, { expect, type BrowserContext, type Page } from '@playwright/test';
import { Constraints } from '../fixtures/Constraints.js';
import { Models } from '../fixtures/Models.js';
import { Plan } from '../fixtures/Plan.js';
import { Plans } from '../fixtures/Plans.js';
import { SchedulingConditions } from '../fixtures/SchedulingConditions.js';
import { SchedulingGoals } from '../fixtures/SchedulingGoals.js';
let constraints: Constraints;
let context: BrowserContext;
let models: Models;
let page: Page;
let plan: Plan;
let plans: Plans;
let schedulingConditions: SchedulingConditions;
let schedulingGoals: SchedulingGoals;
test.beforeAll(async ({ baseURL, browser }) => {
context = await browser.newContext();
page = await context.newPage();
models = new Models(page);
plans = new Plans(page, models);
constraints = new Constraints(page);
schedulingConditions = new SchedulingConditions(page);
schedulingGoals = new SchedulingGoals(page);
plan = new Plan(page, plans, constraints, schedulingGoals, schedulingConditions);
await models.goto();
await models.createModel(baseURL);
await plans.goto();
await plans.createPlan();
await plan.goto();
});
test.afterAll(async () => {
await plans.goto();
await plans.deletePlan();
await models.goto();
await models.deleteModel();
await page.close();
await context.close();
});
test.describe.serial('Plan Resources', () => {
test('Uploading external plan dataset file - JSON', async () => {
await plan.uploadExternalDatasets('e2e-tests/data/external-dataset.json');
await expect(plan.panelActivityTypes.getByText('/awake')).toBeVisible();
await expect(plan.panelActivityTypes.getByText('/batteryEnergy')).toBeVisible();
});
test('Uploading external plan dataset file - CSV', async () => {
await plan.uploadExternalDatasets('e2e-tests/data/external-dataset.csv');
await expect(plan.panelActivityTypes.getByText('TotalPower')).toBeVisible();
await expect(plan.panelActivityTypes.getByText('BatteryStateOfCharge')).toBeVisible();
await expect(plan.panelActivityTypes.getByText('Temperature')).toBeVisible();
});
});