mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 05:53:09 +02:00
refactor for e2e
This commit is contained in:
parent
65a597a35d
commit
a531b8aeee
3 changed files with 10 additions and 10 deletions
|
@ -19,26 +19,26 @@ describe('After user signed in', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('widget edit toggle is visible', () => {
|
it('widget edit toggle is visible', () => {
|
||||||
cy.get('.mk-widget-edit').should('be.visible');
|
cy.get('[data-cy-widget-edit]').should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('widget select should be visible in edit mode', () => {
|
it('widget select should be visible in edit mode', () => {
|
||||||
cy.get('.mk-widget-edit').click();
|
cy.get('[data-cy-widget-edit]').click();
|
||||||
cy.get('.mk-widget-select').should('be.visible');
|
cy.get('[data-cy-widget-select]').should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('first widget should be removed', () => {
|
it('first widget should be removed', () => {
|
||||||
cy.get('.mk-widget-edit').click();
|
cy.get('[data-cy-widget-edit]').click();
|
||||||
cy.get('[data-cy-customize-container]:first-child [data-cy-customize-container-remove]._button').click();
|
cy.get('[data-cy-customize-container]:first-child [data-cy-customize-container-remove]._button').click();
|
||||||
cy.get('[data-cy-customize-container]').should('have.length', 2);
|
cy.get('[data-cy-customize-container]').should('have.length', 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
function buildWidgetTest(widgetName) {
|
function buildWidgetTest(widgetName) {
|
||||||
it(`${widgetName} widget should get added`, () => {
|
it(`${widgetName} widget should get added`, () => {
|
||||||
cy.get('.mk-widget-edit').click();
|
cy.get('[data-cy-widget-edit]').click();
|
||||||
cy.get('.mk-widget-select select').select(widgetName, { force: true });
|
cy.get('[data-cy-widget-select] select').select(widgetName, { force: true });
|
||||||
cy.get('[data-cy-bg]._modalBg[data-cy-transparent]').click({ multiple: true, force: true });
|
cy.get('[data-cy-bg]._modalBg[data-cy-transparent]').click({ multiple: true, force: true });
|
||||||
cy.get('.mk-widget-add').click({ force: true });
|
cy.get('[data-cy-widget-add]').click({ force: true });
|
||||||
cy.get(`[data-cy-mkw-${widgetName}]`).should('exist');
|
cy.get(`[data-cy-mkw-${widgetName}]`).should('exist');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<div :class="$style.root">
|
<div :class="$style.root">
|
||||||
<template v-if="edit">
|
<template v-if="edit">
|
||||||
<header :class="$style['edit-header']">
|
<header :class="$style['edit-header']">
|
||||||
<MkSelect v-model="widgetAdderSelected" style="margin-bottom: var(--margin)" class="mk-widget-select">
|
<MkSelect v-model="widgetAdderSelected" style="margin-bottom: var(--margin)" data-cy-widget-select>
|
||||||
<template #label>{{ i18n.ts.selectWidget }}</template>
|
<template #label>{{ i18n.ts.selectWidget }}</template>
|
||||||
<option v-for="widget in widgetDefs" :key="widget" :value="widget">{{ i18n.t(`_widgets.${widget}`) }}</option>
|
<option v-for="widget in widgetDefs" :key="widget" :value="widget">{{ i18n.t(`_widgets.${widget}`) }}</option>
|
||||||
</MkSelect>
|
</MkSelect>
|
||||||
<MkButton inline primary class="mk-widget-add" @click="addWidget"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton>
|
<MkButton inline primary data-cy-widget-add @click="addWidget"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton>
|
||||||
<MkButton inline @click="$emit('exit')">{{ i18n.ts.close }}</MkButton>
|
<MkButton inline @click="$emit('exit')">{{ i18n.ts.close }}</MkButton>
|
||||||
</header>
|
</header>
|
||||||
<Sortable
|
<Sortable
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<XWidgets :class="$style.widgets" :edit="editMode" :widgets="widgets" @add-widget="addWidget" @remove-widget="removeWidget" @update-widget="updateWidget" @update-widgets="updateWidgets" @exit="editMode = false"/>
|
<XWidgets :class="$style.widgets" :edit="editMode" :widgets="widgets" @add-widget="addWidget" @remove-widget="removeWidget" @update-widget="updateWidget" @update-widgets="updateWidgets" @exit="editMode = false"/>
|
||||||
|
|
||||||
<button v-if="editMode" class="_textButton" style="font-size: 0.9em;" @click="editMode = false"><i class="ti ti-check"></i> {{ i18n.ts.editWidgetsExit }}</button>
|
<button v-if="editMode" class="_textButton" style="font-size: 0.9em;" @click="editMode = false"><i class="ti ti-check"></i> {{ i18n.ts.editWidgetsExit }}</button>
|
||||||
<button v-else class="_textButton mk-widget-edit" :class="$style.edit" style="font-size: 0.9em;" @click="editMode = true"><i class="ti ti-pencil"></i> {{ i18n.ts.editWidgets }}</button>
|
<button v-else class="_textButton" data-cy-widget-edit :class="$style.edit" style="font-size: 0.9em;" @click="editMode = true"><i class="ti ti-pencil"></i> {{ i18n.ts.editWidgets }}</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue