revert: (test, e2e) test suit for cypress (#42488)

This reverts commit 22b45761a7.
This commit is contained in:
Mrugesh Mohapatra
2021-06-14 23:44:43 +05:30
committed by GitHub
parent 3fc6877bb0
commit 3130265991
35 changed files with 55 additions and 367 deletions

View File

@ -1,4 +1,37 @@
/* global cy Cypress */
/* global cy Cypress*/
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => {});
//
//
// -- This is a child command --
// Cypress.Commands.add(
// 'drag',
// { prevSubject: 'element' },
// (subject, options) => {}
// );
//
//
// -- This is a dual command --
// Cypress.Commands.add(
// 'dismiss',
// { prevSubject: 'optional' },
// (subject, options) => {}
// );
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => {});
Cypress.Commands.add('login', () => {
cy.visit('/');
@ -19,50 +52,3 @@ Cypress.Commands.add('resetUsername', () => {
cy.contains('Account Settings for developmentuser').should('be.visible');
});
Cypress.Commands.add('testChallenges', () => {
// Test Meta tags
cy.get('head meta[charset=utf-8]');
cy.get('head meta[name=description]').should('have.attr', 'content');
// Test breadcrumbs
cy.get('.breadcrumb-right').should('have.attr', 'href');
cy.get('.ellipsis').should('be.visible');
cy.get('.breadcrumb-left').should('have.attr', 'href');
cy.get('.breadcrumb-left').should('be.visible', 'href');
cy.get('body').should('be.visible');
// Challenge content
cy.get('.challenge-title').should('be.visible');
cy.get('#description').should('be.visible');
// Monaco editor
cy.get('.react-monaco-editor-container')
.click()
.focused()
.type('<h1> Hello world! </h1>');
// Ensure that there are test
cy.get('.challenge-test-suite').children().its('length').should('be.gt', 0);
});
// This command can be used to test projects and back-end challenges
Cypress.Commands.add('testProjectsAndBackend', () => {
// Test breadcrumbs
cy.get('.breadcrumb-right').should('have.attr', 'href');
cy.get('.ellipsis').should('be.visible');
cy.get('.breadcrumb-left').should('have.attr', 'href');
cy.get('.breadcrumb-left').should('be.visible', 'href');
// Challenge content
cy.get('.challenge-title').should('be.visible');
cy.get('#description').should('be.visible');
// Shoud be possible to submit solution
cy.get('input[name=solution]')
.click()
.type('https://codepen.io/foobar/full/RKRbwL');
cy.get('button[type=submit]').first().click();
});