-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1000 from necyberteam/cypress-jasper-11-08-2023
more tests, esp. tags
- Loading branch information
Showing
9 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
describe('Homepage ASP Test', () => { | ||
it('tests ASP', () => { | ||
cy.visit('/'); | ||
cy.verifyImages(); | ||
cy.task("log", "ASP homepage images all load"); | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,8 +51,13 @@ describe("Tests of the knowledge-base page", () => { | |
.should('have.attr', 'href') | ||
.and('contain', 'https://ask.cyberinfrastructure.org/tag')); | ||
|
||
// popular ci-links | ||
// popular 3 ci-links so popular links list is full | ||
cy.loginAs('[email protected]', 'b8QW]X9h7#5n'); | ||
create_dummy_ci_link(); | ||
create_dummy_ci_link(); | ||
create_dummy_ci_link(); | ||
cy.drupalLogout(); | ||
cy.visit("/knowledge-base"); | ||
|
||
cy.get('.btn.btn-primary') | ||
.contains('FIND LINKS') | ||
|
@@ -61,12 +66,20 @@ describe("Tests of the knowledge-base page", () => { | |
cy.get('.field--type-text-with-summary') | ||
.contains('Popular CI Links'); | ||
|
||
// verify count of ask-ci links is 10 | ||
cy.get('.block-top-tags-from-askci > .flex-wrap') | ||
.find('a').should('have.length', 10); | ||
|
||
// test the known ci-link | ||
cy.get('.view-resources.view-id-resources') | ||
.contains('dummy-ci-link-for-testing-knowledge-base') | ||
.should('have.attr', 'href') | ||
.and('contain', '/ci-links'); | ||
|
||
// verify count of ci-links is 3 | ||
cy.get('.view-resources.view-id-resources') | ||
.find('a').should('have.length', 3); | ||
|
||
// test any other ci-links | ||
cy.get('.view-resources.view-id-resources') | ||
.find('a') | ||
|
@@ -80,7 +93,6 @@ describe("Tests of the knowledge-base page", () => { | |
|
||
// helper function to create a ci-link that can be added to the AG | ||
function create_dummy_ci_link() { | ||
cy.loginAs('[email protected]', 'b8QW]X9h7#5n'); | ||
cy.visit('/form/ci-link'); | ||
cy.get('#edit-approved').check(); | ||
cy.get('#edit-title').type('dummy-ci-link-for-testing-knowledge-base'); | ||
|
@@ -90,8 +102,6 @@ function create_dummy_ci_link() { | |
// tag "access-acount" is selected | ||
cy.get('.tags').contains('access-acount').click(); | ||
cy.get('#edit-submit').click(); | ||
cy.drupalLogout(); | ||
cy.visit("/knowledge-base"); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
Verify the tags page. | ||
*/ | ||
describe("Verify the tags page", () => { | ||
it("Tests the tags page", () => { | ||
|
||
cy.visit("/tags"); | ||
|
||
cy.get(".page-title").contains("Tags"); | ||
|
||
// check breadcrumbs | ||
const crumbs = [ | ||
['Support', '/'], | ||
['Tags', null] | ||
]; | ||
cy.checkBreadcrumbs(crumbs); | ||
|
||
// each h2 is a tag category -- verify each h2 with the each() function | ||
cy.get('.block-system-main-block') | ||
.find('h2.mt-10') | ||
.each(($el) => { | ||
|
||
// cy.task('log', 'h2: ' + $el.text()); | ||
|
||
// verify there's a block with the id of the h2 text | ||
cy.get('.block-system-main-block') | ||
.get('[id="' + $el.text() + '"]') | ||
.contains($el.text()); | ||
|
||
// each category should have a bunch of tags - get an alias to that element | ||
cy.get('.block-system-main-block') | ||
.get('[id="' + $el.text() + '"]') | ||
.next() // in the DOM, this gets the element containing all the tags | ||
.as('tag-list'); | ||
|
||
// verify there are more than 0 tags per category | ||
cy.get('@tag-list') | ||
.find('a').should('have.length.gt', 0); | ||
|
||
// verify each tag has a good href | ||
cy.get('@tag-list') | ||
.find('a') | ||
.each($a => { | ||
expect($a).to.have.attr("href", '/tags/' + $a.text()); | ||
}); | ||
|
||
// verify 2nd sidebar has same tag category | ||
cy.get('.region.region-sidebar-second') | ||
.contains($el.text()) | ||
.should('have.attr', 'href', '#' + $el.text()); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ hostname: necyberteam.org | |
name: 'Northeast Cyberteam' | ||
scheme: https | ||
weight: 1 | ||
is_default: false | ||
is_default: true |