Skip to content

Commit

Permalink
refactor: pipeline tests
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 committed Feb 7, 2024
1 parent 24b523e commit e5814fe
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 145 deletions.
62 changes: 25 additions & 37 deletions cypress/integration/pipeline.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

context('Pipeline', () => {
context(
'logged in and server returning pipeline configuration and templates errors',
'logged in and server returning pipeline configuration error and templates errors',
() => {
beforeEach(() => {
cy.server();
Expand Down Expand Up @@ -126,60 +126,48 @@ context('Pipeline', () => {

context('click line number', () => {
beforeEach(() => {
cy.get('[data-test=config-line-num-0-2]').click({ force: true });
cy.get('[data-test=config-line-num-2]').click({ force: true });
});

it('should update path with line num', () => {
cy.hash().should('eq', '#config:0:2');
cy.hash().should('eq', '#2');
});

it('other lines should not have focus style', () => {
cy.get('[data-test=config-line-0-3]').should(
cy.get('[data-test=config-line-3]').should(
'not.have.class',
'-focus',
);
});

it('should set focus style on single line', () => {
cy.get('[data-test=config-line-0-2]').should(
'have.class',
'-focus',
);
cy.get('[data-test=config-line-2]').should('have.class', '-focus');
});
});

context('click line number, then shift click other line number', () => {
beforeEach(() => {
cy.get('[data-test=config-line-num-0-2]')
cy.get('[data-test=config-line-num-2]')
.type('{shift}', { release: false })
.get('[data-test=config-line-num-0-5]')
.get('[data-test=config-line-num-5]')
.click({ force: true });
});

it('should update path with range', () => {
cy.hash().should('eq', '#config:0:2:5');
cy.hash().should('eq', '#2:5');
});

it('lines outside the range should not have focus style', () => {
cy.get('[data-test=config-line-0-6]').should(
cy.get('[data-test=config-line-6]').should(
'not.have.class',
'-focus',
);
});

it('lines within the range should have focus style', () => {
cy.get('[data-test=config-line-0-2]').should(
'have.class',
'-focus',
);
cy.get('[data-test=config-line-0-3]').should(
'have.class',
'-focus',
);
cy.get('[data-test=config-line-0-4]').should(
'have.class',
'-focus',
);
cy.get('[data-test=config-line-2]').should('have.class', '-focus');
cy.get('[data-test=config-line-3]').should('have.class', '-focus');
cy.get('[data-test=config-line-4]').should('have.class', '-focus');
});
});
});
Expand All @@ -193,54 +181,54 @@ context('Pipeline', () => {
});

it('pipeline configuration data should respect yaml spacing', () => {
cy.get('[data-test=config-line-0-1]').should('contain', 'version:');
cy.get('[data-test=config-line-0-2]').should('contain', 'steps:');
cy.get('[data-test=config-line-1]').should('contain', 'version:');
cy.get('[data-test=config-line-2]').should('contain', 'steps:');
});

context('click line number', () => {
beforeEach(() => {
cy.get('[data-test=config-line-num-0-2]').click({ force: true });
cy.get('[data-test=config-line-num-2]').click({ force: true });
});

it('should update path with line num', () => {
cy.hash().should('eq', '#config:0:2');
cy.hash().should('eq', '#2');
});

it('other lines should not have focus style', () => {
cy.get('[data-test=config-line-0-3]').should(
cy.get('[data-test=config-line-3]').should(
'not.have.class',
'-focus',
);
});

it('should set focus style on single line', () => {
cy.get('[data-test=config-line-0-2]').should('have.class', '-focus');
cy.get('[data-test=config-line-2]').should('have.class', '-focus');
});
});

context('click line number, then shift click other line number', () => {
beforeEach(() => {
cy.get('[data-test=config-line-num-0-2]')
cy.get('[data-test=config-line-num-2]')
.type('{shift}', { release: false })
.get('[data-test=config-line-num-0-5]')
.get('[data-test=config-line-num-5]')
.click({ force: true });
});

it('should update path with range', () => {
cy.hash().should('eq', '#config:0:2:5');
cy.hash().should('eq', '#2:5');
});

it('lines outside the range should not have focus style', () => {
cy.get('[data-test=config-line-0-6]').should(
cy.get('[data-test=config-line-6]').should(
'not.have.class',
'-focus',
);
});

it('lines within the range should have focus style', () => {
cy.get('[data-test=config-line-0-2]').should('have.class', '-focus');
cy.get('[data-test=config-line-0-3]').should('have.class', '-focus');
cy.get('[data-test=config-line-0-4]').should('have.class', '-focus');
cy.get('[data-test=config-line-2]').should('have.class', '-focus');
cy.get('[data-test=config-line-3]').should('have.class', '-focus');
cy.get('[data-test=config-line-4]').should('have.class', '-focus');
});
});
},
Expand Down
2 changes: 1 addition & 1 deletion src/elm/Components/Secrets.elm
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ viewSharedSecrets shared props =
)

RemoteData.Failure error ->
( span [ Util.testAttribute "repo-secrets-error" ]
( span [ Util.testAttribute "shared-secrets-error" ]
[ text <|
case error of
Http.BadStatus statusCode ->
Expand Down
Loading

0 comments on commit e5814fe

Please sign in to comment.