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

cypress test and readme update #84

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 4 additions & 12 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { defineConfig } from "cypress";

export default defineConfig({
// e2e: {
// setupNodeEvents(on, config) {
// // implement node event listeners here
// },
// },
chromeWebSecurity: false,
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
setupNodeEvents() {
// implement node event listeners here
},
baseUrl: 'http://localhost:8080',
},
});
})
43 changes: 23 additions & 20 deletions cypress/e2e/sign-in/e2e.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,27 @@

/* eslint-disable no-undef */
describe("e2e test", () => {
before(() => {
cy.visit("http://localhost:8080");
});
it("Sign in and battery select", () => {
cy.get('#username').type("company 2 user"); // typing username
cy.get('#password').type("changeme"); // typing password
cy.get('#kc-login').click(); // btn click
cy.get('[data-cy="QR-scanner-tab"]').click(); // changing tab
cy.get('[data-cy="qr-container"]'); // checking qr scanner display
cy.get('[data-cy="history-tab"]').click(); // changing tab
cy.get('[data-cy="history-container"]'); // checking history page display
cy.get('[data-cy="passport-link"]').click(); // getting a passport
cy.wait(20000); // timeout for loading
cy.get('[data-cy="battery-id"]'); // 1. General information first field check
cy.get('[data-cy="electrolyte-composition"]'); // 2. Battery composition first field check
cy.get('[data-cy="remaining-capacity"]'); // 3. State of health first field check
cy.get('[data-cy="state-of-charge"]'); // 4. Parameters of the battery first field check
cy.get('[data-cy="link-to-the-label-element"]'); // 8. Additional information first field check
cy.get('[data-cy="footer"]'); // Footer check
});
before(() => {
cy.visit("http://localhost:8080");
});
it("Sign in and battery select", () => {
cy.origin("https://centralidp.dev.demo.catena-x.net/auth/realms/CX-Central/", () => {
cy.get('.CX_Test_Access').click(); // btn click

});
cy.origin("https://sharedidp.dev.demo.catena-x.net/auth/", () => {
cy.get('#username').type("company 2 user"); // typing username
cy.get('#password').type("changeme"); // typing password
cy.get('#kc-login').click(); // btn click
})
cy.get('#input-7').type("NCR186850B"); // typing username
cy.get('#search-btn').click(); // btn click
cy.wait(30000); // timeout for loading
cy.get('[data-cy="battery-id"]'); // 1. General information first field check
cy.get('.mdi-battery-charging').click(15, 40, { force: true }); // btn click
cy.get('[data-cy="state-of-charge"]'); // 2. Product condition first field check
cy.get('.mdi-flask-empty-outline').click(15, 40, { force: true }); // btn click
cy.get('[data-cy="electrolyte-composition"]'); // 3. Cell chemistry first field check
cy.get('[data-cy="footer"]'); // Footer check
});
});
32 changes: 16 additions & 16 deletions docs/cypress/CYPRESS.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<!--
Catena-X - Product Passport Consumer Application

Copyright (c) 2022, 2023 BASF SE, BMW AG, Henkel AG & Co. KGaA

See the NOTICE file(s) distributed with this work for additional
information regarding copyright ownership.

This program and the accompanying materials are made available under the
terms of the Apache License, Version 2.0 which is available at
https://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 govern in permissions and limitations
under the License.

SPDX-License-Identifier: Apache-2.0
-->

Expand All @@ -27,23 +27,23 @@ This is the documentation for Battery Passport App E2E Cypress test.
## Steps to perform the test with Cypress GUI

1. npm run cypress:open
2. Choose E2E testing
![GUI-start](./GUI-start.png)
</br></br>
2. Choose E2E testing
![GUI-start](./GUI-start.png)
</br></br>

3. Choose browser - Electron
![GUI-browser](./GUI-browser.png)
</br></br>
![GUI-browser](./GUI-browser.png)
</br></br>

4. Choose specs - e2e
![GUI-specs](./GUI-specs.png)
</br></br>
![GUI-specs](./GUI-specs.png)
</br></br>

5. DOcumentation of passing test on local env
![GUI-passing](./GUI-passing.png)
</br></br>
![GUI-passing](./GUI-passing.png)
</br></br>

## Steps tested

![test](./test.png)
</br></br>
![test](./test2.png)
</br></br>
Binary file added docs/cypress/test2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions src/components/general/SearchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
</v-btn>
</div>
<v-btn
id="search-btn"
rounded="pill"
color="#0F71CB"
size="small"
Expand All @@ -68,10 +69,10 @@ export default {
typedCode: "",
};
},
computed:{
computed: {
isContent() {
return this.typedCode !== '' && this.typedCode !== null;
}
return this.typedCode !== "" && this.typedCode !== null;
},
},
methods: {
onClick() {
Expand Down
1 change: 1 addition & 0 deletions src/components/passport/sections/BatteryComposition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
style="display: flex; margin-bottom: 12px"
>
<AttributeField
data-cy="composition"
icon="mdi-newspaper-variant-outline"
:attributes-list="propsData.compositionOfBattery"
label="Main Battery Composites"
Expand Down