Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
meirkalev committed Sep 13, 2024
1 parent 1fb83b9 commit c7c3282
Show file tree
Hide file tree
Showing 4 changed files with 3,844 additions and 2,129 deletions.
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { defineConfig } = require('cypress');

module.exports = defineConfig({
e2e: {
baseUrl: 'https://react-redux.realworld.io',
setupNodeEvents(on, config) {
// implement node event listeners here
}
Expand Down
10 changes: 10 additions & 0 deletions cypress/e2e/signUp.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { generateUser } from '../support/generate.js';

describe('Sign Up page', () => {
it('should provide an ability to register new account', () => {
const user = generateUser();

cy.visit('/#/register?_k=t01ofk');
cy.get('[placeholder="Username"]').type(user.username);
cy.get('[placeholder="Email"]').type(user.email);
cy.get('[placeholder="Password"]').type(user.password);
cy.get('[type="submit"]').click();
cy.get('[class="navbar-brand"]').click();
cy.get('.pull-xs-right.navbar-nav').should('contain', user.username);
});
});
12 changes: 12 additions & 0 deletions cypress/support/generate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { faker } from '@faker-js/faker';

function generateUser() {
const randomNumber = Math.random().toString().slice(2, 6);
const username = faker.internet.userName() + '_' + randomNumber;
const email = `${username}@mail.com`;
const password = '12345Qwert!';

return { email, password, username };
}

module.exports = { generateUser };
Loading

0 comments on commit c7c3282

Please sign in to comment.