Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wde field #1947

Merged
merged 70 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
36042f1
initial commit
frontend-specialisten Jul 9, 2023
bdb439b
style: format
github-actions[bot] Jul 9, 2023
96d891c
Chore: bump version to 0.3.299 for build/infrastructure/eo/chart/valu…
github-actions[bot] Jul 9, 2023
0492d8c
Chore: bump version to 0.3.299 for build/infrastructure/eo/chart/Char…
github-actions[bot] Jul 9, 2023
731bf71
fix(eo, transfers): remove unused imports
frontend-specialisten Jul 11, 2023
becca05
Merge branch 'main' into preview/1609-overlapping-dates
frontend-specialisten Jul 11, 2023
15ec9bd
feat(eo, transfers): enable submit when the form is invalid
frontend-specialisten Jul 11, 2023
a105bab
Merge branch 'preview/1609-overlapping-dates' of https://github.com/E…
frontend-specialisten Jul 11, 2023
bad1338
style: format
github-actions[bot] Jul 11, 2023
516e060
Chore: bump version to 0.3.300 for build/infrastructure/eo/chart/Char…
github-actions[bot] Jul 11, 2023
791f32c
Chore: bump version to 0.3.300 for build/infrastructure/eo/chart/valu…
github-actions[bot] Jul 11, 2023
0b4c5c2
feat(eo, transfers): add fallback value for no end date
frontend-specialisten Jul 11, 2023
86bdfc1
Merge branch 'main' into preview/1609-overlapping-dates
frontend-specialisten Jul 11, 2023
63f27f3
initial commit
frontend-specialisten Jul 14, 2023
ee2468e
Merge branch 'preview/1609-overlapping-dates' of https://github.com/E…
frontend-specialisten Jul 14, 2023
119763f
style: format
github-actions[bot] Jul 14, 2023
665bfde
Chore: bump version to 0.3.301 for build/infrastructure/eo/chart/valu…
github-actions[bot] Jul 14, 2023
153f2e0
Chore: bump version to 0.3.301 for build/infrastructure/eo/chart/Char…
github-actions[bot] Jul 14, 2023
9f58889
refactor(eo, transfers): clean-up
frontend-specialisten Jul 14, 2023
ffd8d66
Merge branch 'preview/1609-overlapping-dates' of https://github.com/E…
frontend-specialisten Jul 14, 2023
1867d29
style: format
github-actions[bot] Jul 14, 2023
46610b2
fix(eo, transfers): dont set disableHours or selectedDate on edit
frontend-specialisten Jul 14, 2023
6d05aa5
style: format
github-actions[bot] Jul 14, 2023
1f48287
dummy change
frontend-specialisten Jul 14, 2023
90e925a
Merge branch 'preview/fe-1609-overlapping-dates' of https://github.co…
frontend-specialisten Jul 14, 2023
ebcb778
remove dummy change
frontend-specialisten Jul 14, 2023
4969c02
fix(eo, transfers): don't show error on empty list
frontend-specialisten Jul 17, 2023
fbce73d
style: format
github-actions[bot] Jul 17, 2023
d5fae26
fix(watt, shell): add z-index to .watt-toolbar
frontend-specialisten Jul 17, 2023
9529330
fix(eo, e2e-eo): fix missing step definitions
frontend-specialisten Jul 18, 2023
8ff3431
clean-up
frontend-specialisten Jul 18, 2023
e322b31
refactor(eo, e2e-eo): make shared login step defs
frontend-specialisten Jul 18, 2023
5bad496
feat(eo, transfers): overlapping error of "no end date" is added to h…
frontend-specialisten Jul 18, 2023
658cb8f
style: format
github-actions[bot] Jul 18, 2023
dd8d84c
style(watt): set correct font-weight on radio buttons
frontend-specialisten Jul 19, 2023
583e678
refactor(eo, transfers): optimized styles for form
frontend-specialisten Jul 19, 2023
6a08fee
refactor(eo, transfers): move form and timepicker
frontend-specialisten Jul 19, 2023
e93e1e0
refactor(eo, transfers): make ready for steps
frontend-specialisten Jul 27, 2023
2a8845c
feat(eo, transfers): add stepper for create
frontend-specialisten Jul 28, 2023
7bc6b90
chore: add license
github-actions[bot] Jul 28, 2023
b59837b
style: format
github-actions[bot] Jul 28, 2023
21b8c15
add wde field
sahma19 Aug 10, 2023
a1f93bb
style: format
github-actions[bot] Aug 10, 2023
49668fb
Chore: bump version to 0.3.315 for build/infrastructure/eo/chart/Char…
github-actions[bot] Aug 10, 2023
e1284ea
Chore: bump version to 0.3.315 for build/infrastructure/eo/chart/valu…
github-actions[bot] Aug 10, 2023
59a785f
Refactored for less cognitive complexity
sahma19 Aug 10, 2023
e9f6eb7
Merge remote-tracking branch 'origin/preview/fe_1591_ta_to_take_wde' …
sahma19 Aug 10, 2023
a6ce203
style: format
github-actions[bot] Aug 10, 2023
3c83b97
Adjusted e2e test
sahma19 Aug 10, 2023
047f9ae
Merge remote-tracking branch 'origin/preview/fe_1591_ta_to_take_wde' …
sahma19 Aug 10, 2023
3bb11a9
style: format
github-actions[bot] Aug 10, 2023
194a913
Adjusted e2e test again
sahma19 Aug 10, 2023
a6c4d7e
Merge remote-tracking branch 'origin/preview/fe_1591_ta_to_take_wde' …
sahma19 Aug 10, 2023
845af82
style: format
github-actions[bot] Aug 10, 2023
9715036
Merge branch 'preview/fe-1609-overlapping-dates' into preview/fe_1591…
sahma19 Aug 14, 2023
5fa7edb
Layout
sahma19 Aug 14, 2023
570c120
Merge branch 'main' into preview/fe_1591_ta_to_take_wde
sahma19 Aug 14, 2023
26bad9f
merge with main, plus layout fix
sahma19 Aug 14, 2023
f861065
style: format
github-actions[bot] Aug 14, 2023
4bc827d
Chore: bump version to 0.3.316 for build/infrastructure/eo/chart/Char…
github-actions[bot] Aug 14, 2023
28ea12d
Chore: bump version to 0.3.316 for build/infrastructure/eo/chart/valu…
github-actions[bot] Aug 14, 2023
bb8bdf2
modified tests to fit new layout
sahma19 Aug 15, 2023
6691cf6
chore: add license
github-actions[bot] Aug 15, 2023
979328b
style: format
github-actions[bot] Aug 15, 2023
6ce8abe
Merge branch 'main' into preview/fe_1591_ta_to_take_wde
sahma19 Aug 15, 2023
1d13b35
Added padding on logout notice
sahma19 Aug 15, 2023
05b166e
Merge remote-tracking branch 'origin/preview/fe_1591_ta_to_take_wde' …
sahma19 Aug 15, 2023
7261aad
Adjusted text
sahma19 Aug 15, 2023
f9dc107
Adjusted text for create button and adjusted test
sahma19 Aug 15, 2023
6e5cf34
increased width of receiver form
sahma19 Aug 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/eo/e2e-eo/.cypress-cucumber-preprocessorrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"stepDefinitions": [
"src/e2e/[filepath].ts",
"src/e2e/[filepart]/**/*.ts",
"src/e2e/login/**/*.ts"
]
}
14 changes: 2 additions & 12 deletions apps/eo/e2e-eo/src/e2e/dashboard/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
import { DashboardPo, LandingPagePO, LoginPo, SharedPO } from '../../page-objects';
import { Then, When } from '@badeball/cypress-cucumber-preprocessor';
import { DashboardPo } from '../../page-objects';

