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

[Draft] Test analysis default mode #1248

Closed
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[RFR] Automate TC 582 (#1185)
* Automate TC 582

Signed-off-by: midays <midays@redhat.com>

* try with commented application creation

Signed-off-by: midays <midays@redhat.com>

* added before each clause

Signed-off-by: midays <midays@redhat.com>

* change clause type and name

Signed-off-by: midays <midays@redhat.com>

* change navTav selector

Signed-off-by: midays <midays@redhat.com>

* revert changes

Signed-off-by: midays <midays@redhat.com>

* revert changes

Signed-off-by: midays <midays@redhat.com>

* final changes passed

Signed-off-by: midays <midays@redhat.com>

* fix applicationList variable initialization

Signed-off-by: midays <midays@redhat.com>

* remove comment

Signed-off-by: midays <midays@redhat.com>

---------

Signed-off-by: midays <midays@redhat.com>
Signed-off-by: yael-spinner <yaels83191@gmail.com>
  • Loading branch information
midays authored and yael-spinner committed Nov 4, 2024
commit e0583eca0d58868ca3a929ff5c87e796cc7e2d6f
Original file line number Diff line number Diff line change
@@ -15,16 +15,24 @@ limitations under the License.
*/
/// <reference types="cypress" />

import { login, getRandomApplicationData, sidedrawerTab } from "../../../../../utils/utils";
import {
login,
getRandomApplicationData,
sidedrawerTab,
deleteByList,
} from "../../../../../utils/utils";
import { Application } from "../../../../models/migration/applicationinventory/application";
import { SEC } from "../../../../types/constants";
import { labelTagText } from "../../../../views/applicationinventory.view";

let application: Application;
let applicationList: Application[] = [];

describe(["@tier2"], "Test if application language is discovered and tagged correctly", () => {
before("Login", function () {
login();
});

beforeEach("Load Data", function () {
cy.fixture("application").then(function (appData) {
this.appData = appData;
});
@@ -38,36 +46,62 @@ describe(["@tier2"], "Test if application language is discovered and tagged corr
Tooling: ["Maven"],
Framework: ["Quarkus"],
};
application = new Application(
const application = new Application(
getRandomApplicationData("Java_language_maven_tooling_quarkus_framework", {
sourceData: this.appData["Java_language_maven_tooling_quarkus_framework"],
})
);
application.create();
applicationList.push(application);
cy.wait(2 * SEC);
sidedrawerTab("Java_language_maven_tooling_quarkus_framework", "Tags");
cy.contains("No tags available", { timeout: 60 * SEC }).should("not.exist");
assertTagsInSection(sectionsTags);
});

it("Application written in java and typescript with Maven and NodeJS tooling ", function () {
// Automates Polarion MTA-582
const sectionsTags = {
Language: ["Java", "TypeScript"],
Tooling: ["Maven", "NodeJs", "Node.js"],
};
const application = new Application(
getRandomApplicationData("Java_TS_language_maven_nodeJS_tooling", {
sourceData: this.appData["Java_TS_language_maven_nodeJS_tooling"],
})
);
application.create();
applicationList.push(application);
cy.wait(2 * SEC);
sidedrawerTab("Java_TS_language_maven_nodeJS_tooling", "Tags");
cy.contains("No tags available", { timeout: 60 * SEC }).should("not.exist");
assertTagsInSection(sectionsTags);
});

afterEach("Persist session", function () {
Application.open(true);
});

after("Perform test data clean up", function () {
application.delete();
deleteByList(applicationList);
});

function assertTagsInSection(sectionsTags: {
Language: string[];
Tooling: string[];
Framework: string[];
Tooling?: string[];
Framework?: string[];
}): void {
Cypress._.forEach(sectionsTags, (tags, section) => {
cy.contains("h4", section)
.parentsUntil("section")
.next()
.within(() => {
tags.forEach((tag) => {
cy.contains(labelTagText, tag).should("have.length", 1);
if (section) {
cy.contains("h4", section)
.parentsUntil("section")
.next()
.within(() => {
tags.forEach((tag) => {
cy.contains(labelTagText, tag).should("have.length", 1);
});
});
});
}
});
}
});
4 changes: 4 additions & 0 deletions cypress/fixtures/application.json
Original file line number Diff line number Diff line change
@@ -68,6 +68,10 @@
"repoType": "Git",
"sourceRepo": "https://github.com/quarkusio/quarkus-super-heroes"
},
"Java_TS_language_maven_nodeJS_tooling": {
"repoType": "Git",
"sourceRepo": "https://github.com/pkaul/maven-typescript-example"
},
"java-example-app": {
"repoType": "Git",
"sourceRepo": "https://github.com/ibraginsky/book-server"