Skip to content

Commit

Permalink
Merge pull request #2589 from phpDocumentor/fix-cypress-tests
Browse files Browse the repository at this point in the history
Fix cypress tests
  • Loading branch information
jaapio committed Oct 4, 2020
2 parents c77e38b + 8158f3c commit 53ecb45
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ jobs:
e2e:
runs-on: ubuntu-16.04
name: E2E tests [ubuntu-latest]
continue-on-error: true
needs:
- setup
steps:
Expand Down Expand Up @@ -388,7 +387,6 @@ jobs:

e2e-matrix:
runs-on: ${{ matrix.operating-system }}
continue-on-error: true
strategy:
matrix:
php-versions:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ unit-test integration-test functional-test:

.PHONY: e2e-test
e2e-test: node_modules/.bin/cypress build/default/index.html build/clean/index.html
docker run -it --rm -v ${CURDIR}:/e2e -w /e2e cypress/included:3.2.0
docker run -it --rm -v ${CURDIR}:/e2e -w /e2e cypress/included:4.5.0

.PHONY: composer-require-checker
composer-require-checker:
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/default/class-details.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ describe('Class Detail Page', function() {
});

it('Show methods with return type in the Table of Contents', function() {
cy.get('.phpdocumentor-table_of_contents dt')
cy.get('.phpdocumentor-table-of-contents__entry')
.contains("jsonSerialize()").parent()
.contains(': array'); // type
});

describe('Showing a method in a class', function() {
let methods;

const findMethod = (name) => methods.get('.phpdocumentor-method__name').contains(name).parent();
const findMethod = (name) => methods.get('.phpdocumentor-element__name').contains(name).parent();

before(function(){
cy.visit('build/default/classes/Marios-Pizzeria.html');
Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/default/frontpage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Frontpage', function() {
it('Can open the "Marios" namespace page from the sidebar', function() {
cy.get('.phpdocumentor-sidebar').contains("Marios").click();
cy.url().should('include', '/namespaces/marios.html');
cy.get('.phpdocumentor-content > h2').contains("Marios");
cy.get('.phpdocumentor-content > article > h2').contains("Marios");
});

it('Has the "Pizza" (sub)namespace in the sidebar', function() {
Expand All @@ -29,7 +29,7 @@ describe('Frontpage', function() {
it('Can open the "Pizza" namespace page from the sidebar', function() {
cy.get('.phpdocumentor-sidebar .phpdocumentor-list').contains("Pizza").click();
cy.url().should('include', '/namespaces/marios-pizza.html');
cy.get('.phpdocumentor-content > h2').contains("Pizza");
cy.get('.phpdocumentor-content > article > h2').contains("Pizza");
});

it('Has the "Marios" namespace in the main content', function() {
Expand All @@ -39,6 +39,6 @@ describe('Frontpage', function() {
it('Can open the "Marios" namespace from the main content', function() {
cy.get('.phpdocumentor-content').contains("Marios").click();
cy.url().should('include', '/namespaces/marios.html');
cy.get('.phpdocumentor-content > h2').contains("Marios");
cy.get('.phpdocumentor-content > article > h2').contains("Marios");
});
});
20 changes: 10 additions & 10 deletions cypress/integration/default/namespace-details.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,50 @@ describe('Namespace Detail Page', function() {
});

it('Has a section "Namespaces" featuring the "Pizza" sub-namespace', function() {
cy.get('.phpdocumentor-content > h3').contains("Namespaces")
cy.get('.phpdocumentor-content > article > h3').contains("Namespaces")
.next().get('dt a').contains("Pizza");
});

it('Goes to the "Pizza" sub-namespace when you click on it', function() {
cy.get('.phpdocumentor-content > h3').contains("Namespaces")
cy.get('.phpdocumentor-content > article > h3').contains("Namespaces")
.next().get('dt a').contains("Pizza").click();

cy.url().should('include', '/namespaces/marios-pizza.html');
cy.get('.phpdocumentor-content__title').contains("Pizza");
});

it('Has a section "Interfaces, Classes and Traits" featuring the "Pizzeria" class', function() {
cy.get('.phpdocumentor-content > h3').contains("Interfaces, Classes and Traits")
cy.get('.phpdocumentor-content > article > h3').contains("Interfaces, Classes and Traits")
.next().get('dt a').contains("Pizzeria");
});

it('Has a section "Interfaces, Classes and Traits" featuring the "Product" interface', function() {
cy.get('.phpdocumentor-content > h3').contains("Interfaces, Classes and Traits")
cy.get('.phpdocumentor-content > article > h3').contains("Interfaces, Classes and Traits")
.next().get('dt a').contains("Product");
});

it('Goes to "Pizzeria" its detail page when you click on it', function() {
cy.get('.phpdocumentor-content > h3').contains("Interfaces, Classes and Traits")
cy.get('.phpdocumentor-content > article > h3').contains("Interfaces, Classes and Traits")
.next().get('dt a').contains("Pizzeria").click();

cy.url().should('include', '/classes/Marios-Pizzeria.html');
cy.get('.phpdocumentor-content__title').contains("Pizzeria");
});

it('Has a section "Functions" featuring the "heatOven" function', function() {
cy.get('.phpdocumentor-functions__header').contains("Functions")
.next().get('.phpdocumentor-function__name').contains("heatOven");
cy.get('.phpdocumentor-elements__header').contains("Functions")
.next().get('.phpdocumentor-element__name').contains("heatOven");
});

// TODO: Test shows broken behaviour, fix that
it.skip('Has a section "Constants" featuring the "OVEN_TEMPERATURE" constant', function() {
cy.get('.phpdocumentor-constants__header').contains("Constants")
cy.get('.phpdocumentor-elements__header').contains("Constants")
.next().get('dt a').contains("OVEN_TEMPERATURE");
});

// TODO: Test shows broken behaviour, fix that
it.skip('Has a section "Constants" featuring the "HIGHER_OVEN_TEMPERATURE" constant', function() {
cy.get('.phpdocumentor-content > h3').contains("Constants")
cy.get('.phpdocumentor-content > article > h3').contains("Constants")
.next().get('dt a').contains("HIGHER_OVEN_TEMPERATURE");
});
});
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('Namespace Detail Page for a (sub)namespace', function() {
});

it('Has a section "Interfaces, Classes and Traits" featuring the "Base" class', function() {
cy.get('.phpdocumentor-content > h3').contains("Interfaces, Classes and Traits")
cy.get('.phpdocumentor-content > article > h3').contains("Interfaces, Classes and Traits")
.next().get('dt a').contains("Base");
});
});

0 comments on commit 53ecb45

Please sign in to comment.