const dashboard = new DashboardPo();
const landingPage = new LandingPagePO();
const login = new LoginPo();
const shared = new SharedPO();

Given('I am logged in as Charlotte CSR', () => {
landingPage.navigateTo();
shared.clickOnlyNecessaryButton(); // To get rid of Cookie Consent banner
landingPage.clickLoginButton();
login.clickCharlotteLogin();
});

When('I am on the dashboard page', () => {
dashboard.urlIsDashboardPage();
Expand Down
7 changes: 7 additions & 0 deletions apps/eo/e2e-eo/src/e2e/login/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ Given('I am on the landing page', () => {
landingPage.headerIsVisible();
});

Given('I am logged in as Charlotte CSR', () => {
landingPage.navigateTo();
shared.clickOnlyNecessaryButton(); // To get rid of Cookie Consent banner
landingPage.clickLoginButton();
login.clickCharlotteLogin();
});

When('I click the first start button to login', () => {
landingPage.clickLoginButton();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: Create transfer agreement

Scenario: Charlotte CSR can create a new transfer agreement
tnickelsen marked this conversation as resolved.
Show resolved Hide resolved
Given I am logged in as Charlotte CSR
When I go to the transfers page
And I click on the new transfer agreement button
And I can see a modal to create a new agreement
And I enter details for a transfer agreement
And I click create transfer agreement
And I can see the modal to create a new agreement has closed
Then I can see the new agreement in the table on the transfers page
48 changes: 48 additions & 0 deletions apps/eo/e2e-eo/src/e2e/transfers/create-transfer-agreement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @license
* Copyright 2020 Energinet DataHub A/S
*
* Licensed under the Apache License, Version 2.0 (the "License2");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Then, When } from '@badeball/cypress-cucumber-preprocessor';
import { TransfersPo } from '../../page-objects/transfers.po';

const transfers = new TransfersPo();

When('I click on the new transfer agreement button', () => {
tnickelsen marked this conversation as resolved.
Show resolved Hide resolved
transfers.clickNewAgreementButton();
});

When('I enter details for a transfer agreement', () => {
transfers.enterDetailsForNewAgreement();
});

When('I click create transfer agreement', () => {
transfers.clickCreateAgreementButton();
});

When('I can see a modal to create a new agreement', () => {
transfers.newAgreementModalIsVisible();
});

Then('I can see the new agreement in the table on the transfers page', () =>
transfers.newlyCreatedAgreementIsVisible()
);

Then('I can see the modal to create a new agreement has closed', () =>
transfers.newAgreementModalIsNotOnScreen()
);

Then('I can close the new agreement modal', () => {
transfers.clickCloseNewAgreementModalButton();
});
23 changes: 14 additions & 9 deletions apps/eo/e2e-eo/src/e2e/transfers/transfers.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ Feature: Transfers Page
And I can see the table has a paginator
And I can see a button to create a new agreement

Scenario: Charlotte CSR can create a new transfer agreement
Given I am logged in as Charlotte CSR
When I go to the transfers page
And I click on the new transfer agreement button
And I can see a modal to create a new agreement
And I enter details for a transfer agreement
And I click create transfer agreement
And I can see the modal to create a new agreement has closed
Then I can see the new agreement in the table on the transfers page
Scenario: Charlotte CSR has no transfer agreements
Given I am logged in as Charlotte CSR
When I go to the transfers page
And I don't have any existing transfer agreements
Then I can see a message that I have no transfer agreements
And I see no loading indicators
And I see no errors

Scenario: Fetching transfer agreements fails
Given I am logged in as Charlotte CSR
And the API for transfer agreements is down
When I go to the transfers page
Then I can see a general error message
And I see no loading indicators
53 changes: 22 additions & 31 deletions apps/eo/e2e-eo/src/e2e/transfers/transfers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
import { LandingPagePO, LoginPo, SharedPO } from '../../page-objects';
import { Then, When } from '@badeball/cypress-cucumber-preprocessor';
import { SharedPO } from '../../page-objects';
import { TransfersPo } from '../../page-objects/transfers.po';

const transfers = new TransfersPo();
const landingPage = new LandingPagePO();
const login = new LoginPo();
const shared = new SharedPO();

Given('I am logged in as Charlotte CSR', () => {
landingPage.navigateTo();
shared.clickOnlyNecessaryButton(); // To get rid of Cookie Consent banner
landingPage.clickLoginButton();
login.clickCharlotteLogin();
});

When('I go to the transfers page', () => {
shared.clickTransfersMenuItem();
transfers.urlIsTransfersPage();
transfers.headerIsVisible();
});

When('I click on the new transfer agreement button', () => {
transfers.clickNewAgreementButton();
});

When('I enter details for a transfer agreement', () => {
transfers.enterDetailsForNewAgreement();
});

When('I click create transfer agreement', () => {
transfers.clickCreateAgreementButton();
When('the API for transfer agreements is down', () => {
cy.intercept('GET', 'https://demo.energioprindelse.dk/api/transfer-agreements', {
statusCode: 500,
});
});

When('I can see a modal to create a new agreement', () => {
transfers.newAgreementModalIsVisible();
When("I don't have any existing transfer agreements", () => {
cy.intercept('GET', 'https://demo.energioprindelse.dk/api/transfer-agreements', {
statusCode: 204,
});
});

Then('I can see a header text in the table card', () => transfers.cardHeaderIsVisible());
Expand All @@ -60,14 +47,18 @@ Then('I can see the table has a paginator', () => transfers.paginatorIsVisible()

Then('I can see a button to create a new agreement', () => transfers.newAgreementButtonIsVisible());

Then('I can see the new agreement in the table on the transfers page', () =>
transfers.newlyCreatedAgreementIsVisible()
);
Then('I can see a message that I have no transfer agreements', () => {
transfers.noTransferAgreementsTextIsVisible();
});

Then('I can see the modal to create a new agreement has closed', () =>
transfers.newAgreementModalIsNotOnScreen()
);
Then('I see no loading indicators', () => {
transfers.loadingTransferAgreementsIndicatorIsNotVisible();
});

Then('I can see a general error message', () => {
transfers.generalErrorIsVisible();
});

Then('I can close the new agreement modal', () => {
transfers.clickCloseNewAgreementModalButton();
Then('I see no errors', () => {
transfers.generalErrorIsNotVisible();
});
17 changes: 17 additions & 0 deletions apps/eo/e2e-eo/src/page-objects/transfers.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ export class TransfersPo {
private newAgreementDateRangeStartInput = '[data-testid="new-agreement-start-date-input"]';
private newAgreementDateRangeEndInput = '[data-testid="new-agreement-end-date-input"]';
private newAgreementReceiverInput = '[data-testid="new-agreement-receiver-input"]';
private walletDepositEndpointInput = '[data-testid="wallet-deposit-endpoint-input"]';
private testBase64EncodedWalletDepositEndpoint =
'eyJFbmRwb2ludCI6Imh0dHA6Ly9sb2NhbGhvc3Q6Nzg5MC8iLCJQdWJsaWNLZXkiOiJBVTBWVFVzQUFBQUJ5aE5KRmxENlZhVUZPajRGRzcybmVkSmxVbDRjK0xVejdpV0tRNEkzM1k0Q2J5OVBQTm5SdXRuaWUxT1NVRS9ud0RWTWV3bW14TnFFTkw5a0RZeHdMQWs9IiwiVmVyc2lvbiI6MX0=';
duizer marked this conversation as resolved.
Show resolved Hide resolved
private paginator = '[data-testid="table-paginator"]';
private testReceiverId = '11111111';
private testStartDate = '12052023';
private testEndDate = '14052023';
private noTransferAgreementsText = 'You do not have any transfer agreements to show right now.';
private loadingTransferAgreementsIndicator = '.watt-table-loading-cell';
private generalErrorMessage = 'eo-popup-message';

// Visibility
headerIsVisible = () => cy.get('h2').should('contain.text', this.pageHeaderText);
Expand All @@ -42,6 +48,14 @@ export class TransfersPo {
newAgreementModalIsNotOnScreen = () => cy.get(this.newAgreementModal).should('not.exist');
newlyCreatedAgreementIsVisible = () =>
cy.get(this.transfersTable).should('contain', this.testReceiverId);
generalErrorIsVisible = () => cy.get(this.generalErrorMessage).should('be.visible');
generalErrorIsNotVisible = () => cy.get(this.generalErrorMessage).should('not.exist');
noTransferAgreementsTextIsVisible = () =>
cy.get('p').should('contain', this.noTransferAgreementsText);
loadingTransferAgreementsIndicatorIsVisible = () =>
cy.get(this.loadingTransferAgreementsIndicator).should('be.visible');
loadingTransferAgreementsIndicatorIsNotVisible = () =>
cy.get(this.loadingTransferAgreementsIndicator).should('not.exist');

// Interaction
clickNewAgreementButton() {
Expand All @@ -53,6 +67,7 @@ export class TransfersPo {
cy.get(this.newAgreementDateRangeStartInput).type(this.testStartDate);
cy.get(this.newAgreementHasEndDate).click();
cy.get(this.newAgreementDateRangeEndInput).type(this.testEndDate);
cy.get(this.walletDepositEndpointInput).type(this.testBase64EncodedWalletDepositEndpoint);
}

clickCreateAgreementButton() {
Expand All @@ -65,6 +80,8 @@ export class TransfersPo {
senderName: 'Producent A/S',
senderTin: '11223344',
receiverTin: '11111111',
Base64EncodedWalletDepositEndpoint:
'eyJFbmRwb2ludCI6Imh0dHA6Ly9sb2NhbGhvc3Q6Nzg5MC8iLCJQdWJsaWNLZXkiOiJBVTBWVFVzQUFBQUJ5aE5KRmxENlZhVUZPajRGRzcybmVkSmxVbDRjK0xVejdpV0tRNEkzM1k0Q2J5OVBQTm5SdXRuaWUxT1NVRS9ud0RWTWV3bW14TnFFTkw5a0RZeHdMQWs9IiwiVmVyc2lvbiI6MX0=',
},
});
cy.get(this.createNewAgreementButton).click();
Expand Down
2 changes: 1 addition & 1 deletion build/infrastructure/eo/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: eo-frontend
description: A Helm chart for Kubernetes
type: application
version: 0.3.315
version: 0.3.316
2 changes: 1 addition & 1 deletion build/infrastructure/eo/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ app:
replicaCount: 2
image:
name: ghcr.io/energinet-datahub/eo-frontend-app
tag: 0.3.315
tag: 0.3.316
64 changes: 35 additions & 29 deletions libs/eo/transfers/src/lib/eo-transfers-create-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ import {
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import { getUnixTime } from 'date-fns';
import { RxPush } from '@rx-angular/template/push';

import { WATT_MODAL, WattModalComponent } from '@energinet-datahub/watt/modal';
import { WattValidationMessageComponent } from '@energinet-datahub/watt/validation-message';

import { EoTransfersService } from './eo-transfers.service';
import { EoTransfersStore } from './eo-transfers.store';
import { EoTransfersFormComponent } from './eo-transfers-form.component';
import { EoExistingTransferAgreement, EoTransfersStore } from './eo-transfers.store';
import { EoTransfersFormComponent } from './form/eo-transfers-form.component';
import { EoAuthStore } from '@energinet-datahub/eo/shared/services';
import { Observable, of } from 'rxjs';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down Expand Up @@ -60,6 +60,8 @@ import { EoAuthStore } from '@energinet-datahub/eo/shared/services';

<eo-transfers-form
[senderTin]="authStore.getTin$ | push"
[existingTransferAgreements]="existingTransferAgreements$ | push"
(receiverTinChanged)="onReceiverTinChange($event)"
(submitted)="createAgreement($event)"
(canceled)="modal.close(false)"
></eo-transfers-form>
Expand All @@ -73,6 +75,7 @@ export class EoTransfersCreateModalComponent {
protected creatingTransferAgreementFailed = false;
protected isFormValid = false;
protected opened = false;
protected existingTransferAgreements$: Observable<EoExistingTransferAgreement[]> = of([]);

constructor(
private service: EoTransfersService,
Expand All @@ -92,36 +95,39 @@ export class EoTransfersCreateModalComponent {

onClosed() {
this.opened = false;
this.existingTransferAgreements$ = of([]);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
createAgreement(transferAgreement: any) {
const { receiverTin, startDate, startDateTime, endDate, endDateTime } = transferAgreement;
if (!receiverTin || !startDate || !startDateTime) return;
onReceiverTinChange(receiverTin: string | null) {
this.existingTransferAgreements$ = this.store.getExistingTransferAgreements$(receiverTin);
}

createAgreement(transferAgreement: {
receiverTin: string;
base64EncodedWalletDepositEndpoint: string;
period: { startDate: number; endDate: number | null; hasEndDate: boolean };
}) {
const { receiverTin, base64EncodedWalletDepositEndpoint, period } = transferAgreement;
const { startDate, endDate } = period;

const transfer = {
startDate: getUnixTime(new Date(startDate).setHours(parseInt(startDateTime), 0, 0, 0)),
endDate:
endDate && endDateTime
? getUnixTime(new Date(endDate).setHours(parseInt(endDateTime), 0, 0, 0))
: null,
receiverTin,
};
if (!receiverTin || !startDate) return;

this.creatingTransferAgreement = true;
this.service.createAgreement(transfer).subscribe({
next: (transfer) => {
this.store.addTransfer(transfer);
this.creatingTransferAgreement = false;
this.creatingTransferAgreementFailed = false;
this.cd.detectChanges();
this.modal.close(true);
},
error: () => {
this.creatingTransferAgreement = false;
this.creatingTransferAgreementFailed = true;
this.cd.detectChanges();
},
});
this.service
.createAgreement({ receiverTin, base64EncodedWalletDepositEndpoint, startDate, endDate })
.subscribe({
next: (transfer) => {
this.store.addTransfer(transfer);
this.creatingTransferAgreement = false;
this.creatingTransferAgreementFailed = false;
this.cd.detectChanges();
this.modal.close(true);
},
error: () => {
this.creatingTransferAgreement = false;
this.creatingTransferAgreementFailed = true;
this.cd.detectChanges();
},
});
}
}
1 change: 0 additions & 1 deletion libs/eo/transfers/src/lib/eo-transfers-drawer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ export class EoTransfersDrawerComponent {
}

onClose() {
this.drawer.close();
this.closed.emit();
}
}
Loading
Loading