Skip to content

Commit

Permalink
Feature/form input required (#764)
Browse files Browse the repository at this point in the history
* Making form fields required

Signed-off-by: Aaron Chong <[email protected]>

* Basic checks for each task description to allow submission

Signed-off-by: Aaron Chong <[email protected]>

* Fix e2e tests, select coe for patrol explicitly

Signed-off-by: Aaron Chong <[email protected]>

* Splitting interface and refactoring validity check

Signed-off-by: Aaron Chong <[email protected]>

* Delivery quantity to positive int field, and sku to text field, monitor null or empty value

Signed-off-by: Aaron Chong <[email protected]>

* Disable submit when clean zone is removed

Signed-off-by: Aaron Chong <[email protected]>

---------

Signed-off-by: Aaron Chong <[email protected]>
  • Loading branch information
aaronchongth committed Sep 8, 2023
1 parent 3388e03 commit 8a4415e
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,37 @@ describe('submit task', () => {
const appBar = await getAppBar();
await (await appBar.$('button[aria-label="System Overview"]')).click();
await (await appBar.$('button[aria-label="new task"]')).click();
await (await $('#task-type')).click();
const getPatrolOption = async () => {
const options = await $$('[role=option]');
for (const opt of options) {
const text = await opt.getText();
if (text === 'Patrol') {
return opt;
}
}
return null;
};
await browser.waitUntil(async () => !!(await getPatrolOption()));
const patrolOption = (await getPatrolOption())!;
await patrolOption.click();

await (await $('#place-input')).click();
const getCoeOption = async () => {
const options = await $$('[role=option]');
for (const opt of options) {
const text = await opt.getText();
if (text === 'coe') {
return opt;
}
}
return null;
};
await browser.waitUntil(async () => !!(await getCoeOption()));
const coeOption = (await getCoeOption())!;
await coeOption.click();

await (await $('button[aria-label="Submit Now"]')).click();
await expect($('div=Successfully created task')).toBeDisplayed();
});
}).timeout(60000);
});
15 changes: 14 additions & 1 deletion packages/dashboard-e2e/tests/ui-interactions/submit-task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ describe('submit task', () => {
const patrolOption = (await getPatrolOption())!;
await patrolOption.click();

await (await $('#place-input')).setValue('coe');
await (await $('#place-input')).click();
const getCoeOption = async () => {
const options = await $$('[role=option]');
for (const opt of options) {
const text = await opt.getText();
if (text === 'coe') {
return opt;
}
}
return null;
};
await browser.waitUntil(async () => !!(await getCoeOption()));
const coeOption = (await getCoeOption())!;
await coeOption.click();

await (await $('button[aria-label="Submit Now"]')).click();
await expect($('div=Successfully created task')).toBeDisplayed();
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/form-inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function PositiveIntField({ value = 0, onChange, ...props }: PositiveIntF
{...props}
type="number"
value={valueInput}
inputProps={{ min: 0 }}
inputProps={{ min: 1 }}
onKeyDown={(ev) => {
if ('-+.'.indexOf(ev.key) >= 0) {
ev.preventDefault();
Expand Down
Loading

0 comments on commit 8a4415e

Please sign in to comment.