Skip to content

Commit

Permalink
fix cypress.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfreitasdev committed Sep 7, 2024
1 parent e24cc9d commit 02dedf8
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 37 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
name: Cypress

on:
workflow_dispatch:
push:
branches:
- "**"
paths-ignore:
- "art/**"
- "README.md"
pull_request:
types: [ready_for_review, synchronize, opened]
paths-ignore:
- "art/**"
- "README.md"

jobs:
build:
Expand Down
86 changes: 50 additions & 36 deletions tests/cypress/cypress/e2e/actions/buttons.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,30 @@ describe('can render actions buttons with icons', () => {
.should('contain.text', 'View')

cy.intercept('POST', '/livewire/update', (req) => {
expect(req.body.components[0].calls[0]).to.deep.equal({
path: "",
method: "__dispatch",
params: [
"clickToEdit",
{
action: "view",
name: "Luan"
}
]
});

console.log(req.body)
expect(req.body.components[0].calls[0])
.to.deep
.equal({
path: "",
method: "__dispatch",
params: [
"clickToEdit",
{
action: "view",
name: "Luan"
}
]
});

}).as('requestIntercept');

cy.get('[data-cy=btn-view-1]').click()

cy.wait('@requestIntercept').its('response.body').should((response) => {
expect(response.components[0].effects.xjs[0]).to.deep.equal('console.log("Editing #view - Luan")');
cy.wait('@requestIntercept')
.its('response.body')
.should((response) => {
expect(response.components[0].effects.xjs[0])
.to.deep
.equal('console.log("Editing #view - Luan")');
});
});

Expand All @@ -49,26 +53,30 @@ describe('can render actions buttons with icons', () => {
.should('contain.text', 'Edit')

cy.intercept('POST', '/livewire/update', (req) => {
expect(req.body.components[0].calls[0]).to.deep.equal({
path: "",
method: "__dispatch",
params: [
"clickToEdit",
{
action: "edit",
name: "Luan"
}
]
});

console.log(req.body)
expect(req.body.components[0].calls[0])
.to.deep
.equal({
path: "",
method: "__dispatch",
params: [
"clickToEdit",
{
action: "edit",
name: "Luan"
}
]
});

}).as('requestIntercept');

cy.get('[data-cy=btn-edit-1]').click()

cy.wait('@requestIntercept').its('response.body').should((response) => {
expect(response.components[0].effects.xjs[0]).to.deep.equal('console.log("Editing #edit - Luan")');
cy.wait('@requestIntercept')
.its('response.body')
.should((response) => {
expect(response.components[0].effects.xjs[0])
.to.deep
.equal('console.log("Editing #edit - Luan")');
});
});

Expand Down Expand Up @@ -98,8 +106,12 @@ describe('can render actions buttons with icons', () => {

cy.get('[data-cy=btn-view-2').click()

cy.wait('@requestIntercept').its('response.body').should((response) => {
expect(response.components[0].effects.xjs[0]).to.deep.equal('console.log("Editing #view - Daniel")');
cy.wait('@requestIntercept')
.its('response.body')
.should((response) => {
expect(response.components[0].effects.xjs[0])
.to.deep
.equal('console.log("Editing #view - Daniel")');
});
})

Expand All @@ -126,14 +138,16 @@ describe('can render actions buttons with icons', () => {
]
});

console.log(req.body)

}).as('requestIntercept');

cy.get('[data-cy=btn-edit-2]').click()

cy.wait('@requestIntercept').its('response.body').should((response) => {
expect(response.components[0].effects.xjs[0]).to.deep.equal('console.log("Editing #edit - Daniel")');
cy.wait('@requestIntercept')
.its('response.body')
.should((response) => {
expect(response.components[0].effects.xjs[0])
.to.deep
.equal('console.log("Editing #edit - Daniel")');
});
});
})

0 comments on commit 02dedf8

Please sign in to comment.