Skip to content

Instantly share code, notes, and snippets.

@estruyf
Created January 19, 2020 13:21
Show Gist options
  • Select an option

  • Save estruyf/9987abd4993e2ffeb601b6f5b25833a6 to your computer and use it in GitHub Desktop.

Select an option

Save estruyf/9987abd4993e2ffeb601b6f5b25833a6 to your computer and use it in GitHub Desktop.
Cypress test/spec file for SharePoint solutions
describe('SharePoint SPFx Testing', function() {
/**
* Before visiting SharePoint, we first need to authenticate
*/
before(function() {
cy.spAuth();
});
/**
* Check if the homepage can be opened
*/
it('Can open the homepage', function() {
cy.visit(`${Cypress.env('appUrl')}`);
});
/**
* Validate what you want to validate
*/
it('Validate if there are two images on the page', async () => {
const elms = await cy.get('div[data-ui-test-id="brickheadz"] img');
return expect(elms).to.be.length(2);
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment