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

Feature/ae 2317 add UI representation for new states #565

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ad1af7f
AE-2282: Add comment about oikeellisuuden valvonta liite destruction
solita-juhohaa Oct 22, 2024
48fb1ed
AE-2282: Keep the energiatodistus version when anonymizing
solita-juhohaa Oct 22, 2024
4247496
AE-2282: Refactor vo toimenpide publishing to optionally not send emails
solita-juhohaa Oct 22, 2024
70de989
AE-2316: Add new tila id to energiatodistus for expiration
solita-juhohaa Oct 24, 2024
e8deb2b
AE-2316: Add functionality to make the energiatodistus vanhentunut
solita-juhohaa Oct 24, 2024
e0189c1
AE-2317: Add capability to call database in e2e tests
solita-juhohaa Oct 25, 2024
efcbdea
AE-2317: Add capability to call backend from e2e test
solita-juhohaa Oct 25, 2024
371dae7
AE-2317: Add e2e test to test effects of destroying expired todistukset
solita-juhohaa Oct 25, 2024
98fe3c6
AE-2317: Refactor backendUrl into config
solita-juhohaa Oct 28, 2024
3db98ce
AE-2317: Add two new energiatodistus to test data that are expired
solita-juhohaa Oct 28, 2024
a9e338a
AE-2317: Fix broken e2e tests by obtaining a specific energiatodistus
solita-juhohaa Oct 28, 2024
7b4b8e9
AE-2317: Make laatija not see destroyed energiatodistus
solita-juhohaa Oct 28, 2024
f8243d5
AE-2317: Fix format
solita-juhohaa Oct 28, 2024
a7140c7
AE-2317: Adjust visibility of destroyed and expired energiatodistukset
solita-juhohaa Oct 28, 2024
25f3bc6
AE-2317: Rename file
solita-juhohaa Oct 28, 2024
0cd82fa
AE-2317: Wait naively for the expiration to run
solita-juhohaa Oct 28, 2024
0f7ab3a
AE-2317: Ensure the tasks are run sequentially
solita-juhohaa Oct 29, 2024
9cdfc05
AE-2316: Add e2e test for public site to check the visibility of expi…
solita-juhohaa Oct 29, 2024
4ed9b4f
AE-2316: Remove headers from public's e2e test case
solita-juhohaa Oct 29, 2024
3f625e7
AE-2316: Remove querying the database from e2e tests
solita-juhohaa Oct 29, 2024
5423e84
AE-2316: Fix typos
solita-juhohaa Oct 29, 2024
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
29 changes: 27 additions & 2 deletions e2e-tests/cypress/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
const { defineConfig } = require('cypress');
const pg = require('pg');

module.exports = defineConfig({
viewportHeight: 900,
viewportWidth: 1440,
defaultCommandTimeout: 15000,
video: true,
e2e: {
setupNodeEvents(on, config) {},
baseUrl: 'https://localhost:3009'
backendUrl: 'http://localhost:3444',
publicUrl: 'http://localhost:5059',
baseUrl: 'https://localhost:3009',
setupNodeEvents(on, config) {
on('task', {
// applicationName needs to be parsable by our database audit system. For example -6@something.
executeQuery({ query, applicationName }) {
const client = new pg.Client({
connectionString: `postgresql://etp_app:etp@localhost:5444/etp_dev?search_path=etp&application_name=${applicationName}`
});

return client
.connect()
.then(() => client.query(query))
.then(result => {
return result.rows;
})
.catch(err => {
throw err;
})
.finally(() => {
client.end();
});
}
});
}
}
});
78 changes: 13 additions & 65 deletions e2e-tests/cypress/cypress/e2e/laatija/laatija.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ context('Laatija', () => {
it('should navigate to energiatodistus', () => {
cy.visit('/#/energiatodistus/all');

cy.get('[data-cy="energiatodistus-row"]').first().click();
cy.get('[data-cy="energiatodistus-id"]').contains('5').click();

cy.location().should(loc =>
assert.equal(loc.toString(), `${baseUrl}/#/energiatodistus/2018/5`)
Expand Down Expand Up @@ -55,82 +55,30 @@ context('Laatija', () => {
it('should delete energiatodistus from energiatodistus page', () => {
cy.visit('/#/energiatodistus/all');

cy.get('[data-cy="energiatodistus-row"]').first().click();

cy.intercept(
{
method: 'DELETE',
pathname: /\/api\/private\/energiatodistukset\/2018\/5$/
},
{ statusCode: 200 }
).as('deleteEnergiatodistus');

cy.intercept(
{
method: 'GET',
pathname: /\/api\/private\/energiatodistukset$/
},
req =>
req.reply(FIXTURES.energiatodistukset.filter(item => item.id !== 5))
).as('energiatodistukset');

cy.intercept(
{
method: 'GET',
pathname: /\/api\/private\/energiatodistukset\/count$/
},
{ statusCode: 200, body: { count: 4 } }
).as('count');
cy.get('[data-cy="energiatodistus-id"]').contains('5').click();

cy.contains('Poista').click();
cy.get('[data-cy="confirm-submit-button"]').click();

cy.wait('@deleteEnergiatodistus');
cy.wait('@energiatodistukset');
cy.wait('@count');
cy.get('[data-cy="confirm-submit-button"]').click();

cy.get('[data-cy="energiatodistus-row"]').should('have.length', 4);
cy.get('[data-cy="energiatodistus-id"]')
.contains('5')
.should('not.exist');
});

it('should delete energiatodistus from energiatodistukset page', () => {
cy.visit('/#/energiatodistus/all');

cy.intercept(
{
method: 'DELETE',
pathname: /\/api\/private\/energiatodistukset\/2018\/5$/
},
{ statusCode: 200 }
).as('deleteEnergiatodistus');

cy.get(
'[data-cy="energiatodistus-row"]:first-child td:last-child span'
).click();

cy.intercept(
{
method: 'GET',
pathname: /\/api\/private\/energiatodistukset$/
},
req =>
req.reply(FIXTURES.energiatodistukset.filter(item => item.id !== 5))
).as('energiatodistukset');

cy.intercept(
{
method: 'GET',
pathname: /\/api\/private\/energiatodistukset\/count$/
},
{ statusCode: 200, body: { count: 4 } }
).as('count');
cy.get('[data-cy="energiatodistus-id"]')
.contains('5')
.siblings('[data-cy="energiatodistus-delete"]')
.click();

cy.get('[data-cy="confirm-submit-button"]').click();

cy.wait('@deleteEnergiatodistus');
cy.wait('@energiatodistukset');
cy.wait('@count');

cy.get('[data-cy="energiatodistus-row"]').should('have.length', 4);
cy.get('[data-cy="energiatodistus-id"]')
.contains('5')
.should('not.exist');
});
});

Expand Down
Loading
Loading