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

fix: Response objects couldn't open #1867

Merged
merged 2 commits into from
Jan 24, 2022
Merged
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
Add test cases for opening response object
  • Loading branch information
DepickereSven committed Jan 22, 2022
commit a9a435f429294aaa21318753c7b2d70b284f2d97
29 changes: 20 additions & 9 deletions e2e/integration/menu.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ describe('Menu', () => {
});

it('should have valid items count', () => {
cy.get('.menu-content')
.find('li')
.should('have.length', 34);
cy.get('.menu-content').find('li').should('have.length', 34);
});

it('should sync active menu items while scroll', () => {
Expand Down Expand Up @@ -35,9 +33,7 @@ describe('Menu', () => {
.should('have.text', 'Add a new pet to the store')
.should('be.visible');

cy.contains('h1', 'Swagger Petstore')
.scrollIntoView()
.wait(100)
cy.contains('h1', 'Swagger Petstore').scrollIntoView().wait(100);

cy.contains('h1', 'Introduction')
.scrollIntoView()
Expand All @@ -59,10 +55,25 @@ describe('Menu', () => {
it('should deactivate tag when other is activated', () => {
const petItem = () => cy.contains('[role=menuitem].-depth1', 'pet');

petItem()
.click({ force: true })
.should('have.class', 'active');
petItem().click({ force: true }).should('have.class', 'active');
cy.contains('[role=menuitem].-depth1', 'store').click({ force: true });
petItem().should('not.have.class', 'active');
});

it('should be able to open a response object to see more details', () => {
cy.contains('h2', 'Find pet by ID')
.scrollIntoView()
.wait(100)
.parent()
.find('div h3')
.should('have.text', 'Responses')
.parent()
.find('div:first button')
.click()
.should('have.attr', 'aria-expanded', 'true')
.parent()
.find('div h5')
.then($h5 => $h5[0].firstChild!.nodeValue!.trim())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to get the value of the h5 element.
If I would just do .should('have.text', 'Response Schema:') on that h5 it would throw an error. Because the span values would also be in that comparison.

.should('eq', 'Response Schema:');
});
});