feat(tools): test jQuery is defined (#44423)

* feat(tools): test jQuery is defined

* fix: add wait
This commit is contained in:
Nicholas Carrigan (he/him)
2021-12-08 12:29:16 -08:00
committed by GitHub
parent 4bdfb6794f
commit c98728ccd0

View File

@ -8,7 +8,10 @@ const selectors = {
const locations = {
index:
'/learn/responsive-web-design/basic-html-and-html5/' +
'say-hello-to-html-elements'
'say-hello-to-html-elements',
jQuery:
'/learn/front-end-development-libraries/jquery/' +
'target-html-elements-with-selectors-using-jquery'
};
const defaultOutput = `
@ -59,3 +62,25 @@ describe('Classic challenge', function () {
});
});
});
describe('jQuery challenge', function () {
before(() => {
cy.visit(locations.jQuery);
});
it('renders the default output text', () => {
cy.title().should(
'eq',
'jQuery: Target HTML Elements with Selectors Using jQuery | freeCodeCamp.org'
);
cy.get(selectors.defaultOutput).contains(defaultOutput);
});
it('should not show a reference error', () => {
cy.wait(5000);
cy.get(selectors.defaultOutput).should(
'not.contain',
'ReferenceError: $ is not defined'
);
});
});