Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.

Commit a27e528

Browse files
authored
Merge pull request #43 from 3n3a-school/add-edit-test
remove visibility test
2 parents adcef70 + 4ede7ba commit a27e528

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ jobs:
4545
cd ./assets
4646
npm install
4747
48-
- name: run cypress
49-
run: |
50-
chmod +x ./cypress-run.sh
51-
sh ./cypress-run.sh
48+
- name: run headless test
49+
uses: GabrielBB/xvfb-action@v1
50+
with:
51+
run: |
52+
chmod +x ./cypress-run.sh
53+
sh ./cypress-run.sh
54+
working-directory: ./
55+

cypress-run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ echo "===RUN npm install cypress --save-dev ==="
88
echo "===IN THE assets/ FOLDER==="
99
MIX_ENV=test mix phx.server &
1010
pid=$! # Store server pid
11-
./assets/node_modules/.bin/cypress run
11+
./assets/node_modules/.bin/cypress run --headed
1212
result=$?
1313
kill -9 $pid # kill server
1414
echo "===KILLING PHX SERVER==="

lib/m307_web/templates/loan/index.html.heex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<h1>Listing Loans</h1>
22

3-
<span><%= link "New Loan", to: Routes.loan_path(@conn, :new) %></span>
3+
<span><%= link "New Loan", to: Routes.loan_path(@conn, :new), id: "new_loan_btn" %></span>
44

55
<div class="table-responsive">
6-
<table class="table">
6+
<table class="table" id="loan_table">
77
<thead>
88
<tr>
99
<th>Name</th>

test/cypress/integration/index.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ describe('Integration Test', () => {
88
it('should create a loan', () => {
99
cy.visit(URL)
1010

11-
cy.get("body > div > main > span > a").click()
11+
cy.get("#new_loan_btn").click()
1212
cy.get("#loan_name").type("New House")
1313
cy.get("#loan_email").type("max.muster@css.ch")
1414
cy.get("#loan_phone").type("+411234202030")
1515
cy.get("#loan_rate_count").type("7")
1616
cy.get("#loan_credit_package").select("8")
17-
cy.get("body > div > main > form > div").should('be.visible')
17+
//cy.get("body > div > main > form > div").should('be.visible')
1818
cy.get("button[type=submit]").click()
1919
cy.visit(URL)
20-
cy.get("body > div > main > table > tbody").children().should("have.length", 1)
20+
cy.get("#loan_table > tbody").children().should("have.length", 1)
2121
})
2222

2323
it('should edit a loan', () => {
2424
cy.visit(URL)
2525

26-
cy.get("body > div > main > table > tbody > tr > td:nth-child(8) > span:nth-child(2) > a").click()
26+
cy.get("#loan_table > tbody > tr > td:nth-child(8) > span:nth-child(2) > a").click()
2727
cy.get("#loan_email").clear().type("max.muster@suva.ch")
2828
cy.get("button[type=submit]").click()
2929
cy.visit(URL)
30-
cy.get("body > div > main > table > tbody > tr > td:nth-child(2)").should("have.text", "max.muster@suva.ch")
30+
cy.get("#loan_table > tbody > tr > td:nth-child(2)").should("have.text", "max.muster@suva.ch")
3131
})
32-
})
32+
})

0 commit comments

Comments
 (0)