-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: testing the submission of lesson builds
- Loading branch information
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const { faker } = require('@faker-js/faker') | ||
|
||
describe('Course Workflow', () => { | ||
const email = faker.internet.email() | ||
const password = faker.internet.password() | ||
|
||
beforeEach(() => { | ||
cy.clearCookies() | ||
cy.clearLocalStorage() | ||
}) | ||
|
||
const login = () => { | ||
cy.visit('http://localhost:3000/') | ||
cy.get('#login').click() | ||
cy.get('.mt-3 > .cursor-pointer').click() | ||
cy.get('#email').type(email) | ||
cy.get('#password').type(password) | ||
cy.get('.mt-8 > .w-full').click() | ||
} | ||
|
||
const navigateToCourse = () => { | ||
cy.get('[href="/courses"] > .nextui-c-iWjDFM').click() | ||
cy.get('#Rust_State_Machine > .nextui-c-kzikkm > .nextui-c-iWjDFM').click() | ||
} | ||
|
||
const accessLesson = () => { | ||
cy.get('#signup-cohort').click() | ||
cy.get(':nth-child(1) > .mt-4 > :nth-child(1) > :nth-child(1) > #access-lesson > .m-0').click() | ||
} | ||
|
||
const submitLesson = ({ text, filePath }) => { | ||
cy.get('#submit-lesson > .nextui-button-text').click() | ||
|
||
if (filePath) { | ||
cy.get('#load-file').selectFile(filePath) | ||
cy.get('#upload-file').click() | ||
} else if (text) { | ||
cy.get('.mt-2 > .z-10').type(text) | ||
cy.get('#modal-send-lesson').click() | ||
} | ||
} | ||
|
||
const validateModalContent = (expectedText) => { | ||
cy.get('.min-h-screen .pt-5').should('contain', expectedText) | ||
} | ||
|
||
const nextLesson = () => { | ||
cy.wait(4000) | ||
cy.get('.nextui-c-iWjDFM-wUUIG-color-secondary').click() | ||
} | ||
|
||
it('Completes the course workflow', () => { | ||
const submissonText = faker.lorem.sentences(2, '\n') | ||
login() | ||
navigateToCourse() | ||
accessLesson() | ||
|
||
// Submeter texto | ||
submitLesson({ text: submissonText }) | ||
nextLesson() | ||
|
||
// Submeter arquivo | ||
submitLesson({ filePath: 'public/assets/img/screenshot-home-build.png' }) | ||
validateModalContent( | ||
'Networking is everything, how about sharing your progress with your friends on Twitter?' | ||
) | ||
cy.get('#modal-cancel-button').click() | ||
nextLesson() | ||
}) | ||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ rules_version = '2'; | |
service firebase.storage { | ||
match /b/{bucket}/o { | ||
match /{allPaths=**} { | ||
allow read, write: if request.auth == null || request.auth.token.email_verified == false; | ||
allow read, write: if request.auth != null && request.auth.token.email == '[email protected]'; | ||
} | ||
} | ||
|