Skip to content

Commit

Permalink
updates e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SandyRogers committed Oct 4, 2024
1 parent c0049ef commit 083a497
Show file tree
Hide file tree
Showing 7 changed files with 2,007 additions and 3,743 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,22 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- uses: actions/checkout@v4
- name: Cypress run
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v6
with:
browser: chrome
start: npm start
wait-on: 'http://localhost:3000'
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: cypress/videos
- name: upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
13 changes: 13 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
// setupNodeEvents(on, config) {
// return require('./cypress/plugins/index.js')(on, config)
// },
specPattern: 'cypress/e2e/**/*.test.js',
baseUrl: 'http://localhost:3000',
},
})
3 changes: 0 additions & 3 deletions cypress.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Cypress.Commands.add('assertValueCopiedToClipboard', expected => {
cy.window().then(win => {
win.navigator.clipboard.readText().then(text => {
expect(text).to.contains(expected)
})
})
})

describe("Deciphon website tests", () => {
beforeEach(() => {
cy.intercept("GET", "http://api/dbs", { fixture: "dbs.json" });
Expand Down Expand Up @@ -96,13 +104,10 @@ describe("Deciphon website tests", () => {
cy.visit("http://localhost:3000/jobs/100");
cy.contains("Job is pending").should("be.visible");
cy.contains("There are 10 jobs ahead").should("be.visible");

cy.get("a").first().focus();
cy.get(".icon-copy").click();
cy.contains("👍").should("be.visible");
cy.window()
.its("navigator.clipboard")
.invoke("readText")
.should("equal", "http://localhost:3000/jobs/100");
cy.assertValueCopiedToClipboard("http://localhost:3000/jobs/100");
});

it("shows running query", () => {
Expand Down Expand Up @@ -146,15 +151,12 @@ describe("Deciphon website tests", () => {
};

for (const dlTitle in titleToProds) {
cy.get("a").first().focus();
cy.get("article")
.filter(`:contains('${dlTitle}')`)
.find(".icon-copy")
.click();

cy.window()
.its("navigator.clipboard")
.invoke("readText")
.should("contain", titleToProds[dlTitle].clip);
cy.assertValueCopiedToClipboard(titleToProds[dlTitle].clip)

cy.get("article")
.filter(`:contains('${dlTitle}')`)
Expand Down
File renamed without changes.
Loading

0 comments on commit 083a497

Please sign in to comment.