Skip to content

Commit

Permalink
test: testing ci by intercepting login
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlewicki committed May 20, 2024
1 parent 1150dd3 commit 09e30fe
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions cypress/e2e/uiTest.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@ const { isConstructorDeclaration } = require("typescript");
function setupTest(){
if(Cypress.env('TESTENV') === "PROD"){
cy.visit("https://openai.ki.fh-swf.de");
cy.get("button").contains("Cluster Login").click()
cy.get('input#username').type(Cypress.env("CYPRESS_USER_NAME"));
cy.get('input#password').type(Cypress.env("CYPRESS_USER_PASSWORD"));
cy.get("input").contains("Login Cluster").click();
}
else{ // if its not prod, then it selects PROD
cy.intercept('GET', "https://www.gravatar.com/8e596ec8846c54f583994b3773e0c4afc16414733b9640b29b546a41b169dcd1");
cy.intercept('GET', "https://de.gravatar.com/8e596ec8846c54f583994b3773e0c4afc16414733b9640b29b546a41b169dcd1");
cy.intercept('GET', "https://de.gravatar.com/8e596ec8846c54f583994b3773e0c4afc16414733b9640b29b546a41b169dcd1");
cy.intercept('GET', 'https://openai.ki.fh-swf.de/api/user', { fixture: 'testUser.json' }).as('getUser');
cy.intercept('GET', "https://openai.ki.fh-swf.de/api/login")
.then((req) => {
console.log(req);
});
cy.visit("http://localhost:5173/");
cy.wait(2000);
cy.wait('@getUser', { timeout: 15000 });
}
cy.get("button").contains("Cluster Login").click()
cy.get('input#username').type(Cypress.env("CYPRESS_USER_NAME"));
cy.get('input#password').type(Cypress.env("CYPRESS_USER_PASSWORD"));
cy.get("input").contains("Login Cluster").click();
}

describe("User Interface", () => {
Expand Down

0 comments on commit 09e30fe

Please sign in to comment.