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

Create a test for a new created play before be able to submit it #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
27 changes: 27 additions & 0 deletions lib/services/template/_templates/play.cy_ts.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/// <reference types="cypress" />


describe('Test %PLAY_TITLE_NAME_SANITIZED% play', () => {
beforeEach(() => {
cy.visit('/plays/%PLAY_URL%/');
});

it('Header component should render properly', () => {
cy.header();
});

it('Play page should contains author name', () => {
cy.contains('%PLAY_GITHUB%');
});


it('We should be able to see the details of the play', () => {
cy.get('.play-details').should('be.visible');
});


it('We should be able to see the actions', () => {
cy.get('.header-actions').should('be.visible');
});

});
8 changes: 6 additions & 2 deletions lib/services/template/play_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const TEMPLATE_DIRECTORY = "_templates";

const TEMPLATE_MAP = {
common: ["Readme_md"],
cy: ['play.cy_ts'],
js: ["component_js"],
ts: ["component_tsx"],
css: ["styles_css"],
Expand All @@ -33,10 +34,13 @@ const createPlayDirectory = (play) => {
return play_directory;
};


const processTemplates = (data, play_path) => {
processTemplate(data, "common", play_path);
data.url = `${toSlug(data.github.toLowerCase())}/${data.slug}`;
processTemplate(data, 'common', play_path);
processTemplate(data, 'cy', 'cypress/e2e');
processTemplate(data, data.language, play_path);
processTemplate(data, data.style || "css", play_path);
processTemplate(data, data.style || 'css', play_path);
};

const replaceTemplateVar = (play_data, filePath) => {
Expand Down