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

Feat/supabase auth #4087

Closed
wants to merge 4 commits into from
Closed
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
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,15 @@
"contributions": [
"doc"
]
},
{
"login": "ebradbury",
"name": "Elliot Bradbury",
"avatar_url": "https://avatars.githubusercontent.com/u/253679?v=4",
"profile": "https://github.com/ebradbury",
"contributions": [
"code"
]
}
],
"projectName": "community-platform",
Expand Down
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ jobs:
- checkout
- attach_workspace:
at: '.'
- run: npx supabase login --token $SUPABASE_ACCESS_TOKEN
- run: (yes || true) | npx supabase db push --db-url $SUPABASE_DB_URL
- run: npx supabase@2.6.8 login --token $SUPABASE_ACCESS_TOKEN
- run: (yes || true) | npx supabase@2.6.8 db push --db-url $SUPABASE_DB_URL --debug
# Run cypress e2e tests on chrome
test_e2e:
docker: *docker
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ What kind of change does this PR introduce?
_Describe the new behaviour_
_If useful, provide screenshot or capture to highlight main changes_

## Does this PR introduce a breaking change?
## Does this PR introduce a DB Schema Change or Migration?

- [ ] Yes
- [ ] No
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/pr-preview-fly-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,18 @@ jobs:
# pull the repo from the pull request source, not the default local repo
ref: ${{ github.event.pull_request.head.sha }}

- name: Install supabase CLI
uses: supabase/setup-cli@v1
with:
version: latest
# Commented out so there are no schema conflicts between preview branches.
# A better solution would be to use Supabase Branching: https://supabase.com/docs/guides/deployment/branching
# - name: Install supabase CLI
# uses: supabase/setup-cli@v1
# with:
# version: 2.6.8

- name: Link Supabase project
run: supabase link --project-ref $SUPABASE_PROJECT_ID
# - name: Link Supabase project
# run: supabase link --project-ref $SUPABASE_PROJECT_ID

- name: Push Supabase DB
run: supabase db push
# - name: Push Supabase DB
# run: supabase db push

- name: Install Fly CLI
run: |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ Thanks go to these wonderful people ([emoji key](https://allcontributors.org/doc
<td align="center" valign="top" width="14.28%"><a href="http://johannesross.de"><img src="https://avatars.githubusercontent.com/u/74828657?v=4?s=60" width="60px;" alt="Johannes Roß"/><br /><sub><b>Johannes Roß</b></sub></a><br /><a href="https://github.com/ONEARMY/community-platform/commits?author=johannes-ross" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/detrina"><img src="https://avatars.githubusercontent.com/u/155117116?v=4?s=60" width="60px;" alt="Devkuni"/><br /><sub><b>Devkuni</b></sub></a><br /><a href="https://github.com/ONEARMY/community-platform/commits?author=detrina" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Bilogweb3"><img src="https://avatars.githubusercontent.com/u/155262265?v=4?s=60" width="60px;" alt="Bilog WEB3"/><br /><sub><b>Bilog WEB3</b></sub></a><br /><a href="https://github.com/ONEARMY/community-platform/commits?author=Bilogweb3" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ebradbury"><img src="https://avatars.githubusercontent.com/u/253679?v=4?s=60" width="60px;" alt="Elliot Bradbury"/><br /><sub><b>Elliot Bradbury</b></sub></a><br /><a href="https://github.com/ONEARMY/community-platform/commits?author=ebradbury" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
58 changes: 58 additions & 0 deletions packages/cypress/src/integration/research/write.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ describe('[Research]', () => {
.type(updateVideoUrl)
.blur({ force: true })

cy.step('Add file to update')

// click the "Upload Files" button to show the uppy dashboard modal
cy.get('[data-cy=file-input-field]').click()

// set the file input value to our test fixture file, and click upload button
cy.get('.uppy-Dashboard-input:first').as('file-input')
cy.get('@file-input').selectFile('src/fixtures/files/Example.pdf', {
force: true,
})
cy.get('.uppy-StatusBar-actionBtn--upload').as('upload-button')
cy.get('@upload-button').click()

cy.step('Published when fields are populated correctly')
cy.get('[data-cy=errors-container]').should('not.exist')
cy.get('[data-cy=submit]').click()
Expand All @@ -142,6 +155,51 @@ describe('[Research]', () => {

cy.contains(updateTitle).should('be.visible')
cy.contains(updateDescription).should('be.visible')
cy.get('[data-cy=file-download-counter]').should(
'have.text',
'0 downloads',
)

// download the file then check the counter
cy.step('Download counter increments')
cy.get('[data-cy=downloadButton]').click()
cy.get('[data-cy=DonationRequestSkip]')
.invoke('removeAttr', 'target')
.click()
cy.go('back')
cy.reload()
cy.get('[data-cy=file-download-counter]').should(
'have.text',
'1 download',
)

cy.step('Download count is preserved when replacing file')
cy.get('[data-cy=edit-update]').click()
cy.get('[data-cy=delete-file]').click()

// click the "Upload Files" button to show the uppy dashboard modal
cy.get('[data-cy=file-input-field]').click()

// set the file input value to our test fixture file, and click upload button
cy.get('.uppy-Dashboard-input:first').as('file-input')
cy.get('@file-input').selectFile('src/fixtures/files/Example.pdf', {
force: true,
})
cy.get('.uppy-StatusBar-actionBtn--upload').as('upload-button')
cy.get('@upload-button').click()

cy.get('[data-cy=errors-container]').should('not.exist')
cy.get('[data-cy=submit]').click()

cy.step('Open the research update')
cy.get('[data-cy=view-research]:enabled', { timeout: 20000 })
.click()
.url()

cy.get('[data-cy=file-download-counter]').should(
'have.text',
'1 download',
)
})

it('[By Anonymous]', () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/cypress/src/support/commandsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ Cypress.Commands.add('setSettingImage', (image, selector) => {
.attachFile(`images/${image}.jpg`)
})

Cypress.Commands.add('setFile', (filePath, selector) => {
cy.get(`[data-cy=${selector}]`).find(':file').attachFile(filePath)
})

Cypress.Commands.add('setSettingImpactData', (year: number, fields) => {
cy.step('Save impact data')
cy.get('[data-cy="tab-Impact"]').click()
Expand Down
3 changes: 2 additions & 1 deletion src/common/Alerts/AlertProfileVerification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const AlertProfileVerification = () => {

if (!isVerificationSuccessful) {
try {
await userStore.sendEmailVerification()
// TODO
// await userStore.sendEmailVerification()
setVerificationState('sent')
} catch (error) {
setVerificationState('error')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const AlreadyAddedFiles = ({ formValues, setFileEditMode }) => {
type="button"
variant="outline"
icon="delete"
data-cy="delete-file"
onClick={deleteFile}
>
{buttons.files}
Expand Down Expand Up @@ -86,6 +87,7 @@ const UploadNewFiles = () => {
<Field
hasText={false}
name={'files'}
data-cy="file-input-field"
component={FileInputField}
/>
<Text color={'grey'} mt={4} sx={{ fontSize: 1 }}>
Expand All @@ -98,6 +100,7 @@ const UploadNewFiles = () => {
<Field
hasText={false}
name={'files'}
data-cy="file-input-field"
admin={true}
component={FileInputField}
/>
Expand Down
Loading
Loading