Replies: 2 comments 1 reply
-
I should let it be known that I have tests setup to support multiple sites and have shared tests. The main spec file looks like: import { ampPages } from '../data';
/* Load Shared Tests */
import { ampTests } from '../../../shared/amp.spec';
const SITE = Cypress.env('SITE');
describe(`Amp tests for ${ SITE }`, () => {
ampTests(ampPages, (page) => {
it('Should show mobile header', () => {
console.log('page', page);
cy.visit(page);
});
});
}); and then shared spec file looks like: export function ampTests(ampPages, localTests) {
ampPages.forEach(page => {
it(`Should have status 200: (${page})`, () => {
cy.request({ url: '/', failOnStatusCode: false })
.then(res => {
expect(res.status).to.equal(200);
});
});
it('Non-amp page should redirect back to regular page', () => {
cy.request({ url: '/amp', failOnStatusCode: false })
.then(res => {
// slice(5) to remove status code - [301: ]...
const ampUrl = res.redirects[0].slice(5);
const redirectedToUrl = res.redirects[1].slice(5);
expect(res.allRequestResponses[0]['Response Status'])
.to.be.equal(301);
expect(res.allRequestResponses[1]['Response Status'])
.to.be.equal(302);
expect(res.allRequestResponses[2]['Response Status'])
.to.be.equal(200);
expect(redirectedToUrl).to.be.equal(ampUrl.slice(0, -4));
});
});
// localTests() is a callback function to run in each site's implementation
// in case there are site specific tests that should run in this suite
localTests(page);
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'd be interested in knowing if you find an answer. I googled "cypress get a list of all tests" to find this discussions |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What I'm wanting to get is the same kind of list as when you run cypress open and then click on a spec to run.
Somehow the app gets and compiles this list and I'm looking to do the same thing. I want to present this list in my UI to test runners as they have sent the command to run the test.
Beta Was this translation helpful? Give feedback.
All reactions